-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathForm1.cs
2481 lines (2346 loc) · 79.9 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Better_Nike_Bot.Browser;
using Better_Nike_Bot.Properties;
using BrightIdeasSoftware;
using ComponentOwl.BetterSplitButton;
using CsQuery.ExtensionMethods.Internal;
using DotNetBrowser;
using IMLokesh.EnumerationUtility;
using IMLokesh.Extensions;
using IMLokesh.FileUtility;
using IMLokesh.FormUtility;
using IMLokesh.Http;
using IMLokesh.HttpUtility;
using IMLokesh.RandomUtility;
using IMLokesh.ThreadUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using wyDay.Controls;
using wyDay.TurboActivate;
namespace Better_Nike_Bot
{
// Token: 0x0200002C RID: 44
public partial class Form1 : Form
{
// Token: 0x060001F0 RID: 496 RVA: 0x000221BC File Offset: 0x000203BC
public Form1()
{
this._ndcAccounts = new List<Account>();
this._processedTweets = new HashSet<long>();
this._shouldStop = new List<ShouldStop>();
this._scheduleWait = new ManualResetEvent(false);
this._showAll = true;
this.InitializeComponent();
base.CenterToParent();
this.LoadSettings();
Form1.DefaultForm = this;
this.textBoxMonitorAccount.Text = this._monitorAccount;
this.textBoxTwitterPassword.Text = this._twitterPassword;
this.textBoxUsername.Text = this._twitterUsername;
this.labelAccountCount.Text = this._ndcAccounts.Count.ToString();
this.checkBoxDisableTwitter.Checked = this.DisableTwitter;
ServicePointManager.DefaultConnectionLimit = 10000;
BrowserPreferences.SetChromiumSwitches(new string[]
{
"--disable-web-security",
"--ignore-certificate-errors"
});
BrowserPreferences.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36");
try
{
Form1.BrowserDataDir = Path.Combine(FileHelper.CurrentDirectory(), "browser_data");
if (!Directory.Exists(Form1.BrowserDataDir))
{
Directory.CreateDirectory(Form1.BrowserDataDir);
}
new DirectoryInfo(Form1.BrowserDataDir).Empty();
}
catch (Exception)
{
}
ServicePointManager.ServerCertificateValidationCallback = ((object param0, X509Certificate param1, X509Chain param2, SslPolicyErrors param3) => true);
ServicePointManager.SecurityProtocol = (SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12);
if (Form1.Abc != "cba")
{
Environment.Exit(0);
}
}
// Token: 0x060001F2 RID: 498 RVA: 0x00022438 File Offset: 0x00020638
private void LoadSettings()
{
try
{
if (!Settings.Default.TwitterUsername.IsNullOrWhiteSpace())
{
this._twitterUsername = Settings.Default.TwitterUsername;
}
if (!Settings.Default.TwitterPassword.IsNullOrWhiteSpace())
{
this._twitterPassword = Settings.Default.TwitterPassword;
}
if (!Settings.Default.MonitorUser.IsNullOrWhiteSpace())
{
this._monitorAccount = Settings.Default.MonitorUser;
}
if (!Settings.Default.NdcAccounts.IsNullOrWhiteSpace())
{
this._ndcAccounts = JsonConvert.DeserializeObject<List<Account>>(Settings.Default.NdcAccounts);
}
if (!Settings.Default.Proxies.IsNullOrWhiteSpace())
{
Form1.Proxies = JsonConvert.DeserializeObject<List<string>>(Settings.Default.Proxies);
}
if (!Settings.Default.MonitorLinkCache.IsNullOrWhiteSpace())
{
Form1.MonitorLinkCache = JsonConvert.DeserializeObject<List<MonitorLink>>(Settings.Default.MonitorLinkCache);
}
if (!Settings.Default.CreditCardProfiles.IsNullOrWhiteSpace())
{
Form1.CreditCardProfiles = JsonConvert.DeserializeObject<List<CreditCardProfile>>(Settings.Default.CreditCardProfiles);
}
if (!Settings.Default.Tokens.IsNullOrWhiteSpace())
{
Form1.Tokens = JsonConvert.DeserializeObject<Dictionary<string, NikeToken>>(Settings.Default.Tokens);
}
Form1.GsSize = Settings.Default.GsSize;
Form1.AllSize = Settings.Default.AllSize;
Form1.SiteType = (SiteType)Settings.Default.SiteType;
Form1.SendNotifications = Settings.Default.SendNotifications;
Form1.SendPassword = Settings.Default.SendPassword;
Form1.VerboseLogging = Settings.Default.VerboseLogging;
MonitorLink.IntervalStart = Settings.Default.IntervalStart;
MonitorLink.IntervalStop = Settings.Default.IntervalEnd;
this.DisableTwitter = Settings.Default.DisableTwitter;
NotificationSettings.LoadSettings();
}
catch (Exception)
{
Settings.Default.Reset();
Settings.Default.Save();
this.LoadSettings();
}
}
// Token: 0x060001F3 RID: 499 RVA: 0x0002262C File Offset: 0x0002082C
public void SaveSettings()
{
Settings.Default.TwitterUsername = this._twitterUsername;
Settings.Default.TwitterPassword = this._twitterPassword;
Settings.Default.MonitorUser = this._monitorAccount;
Settings.Default.NdcAccounts = JsonConvert.SerializeObject(this._ndcAccounts);
Settings.Default.Proxies = JsonConvert.SerializeObject(Form1.Proxies);
Settings.Default.CreditCardProfiles = JsonConvert.SerializeObject(Form1.CreditCardProfiles);
Settings.Default.MonitorLinkCache = JsonConvert.SerializeObject(Form1.MonitorLinkCache);
Settings.Default.GsSize = Form1.GsSize;
Settings.Default.AllSize = Form1.AllSize;
Settings.Default.SiteType = Form1.SiteType.GetValue();
Settings.Default.VerboseLogging = Form1.VerboseLogging;
Settings.Default.SendNotifications = Form1.SendNotifications;
Settings.Default.SendPassword = Form1.SendPassword;
Settings.Default.IntervalStart = MonitorLink.IntervalStart;
Settings.Default.IntervalEnd = MonitorLink.IntervalStop;
Settings.Default.DisableTwitter = this.DisableTwitter;
this.labelAccountCount.Text = this._ndcAccounts.Count.ToString();
Settings.Default.Tokens = JsonConvert.SerializeObject(Form1.Tokens);
Settings.Default.Save();
}
// Token: 0x060001F4 RID: 500 RVA: 0x00022788 File Offset: 0x00020988
private void buttonStart_Click(object sender, EventArgs e)
{
Form1.ShouldStop = false;
if (this._ndcAccounts.Any<Account>())
{
if (!this._ndcAccounts.All((Account a) => a.Disabled))
{
if ((this._monitorAccount.IsNullOrWhiteSpace() || this._twitterPassword.IsNullOrWhiteSpace() || this._twitterUsername.IsNullOrWhiteSpace()) && !this.DisableTwitter)
{
"Please fill in twitter settings or disable twitter.".Show(MessageBoxIcon.Hand, "", MessageBoxButtons.OK);
return;
}
this.SaveSettings();
try
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
dictionary["serial_code"] = Form1.SerialCode;
dictionary["product_name"] = "aio";
dictionary["product_version"] = Form1.Version;
HttpHelper.PostUrl("http://api.betternikebot.com/v1/verify", dictionary, null, 10, "", "application/x-www-form-urlencoded", null, true);
}
catch (WebException ex)
{
string str = "";
if (ex.Message.Contains("401"))
{
str = "Please install the software with a valid serial code.";
}
(ex.Message + " " + str).Show(MessageBoxIcon.Hand, "", MessageBoxButtons.OK);
Application.Exit();
}
Form1.InitializeProxies();
this.EnableControls(false);
try
{
this.SaveSettings();
MonitorLink.ProcessedLinks = new List<KeyValuePair<Account, string>>();
Form1.MonitorLinks = new List<MonitorLink>();
new Thread(new ThreadStart(this.StartMonitor))
{
IsBackground = true
}.Start();
}
catch (Exception ex2)
{
Logger.Log("ERROR!: " + ex2.Message, true, true);
this.EnableControls(true);
}
return;
}
}
"Add at least one account.".Show(MessageBoxIcon.Hand, "", MessageBoxButtons.OK);
}
// Token: 0x060001F5 RID: 501 RVA: 0x00022954 File Offset: 0x00020B54
private static void InitializeProxies()
{
Form1.ProxyEnumeration = (Form1.Proxies.IsAny<string>() ? new EnumerationHelper<string>(Form1.Proxies, true) : new EnumerationHelper<string>(new string[]
{
""
}, true));
}
// Token: 0x060001F6 RID: 502 RVA: 0x00022998 File Offset: 0x00020B98
private void StartMonitor()
{
Logger.Log("Waiting for all accounts to log in. ", true, true);
foreach (Account account in this._ndcAccounts)
{
account.Request = new HttpHelper("", true, null, 15, null);
account.Http = new Http
{
SwallowWebExceptions = true
};
string proxyAddress = Form1.Proxies.IsAny<string>() ? Form1.ProxyEnumeration.GetNextObject() : "";
account.Request.Proxy = (account.Http.Proxy = (account.ProxyAddress = proxyAddress));
}
this.InvokeAction(new Action(this.RefreshTable));
foreach (Account account2 in this._ndcAccounts)
{
account2.IsLoggedIn = false;
}
foreach (CreditCardProfile creditCardProfile in Form1.CreditCardProfiles)
{
creditCardProfile.CheckoutCount = 0;
creditCardProfile.Lock = new object();
}
new ThreadHelper<Account>(from acc in this._ndcAccounts
where !acc.Disabled && !acc.IsWebSnkrs
select acc, delegate(Account acc)
{
acc.Login(0, Form1.SkipFailedLogins ? 3 : 0);
}, 10).Start();
new ThreadHelper<Account>(from acc in this._ndcAccounts
where !acc.Disabled && acc.IsWebSnkrs
select acc, delegate(Account acc)
{
acc.SnkrsLogin(0, Form1.SkipFailedLogins ? 3 : 0);
}, 10).Start();
if (Form1.ShouldStop)
{
return;
}
IEnumerable<Account> source = from acc in this._ndcAccounts
where acc.IsLoggedIn && !acc.Disabled
select acc;
Logger.Log("All ndc accounts are now logged in.", true, true);
using (IEnumerator<string> enumerator4 = source.SelectMany((Account s) => s.EarlyLinks).Distinct<string>().GetEnumerator())
{
while (enumerator4.MoveNext())
{
string link = enumerator4.Current;
Form1.MonitorLinks.Add(new MonitorLink(link, from a in source
where a.EarlyLinks.Contains(link) && !a.IsWebSnkrs
select a));
}
}
ShouldStop shouldStop = new ShouldStop();
this._shouldStop.Add(shouldStop);
using (IEnumerator<string> enumerator5 = source.SelectMany((Account s) => s.ProductStyleCodes).Distinct<string>().GetEnumerator())
{
while (enumerator5.MoveNext())
{
string style = enumerator5.Current;
IEnumerable<Account> enumerable = from a in source
where a.ProductStyleCodes.Contains(style) && a.IsWebSnkrs
select a;
foreach (Account account3 in enumerable)
{
string[] size = account3.Size;
for (int i = 0; i < size.Length; i++)
{
string text = size[i];
Account acc1 = account3;
string s1 = text;
new Thread(delegate()
{
new WebSnkrs(new AtcItem(acc1, "", s1)
{
Details =
{
StyleCode = style
},
ShouldStop = shouldStop
}).Atc();
}).Start();
Logger.Log("{0} (Size {2}): Processing style code {1}".With(new object[]
{
account3.EmailAddress,
style,
text
}), true, true);
}
}
}
}
}
// Token: 0x060001F7 RID: 503 RVA: 0x00022E7C File Offset: 0x0002107C
private void Form1_Load(object sender, EventArgs e)
{
this.checkForUpdatesToolStripMenuItem.PerformClick();
this.textBoxTwitterPassword.PasswordChar = '•';
if (Form1.AllSize)
{
this.comboBoxSizeType.SelectedIndex = 2;
}
else if (Form1.GsSize)
{
this.comboBoxSizeType.SelectedIndex = 1;
}
else
{
this.comboBoxSizeType.SelectedIndex = 0;
}
this.comboBoxSiteType.SelectedIndex = Form1.SiteType.GetValue();
this.checkBoxNotifications.Checked = Form1.SendNotifications;
this.checkBoxSendPassword.Checked = Form1.SendPassword;
Logger.Log("Application loaded.", true, true);
try
{
this.CallHome();
}
catch (Exception)
{
"Error getting license information. ".Show(MessageBoxIcon.Hand, "", MessageBoxButtons.OK);
Application.Exit();
}
this.objectListView1.FullRowSelect = true;
this.objectListView1.HideSelection = false;
this.olvColumn3.AspectToStringConverter = ((object value) => ((string[])value).JoinToString(","));
this.olvColumn5.AspectToStringConverter = ((object value) => ((List<string>)value).JoinToString(","));
this.olvColumn9.AspectToStringConverter = ((object value) => ((List<string>)value).JoinToString(","));
this.olvColumn2.IsVisible = false;
this.objectListView1.SetObjects(this._ndcAccounts);
this.objectListView1.SmallImageList = null;
this.RefreshTable();
this.newToolStripMenuItem.Click += this.getSKUsToolStripMenuItem_Click;
this.oldToolStripMenuItem.Click += this.getSKUsToolStripMenuItem_Click;
}
// Token: 0x060001F8 RID: 504 RVA: 0x00002FFF File Offset: 0x000011FF
private void CallHome()
{
}
// Token: 0x060001F9 RID: 505 RVA: 0x00023040 File Offset: 0x00021240
private void RefreshTable()
{
try
{
this.objectListView1.SetObjects(from acc in this._ndcAccounts
where this._showAll || !acc.Disabled
select acc);
this.objectListView1.BuildList();
this.olvColumn1.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
this.olvColumn2.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
this.olvColumn2.IsVisible = false;
this.objectListView1.RebuildColumns();
this.SaveSettings();
}
catch (Exception ex)
{
Logger.Log("Error updating accounts view... {0}".With(new object[]
{
ex
}), true, true);
}
}
// Token: 0x060001FA RID: 506 RVA: 0x000230E8 File Offset: 0x000212E8
private void buttonAddAccount_Click(object sender, EventArgs e)
{
using (AccountDetailsForm accountDetailsForm = new AccountDetailsForm(null, "", ""))
{
DialogResult dialogResult = accountDetailsForm.ShowDialog();
if (dialogResult == DialogResult.OK)
{
this._ndcAccounts.Add(accountDetailsForm.Account);
this.RefreshTable();
}
}
}
// Token: 0x060001FB RID: 507 RVA: 0x00023144 File Offset: 0x00021344
private void buttonRemove_Click(object sender, EventArgs e)
{
IList selectedObjects = this.objectListView1.SelectedObjects;
if (selectedObjects.Count == 0)
{
Button window = (Button)sender;
ToolTip toolTip = new ToolTip();
toolTip.Show("Please select the accounts you want to remove.", window, 0, 25, 3000);
return;
}
foreach (object obj in selectedObjects)
{
this._ndcAccounts.Remove((Account)obj);
}
this.RefreshTable();
}
// Token: 0x060001FC RID: 508 RVA: 0x000231E4 File Offset: 0x000213E4
private void buttonEditAccount_Click(object sender, EventArgs e)
{
Account account = (this.objectListView1.SelectedObjects.Count > 0) ? ((Account)this.objectListView1.SelectedObjects[0]) : null;
if (account == null)
{
Button window = (Button)sender;
ToolTip toolTip = new ToolTip();
toolTip.Show("Please select an account to edit.", window, 0, 25, 3000);
return;
}
using (AccountDetailsForm accountDetailsForm = new AccountDetailsForm(account, "", ""))
{
DialogResult dialogResult = accountDetailsForm.ShowDialog();
if (dialogResult == DialogResult.OK)
{
account.UpdateDetails(accountDetailsForm.Account);
this.RefreshTable();
}
}
}
// Token: 0x060001FD RID: 509 RVA: 0x00003001 File Offset: 0x00001201
private void textBoxUsername_TextChanged(object sender, EventArgs e)
{
this._twitterUsername = ((TextBox)sender).Text.Trim();
}
// Token: 0x060001FE RID: 510 RVA: 0x00003019 File Offset: 0x00001219
private void textBoxMonitorAccount_TextChanged(object sender, EventArgs e)
{
this._monitorAccount = ((TextBox)sender).Text.Trim();
}
// Token: 0x060001FF RID: 511 RVA: 0x00003031 File Offset: 0x00001231
private void textBoxTwitterPassword_TextChanged(object sender, EventArgs e)
{
this._twitterPassword = ((TextBox)sender).Text.Trim();
}
// Token: 0x06000200 RID: 512 RVA: 0x00023290 File Offset: 0x00021490
private void buttonClone_Click(object sender, EventArgs e)
{
IList selectedObjects = this.objectListView1.SelectedObjects;
if (selectedObjects.Count == 0)
{
Button window = (Button)sender;
ToolTip toolTip = new ToolTip();
toolTip.Show("Please select the accounts you want to clone.", window, 0, 25, 3000);
return;
}
foreach (object obj in selectedObjects)
{
this._ndcAccounts.Add(new Account((Account)obj));
}
this.RefreshTable();
}
// Token: 0x06000201 RID: 513 RVA: 0x00003049 File Offset: 0x00001249
private void objectListView1_DoubleClick(object sender, EventArgs e)
{
this.buttonEditAccount.PerformClick();
}
// Token: 0x06000202 RID: 514 RVA: 0x00023334 File Offset: 0x00021534
private void buttonStop_Click(object sender, EventArgs e)
{
this.EnableControls(true);
Form1.ShouldStop = true;
foreach (ShouldStop shouldStop in this._shouldStop)
{
shouldStop.Value = true;
}
Logger.Log("Stopped by user.", true, true);
}
// Token: 0x06000203 RID: 515 RVA: 0x000233A4 File Offset: 0x000215A4
private void EnableControls(bool enabled = true)
{
List<Control> list = new List<Control>();
list.AddRange(this.GetAllChildren(typeof(TextBox)));
list.AddRange(this.GetAllChildren(typeof(ComboBox)));
list.AddRange(this.GetAllChildren(typeof(Button)));
list.AddRange(this.GetAllChildren(typeof(BetterSplitButton)));
list.AddRange(this.GetAllChildren(typeof(CheckBox)));
foreach (Control control in list)
{
if (!control.Name.EqualsAny(new string[]
{
"checkBoxVerboseLogging",
"buttonTestCaptcha",
"textBoxLog",
"checkBoxNotifications",
"checkBoxAutoScrollLog",
"checkBoxSoldOutRetry",
"buttonPauseLog",
"buttonClearLog"
}))
{
if (control.Name.EqualsAny(new string[]
{
"buttonStop"
}))
{
control.Enabled = !enabled;
}
else
{
control.Enabled = enabled;
}
}
}
if (enabled)
{
this.checkBoxDisableTwitter_CheckedChanged(null, null);
}
this.deactivateToolStripMenuItem.Enabled = enabled;
}
// Token: 0x06000204 RID: 516 RVA: 0x00023508 File Offset: 0x00021708
private void comboBoxSizeType_SelectedIndexChanged(object sender, EventArgs e)
{
Form1.GsSize = (this.comboBoxSizeType.SelectedIndex == 1);
Form1.AllSize = (this.comboBoxSizeType.SelectedIndex == 2);
Form1.MatchStrings = (Form1.GsSize ? new string[]
{
"Boys'",
"Kids'"
} : new string[]
{
"Men's"
});
this.SaveSettings();
}
// Token: 0x06000205 RID: 517 RVA: 0x00023578 File Offset: 0x00021778
private void textBoxIntervalStart_Enter(object sender, EventArgs e)
{
TextBox window = (TextBox)sender;
ToolTip toolTip = new ToolTip();
toolTip.Show("The bot will wait random amount of ms within this range between requests.", window, 0, 22, 3000);
}
// Token: 0x06000206 RID: 518 RVA: 0x00003056 File Offset: 0x00001256
private void comboBoxSiteType_SelectedIndexChanged(object sender, EventArgs e)
{
Form1.SiteType = (SiteType)this.comboBoxSiteType.SelectedIndex;
this.SaveSettings();
}
// Token: 0x06000207 RID: 519 RVA: 0x0000306E File Offset: 0x0000126E
private void objectListView1_CellRightClick(object sender, CellRightClickEventArgs e)
{
if (e.RowIndex >= 0 && this.objectListView1.SelectedObjects.Count != 0)
{
e.MenuStrip = this.contextMenuStrip1;
return;
}
}
// Token: 0x06000208 RID: 520 RVA: 0x000235A8 File Offset: 0x000217A8
private void checkCartToolStripMenuItem_Click(object sender, EventArgs e)
{
IEnumerable<Account> accs = this.objectListView1.SelectedObjects.Cast<Account>();
Task.Factory.StartNew(delegate()
{
foreach (Account account in accs)
{
try
{
if (!this.IsRunning)
{
account.Login(0, 0);
}
FormHelper.OutputHelper(true, "{0}: Cart Items".With(new object[]
{
account.EmailAddress
}), "Cart Items:", account.CheckCart(), 500, 0);
}
catch (Exception ex)
{
Logger.Log("{0}: Error checking cart. ".With(new object[]
{
account.EmailAddress,
ex.Message
}), true, true);
}
}
});
}
// Token: 0x17000093 RID: 147
// (get) Token: 0x06000209 RID: 521 RVA: 0x000235F0 File Offset: 0x000217F0
private bool IsRunning
{
get
{
bool x = false;
this.buttonStop.InvokeAction(delegate
{
x = this.buttonStop.Enabled;
});
return x;
}
}
// Token: 0x17000094 RID: 148
// (get) Token: 0x0600020A RID: 522 RVA: 0x00003098 File Offset: 0x00001298
// (set) Token: 0x0600020B RID: 523 RVA: 0x0000309F File Offset: 0x0000129F
public static bool UltimateVersion { get; set; }
// Token: 0x17000095 RID: 149
// (get) Token: 0x0600020C RID: 524 RVA: 0x000030A7 File Offset: 0x000012A7
// (set) Token: 0x0600020D RID: 525 RVA: 0x000030AE File Offset: 0x000012AE
public static string SerialCode { get; set; }
// Token: 0x0600020E RID: 526 RVA: 0x00023630 File Offset: 0x00021830
private void openInBrowserToolStripMenuItem_Click(object sender, EventArgs e)
{
Account account = (Account)this.objectListView1.SelectedObjects[0];
Account account2 = new Account(account);
account2.Request.ClearCookies();
account.LoginForBrowser();
new Better_Nike_Bot.Browser.Browser
{
Acc = account
}.Show();
}
// Token: 0x0600020F RID: 527 RVA: 0x00023680 File Offset: 0x00021880
private void clearCartToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult dialogResult = "Warning! This will remove all items from cart. Do you want to continue?".Show(MessageBoxIcon.Asterisk, "Warning!", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.No)
{
return;
}
IEnumerable<Account> accs = this.objectListView1.SelectedObjects.Cast<Account>();
Task.Factory.StartNew(delegate()
{
foreach (Account account in accs)
{
try
{
if (!this.IsRunning)
{
account.Login(0, 0);
}
account.ClearCart();
}
catch (Exception ex)
{
Logger.Log("{0}: Error clearing cart. ".With(new object[]
{
account.EmailAddress,
ex.Message
}), true, true);
}
}
});
}
// Token: 0x06000210 RID: 528 RVA: 0x000030B6 File Offset: 0x000012B6
private void checkBoxNotifications_CheckedChanged(object sender, EventArgs e)
{
Form1.SendNotifications = this.checkBoxNotifications.Checked;
this.SaveSettings();
}
// Token: 0x06000211 RID: 529 RVA: 0x000030CE File Offset: 0x000012CE
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Form1.AddedProductsForm.Show();
Form1.AddedProductsForm.BringToFront();
}
// Token: 0x06000212 RID: 530 RVA: 0x000236E0 File Offset: 0x000218E0
private void buttonPasteAccounts_Click(object sender, EventArgs e)
{
string[] linesArray = Clipboard.GetText().GetLinesArray(true);
string[] array = linesArray;
int i = 0;
while (i < array.Length)
{
string text = array[i];
List<string> list = text.Split(new char[]
{
'\t'
}).ToList<string>();
if (list.Count < 3)
{
goto IL_FC;
}
if (list.Count > 11)
{
goto IL_FC;
}
while (list.Count != 11)
{
list.Add("");
}
try
{
this._ndcAccounts.Add(new Account(list[0], list[1], list[2], list[3], list[4], list[5], list[6], list[7], list[8], list[9], null, false));
goto IL_129;
}
catch (Exception ex)
{
"Error adding account.\r\n{0}".With(new object[]
{
ex.Message
}).Show(MessageBoxIcon.Hand, "", MessageBoxButtons.OK);
goto IL_129;
}
goto IL_FC;
IL_129:
i++;
continue;
IL_FC:
DialogResult dialogResult = "Account is not in correct format.\r\n\r\n{0}\r\n\r\nClick Cancel to cancel the import or OK to continue.".With(new object[]
{
text
}).Show(MessageBoxIcon.Hand, "Error", MessageBoxButtons.OKCancel);
if (dialogResult != DialogResult.OK)
{
return;
}
goto IL_129;
}
this.RefreshTable();
}
// Token: 0x06000213 RID: 531 RVA: 0x0002383C File Offset: 0x00021A3C
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
string text = "";
try
{
Form1.UltimateVersion = HttpHelper.PostUrl("http://www.betternikebot.com/bnb/isUltimate.php", "pkey={0}".With(new object[]
{
Form1.SerialCode
}), null, 10, "", "application/x-www-form-urlencoded", null, true).ParseToBool();
}
catch (Exception ex)
{
text = "Error: {0}".With(new object[]
{
ex.Message
});
}
if (!Form1.UltimateVersion)
{
"Notification settings are only available in the ultimate version. {0}\r\n\r\nVisit BetterNikeBot.com for more information.\r\n\r\n If you recently upgraded to ultimate please allow a few minutes for changes. ".With(new object[]
{
text
}).Show(MessageBoxIcon.Hand, "", MessageBoxButtons.OK);
}
new AdvancedSettingsForm().ShowDialog();
}
// Token: 0x06000214 RID: 532 RVA: 0x000238F8 File Offset: 0x00021AF8
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
DialogResult dialogResult = "Are you sure?".Show(MessageBoxIcon.Exclamation, "", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.No)
{
return;
}
Settings.Default.Reset();
Settings.Default.Save();
"Settings reset. Please restart bot for changes to take effect.".Show(MessageBoxIcon.Asterisk, "", MessageBoxButtons.OK);
}
// Token: 0x06000215 RID: 533 RVA: 0x00023944 File Offset: 0x00021B44
private void checkBoxDisableTwitter_CheckedChanged(object sender, EventArgs e)
{
this.DisableTwitter = this.checkBoxDisableTwitter.Checked;
this.textBoxMonitorAccount.Enabled = !this.checkBoxDisableTwitter.Checked;
this.textBoxUsername.Enabled = !this.checkBoxDisableTwitter.Checked;
this.textBoxTwitterPassword.Enabled = !this.checkBoxDisableTwitter.Checked;
this.SaveSettings();
}
// Token: 0x06000216 RID: 534 RVA: 0x000030E4 File Offset: 0x000012E4
private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (this.buttonStart.Enabled)
{
"You can only set link booster settings when the bot is running! Click START.".Show(MessageBoxIcon.Hand, "", MessageBoxButtons.OK);
return;
}
new LinkScheduler().ShowDialog();
this.SaveSettings();
}
// Token: 0x06000217 RID: 535 RVA: 0x00003118 File Offset: 0x00001318
private void checkBoxOldMethod_CheckedChanged(object sender, EventArgs e)
{
Form1.UseOldMethod = this.checkBoxOldMethod.Checked;
}
// Token: 0x06000218 RID: 536 RVA: 0x000239B4 File Offset: 0x00021BB4
private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
bool checkBoxChecked = Form1.Proxies.IsAny<string>() && !Form1.Proxies.Contains("");
using (DataForm1 dataForm = new DataForm1(true, "Add or Edit Proxies", "Please enter proxies one per line below. Proxies will be automatically alloted to accounts.", Form1.Proxies.IsAny<string>() ? Form1.Proxies.JoinToString("\r\n").GetLinesArray(true).JoinToString("\r\n") : "ip:port\r\nip:port\r\nip:port:username:password", 500, 300, "Do not allot real ip to any account", checkBoxChecked, "Test proxies before adding"))
{
DialogResult dialogResult = dataForm.ShowDialog();
if (dialogResult == DialogResult.OK)
{
Form1.Proxies = new List<string>();
if (!dataForm.TextBoxText.IsNullOrWhiteSpace())
{
if (!dataForm.CheckBoxChecked)
{
Form1.Proxies.Add("");
}
Form1.Proxies.AddRange(dataForm.TextBoxText.GetLinesArray(true).Distinct<string>());
if (!dataForm.CheckBoxChecked2)
{
this.SaveSettings();
Logger.Log("Proxy settings saved.", true, true);
}
else if (dataForm.CheckSnkrs)
{
Task.Factory.StartNew(delegate()
{
Logger.Log("Checking proxies... please wait...", true, true);
Dictionary<string, string> dictionary = new Dictionary<string, string>();
foreach (string text in Form1.Proxies)
{
HttpHelper httpHelper = new HttpHelper(text, true, null, 20, null);
httpHelper.Cookies.SetCookies(new Uri("http://www.nike.com"), "nike_locale={0}/{1}".With(new object[]
{
NikeUrls.NikeCountrySmallCode,
NikeUrls.NikeLangLocale
}));
httpHelper.Cookies.SetCookies(new Uri("http://secure-store.nike.com"), "nike_locale={0}/{1}".With(new object[]
{
NikeUrls.NikeCountrySmallCode,
NikeUrls.NikeLangLocale
}));
httpHelper.Cookies.SetCookies(new Uri("http://secure-store.nike.com"), "NIKE_COMMERCE_COUNTRY={0}".With(new object[]
{
NikeUrls.NikeCountryCode
}));
httpHelper.Cookies.SetCookies(new Uri("http://secure-store.nike.com"), "NIKE_COMMERCE_LANG_LOCALE={0}".With(new object[]
{
NikeUrls.NikeLangLocale
}));
httpHelper.Cookies.SetCookies(new Uri("http://secure-store.nike.com"), "CONSUMERCHOICE={0}/{1}".With(new object[]
{
NikeUrls.NikeCountrySmallCode,
NikeUrls.NikeLangLocale
}));
httpHelper.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0\r\nMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36\r\nMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36\r\nMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36\r\nMozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 Safari/601.1.56\r\nMozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36\r\nMozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7\r\nMozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko".GetLinesArray(true).GetRandom<string>();
try
{
httpHelper.GetRequest("https://api.nike.com/commerce/productfeed/products/snkrs/A/thread?country=US&locale=en_US&withCards=true", null, null, true, true);
dictionary.Add(text, "403 (Forbidden)");
}
catch (Exception ex)
{
dictionary.Add(text, ex.Message);
}
}
if (dictionary.Count((KeyValuePair<string, string> p) => p.Value.Contains("400")) == Form1.Proxies.Count)
{
Logger.Log("All proxies are working correctly!", true, true);
return;
}
string s = "Following proxies had errors: \r\n{0}";
object[] array = new object[1];
array[0] = (from p in dictionary
where !p.Value.Contains("400")
select "Proxy: {0} Error: {1}".With(new object[]
{
p.Key,
p.Value
})).JoinToString("\r\n");
string msg = s.With(array);
Logger.Log(msg, true, true);
DialogResult dialogResult2 = "Some proxies had errors. Press OK to remove those proxies. Press cancel to keep them anyways. ".Show(MessageBoxIcon.Hand, "Proxies", MessageBoxButtons.OKCancel);
if (dialogResult2 == DialogResult.OK)
{
Form1.Proxies = (from p in dictionary
where p.Value.Contains("400")
select p.Key).ToList<string>();
this.SaveSettings();
}
});
}
else
{
Task.Factory.StartNew(delegate()
{
Logger.Log("Checking proxies... please wait...", true, true);
Dictionary<string, string> dictionary = new Dictionary<string, string>();
foreach (string text in Form1.Proxies)
{
HttpHelper httpHelper = new HttpHelper(text, true, null, 20, null);
httpHelper.Cookies.SetCookies(new Uri("http://www.nike.com"), "nike_locale={0}/{1}".With(new object[]
{
NikeUrls.NikeCountrySmallCode,
NikeUrls.NikeLangLocale
}));
httpHelper.Cookies.SetCookies(new Uri("http://secure-store.nike.com"), "nike_locale={0}/{1}".With(new object[]
{
NikeUrls.NikeCountrySmallCode,
NikeUrls.NikeLangLocale
}));
httpHelper.Cookies.SetCookies(new Uri("http://secure-store.nike.com"), "NIKE_COMMERCE_COUNTRY={0}".With(new object[]
{
NikeUrls.NikeCountryCode
}));
httpHelper.Cookies.SetCookies(new Uri("http://secure-store.nike.com"), "NIKE_COMMERCE_LANG_LOCALE={0}".With(new object[]
{
NikeUrls.NikeLangLocale
}));
httpHelper.Cookies.SetCookies(new Uri("http://secure-store.nike.com"), "CONSUMERCHOICE={0}/{1}".With(new object[]
{
NikeUrls.NikeCountrySmallCode,
NikeUrls.NikeLangLocale
}));
httpHelper.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0\r\nMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36\r\nMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36\r\nMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36\r\nMozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 Safari/601.1.56\r\nMozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36\r\nMozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7\r\nMozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko".GetLinesArray(true).GetRandom<string>();
Dictionary<string, string> postData = new Dictionary<string, string>
{
{
"login",
"{0}@gmail.com".With(new object[]
{
RandomHelper.RandomString(10, true)
})
},
{
"rememberMe",
"true"
},
{
"password",
"BNBFOREVA"
}
};
try
{
httpHelper.PostRequest(NikeUrls.NikeLogin, postData, NikeUrls.NikeStore, "application/x-www-form-urlencoded", new string[]
{
"X-Requested-With: XMLHttpRequest"
}, true);
dictionary.Add(text, "403 (Forbidden)");
}
catch (Exception ex)
{
dictionary.Add(text, ex.Message);
}
}
if (dictionary.Count((KeyValuePair<string, string> p) => p.Value.Contains("401")) == Form1.Proxies.Count)
{
Logger.Log("All proxies are working correctly!", true, true);
return;
}
string s = "Following proxies had errors: \r\n{0}";
object[] array = new object[1];
array[0] = (from p in dictionary
where !p.Value.Contains("401")
select "Proxy: {0} Error: {1}".With(new object[]
{
p.Key,
p.Value
})).JoinToString("\r\n");
string msg = s.With(array);
Logger.Log(msg, true, true);