-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainWindow.xaml.cs
4512 lines (3839 loc) · 169 KB
/
MainWindow.xaml.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 ESO_Assistant;
using ESO_Assistant.Classes;
using HtmlAgilityPack;
using Microsoft.Win32;
using Newtonsoft.Json;
using SharpCompress.Archives;
using SharpCompress.Common;
using SharpCompress.Readers;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Media;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Security.Cryptography;
using System.ServiceModel;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using System.Xml;
namespace MultiTools
{
/// <summary>
/// Логика взаимодействия для MainWindow.xaml
/// </summary>
///
public class MultiplyConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return new GridLength((double)values[0] * (double)values[1], GridUnitType.Pixel);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public partial class MainWindow : Window, INotifyPropertyChanged
{
public static RoutedCommand MyCommand = new RoutedCommand();
private void MyCommandExecuted(object sender, ExecutedRoutedEventArgs e)
{
if (bGenerateLogins.Visibility == Visibility.Collapsed)
bGenerateLogins.Visibility = Visibility.Visible;
else
bGenerateLogins.Visibility = Visibility.Collapsed;
if (bHackAccounts.Visibility == Visibility.Collapsed)
bHackAccounts.Visibility = Visibility.Visible;
else
bHackAccounts.Visibility = Visibility.Collapsed;
}
public class ActionCommand : ICommand
{
private readonly Action _action;
public ActionCommand(Action action)
{
_action = action;
}
public void Execute(object parameter)
{
_action();
}
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
}
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
}
private bool FGamesOpen { get; set; }
public bool GamesOpen
{
get { return FGamesOpen; }
set
{
if (value != FGamesOpen && value)
{
gSettings.Visibility = Visibility.Hidden;
}
FGamesOpen = value;
NotifyPropertyChanged("GamesOpen");
NotifyPropertyChanged("DisableMenu");
}
}
public bool DisableMenu
{
get { return !GamesOpen; }
}
private string FCurrentState { get; set; }
public string CurrentState
{
get { return FCurrentState; }
set
{
FCurrentState = value;
NotifyPropertyChanged("CurrentState");
}
}
private string hESO { get; set; }
public string ESOHint
{
get { return hESO; }
set
{
hESO = value;
NotifyPropertyChanged("ESOHint");
}
}
private Brush ESOColor { get; set; }
public Brush ESO
{
get { return ESOColor; }
set
{
ESOColor = value;
NotifyPropertyChanged("ESO");
}
}
private string _ESOPop { get; set; }
public string ESOPop
{
get { return _ESOPop; }
set
{
_ESOPop = value;
NotifyPropertyChanged("ESOPop");
}
}
private string _TADPop { get; set; }
public string TADPop
{
get { return _TADPop; }
set
{
_TADPop = value;
NotifyPropertyChanged("TADPop");
}
}
private string _NillaPop { get; set; }
public string NillaPop
{
get { return _NillaPop; }
set
{
_NillaPop = value;
NotifyPropertyChanged("NillaPop");
}
}
private Visibility FEPVisible { get; set; }
public Visibility EPVisible
{
get { return FEPVisible; }
set
{
FEPVisible = value;
NotifyPropertyChanged("EPVisible");
}
}
private Visibility FNVisible { get; set; }
public Visibility NVisible
{
get { return FNVisible; }
set
{
FNVisible = value;
NotifyPropertyChanged("NVisible");
}
}
private Visibility FXVisible { get; set; }
public Visibility XVisible
{
get { return FXVisible; }
set
{
FXVisible = value;
NotifyPropertyChanged("XVisible");
}
}
private Visibility FYVisible { get; set; }
public Visibility YVisible
{
get { return FYVisible; }
set
{
FYVisible = value;
NotifyPropertyChanged("YVisible");
}
}
private Visibility FTPVisible { get; set; }
public Visibility TPVisible
{
get { return FTPVisible; }
set
{
FTPVisible = value;
NotifyPropertyChanged("TPVisible");
}
}
private Visibility FXPVisible { get; set; }
public Visibility XPVisible
{
get { return FXPVisible; }
set
{
FXPVisible = value;
NotifyPropertyChanged("XPVisible");
}
}
SoundPlayer Click = new SoundPlayer(Application.GetResourceStream(new Uri("Click.wav", UriKind.Relative)).Stream);
async Task<string> HttpGetAsync(string URI)
{
try
{
HttpClient hc = new HttpClient();
hc.DefaultRequestHeaders.Accept.ParseAdd("application/vnd.twitchtv.v5+json");
hc.DefaultRequestHeaders.Add("Client-ID", "9rrpybi820nvoixrr2lkqk19ae8k4ef");
Task<System.IO.Stream> result = hc.GetStreamAsync(URI);
System.IO.Stream vs = await result;
using (StreamReader am = new StreamReader(vs, Encoding.UTF8))
{
return await am.ReadToEndAsync();
}
}
catch
{
return "";
}
}
async void GetPopInfo(string URI)
{
try
{
string Data = await HttpGetAsync(URI);
ServerStatus SS = new ServerStatus();
SS.Get(Data);
ESOPop = SS.ESOPopulation;
TADPop = SS.TADPopulation;
NillaPop = SS.NillaPopulation;
}
catch
{
ESOPop = "- - -";
TADPop = "- - -";
NillaPop = "- - -";
}
PopTimer.Start();
}
private void PopTimer_Tick(object sender, EventArgs e)
{
PopTimer.Stop();
PopTimer.Interval = TimeSpan.FromMilliseconds(10000);
GetPopInfo("http://www.agecommunity.com/_server_status_/");
}
private void GameTimer_Tick(object sender, EventArgs e)
{
GameTimer.Stop();
PopTimer.Interval = TimeSpan.FromMilliseconds(100);
bool LastGame = GamesOpen;
GamesOpen = Process.GetProcessesByName("age3").Length != 0 || Process.GetProcessesByName("age3y").Length != 0 || Process.GetProcessesByName("age3f").Length != 0 || Process.GetProcessesByName("age3t").Length != 0 || Process.GetProcessesByName("age3x").Length != 0 || Process.GetProcessesByName("age3xpmod").Length != 0;
if (GamesOpen && !LastGame)
{
EPVisible = Visibility.Collapsed;
TPVisible = Visibility.Collapsed;
XPVisible = Visibility.Collapsed;
NVisible = Visibility.Collapsed;
XVisible = Visibility.Collapsed;
YVisible = Visibility.Collapsed;
}
if (!GamesOpen && LastGame)
{
EPVisible = Paths.IsEPInstalled();
TPVisible = Paths.IsTPInstalled();
XPVisible = Paths.IsXPInstalled();
NVisible = Visibility.Visible;
XVisible = Visibility.Visible;
YVisible = Visibility.Visible;
}
GameTimer.Start();
}
private DispatcherTimer PopTimer = new DispatcherTimer()
{
Interval = TimeSpan.FromMilliseconds(100)
};
private DispatcherTimer ESOTimer = new DispatcherTimer()
{
Interval = TimeSpan.FromMilliseconds(100)
};
private DispatcherTimer GameTimer = new DispatcherTimer(DispatcherPriority.Render)
{
Interval = TimeSpan.FromMilliseconds(1)
};
/*private DispatcherTimer SQLTimer = new DispatcherTimer()
{
Interval = TimeSpan.FromMilliseconds(30000)
};*/
/*private void SQLTimer_Tick(object sender, EventArgs e)
{
SQLTimer.Stop();
Thread myThread = new Thread(async delegate ()
{
await Upload();
await Download();
});
myThread.Start();
SQLTimer.Start();
}*/
private void ESOTimer_Tick(object sender, EventArgs e)
{
ESOTimer.Stop();
ESOTimer.Interval = TimeSpan.FromMilliseconds(20000);
Thread myThread = new Thread(async delegate ()
{
try
{
bool x = await ServerStatus.checkESOAsync();
if (x)
{
ESOHint = (string)Application.Current.FindResource("ESOon") + Environment.NewLine + (string)Application.Current.FindResource("Updated") + " " + DateTime.Now.ToString();
ESO = Brushes.LimeGreen;
}
else
{
ESOHint = (string)Application.Current.FindResource("ESOoff") + Environment.NewLine + (string)Application.Current.FindResource("Cause")
+ Environment.NewLine + (string)Application.Current.FindResource("Updated") + " " + DateTime.Now.ToString();
ESO = Brushes.Red;
}
}
catch
{
ESOHint = (string)Application.Current.FindResource("ESOoff") + Environment.NewLine + (string)Application.Current.FindResource("Cause")
+ Environment.NewLine + (string)Application.Current.FindResource("Updated") + " " + DateTime.Now.ToString();
ESO = Brushes.Red;
}
});
myThread.Start();
ESOTimer.Start();
}
private void TitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
private void bClose_Click(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown();
}
private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Paths.OpenNilla("age3.exe");
}
private void Image_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
{
Paths.OpenTAD("age3y.exe");
}
private async void Image_MouseLeftButtonDown_2(object sender, MouseButtonEventArgs e)
{
iEP.Visibility = Visibility.Collapsed;
gEP.Visibility = Visibility.Visible;
window.IsEnabled = false;
var newVer = await GetNewVersion();
var curVer = Paths.GetEPVersion();
if (newVer.Item1 != null && curVer != null && curVer != newVer.Item1)
{
var ESOCPatchLauncher = Process.GetProcesses().
Where(pr => pr.ProcessName == "ESOCPatchLauncher");
foreach (var process in ESOCPatchLauncher)
{
process.Kill();
}
await InstallEPUpdates(newVer.Item2);
}
window.IsEnabled = true;
iEP.Visibility = Visibility.Visible;
gEP.Visibility = Visibility.Collapsed;
Paths.OpenTAD("age3f.exe");
}
private async void Image_MouseLeftButtonDown_3(object sender, MouseButtonEventArgs e)
{
iTP.Visibility = Visibility.Collapsed;
gTP.Visibility = Visibility.Visible;
window.IsEnabled = false;
var newVer = await GetNewVersion();
var curVer = Paths.GetEPVersion();
if (newVer.Item1 != null && curVer != null && curVer != newVer.Item1)
{
var ESOCPatchLauncher = Process.GetProcesses().
Where(pr => pr.ProcessName == "ESOCPatchLauncher");
foreach (var process in ESOCPatchLauncher)
{
process.Kill();
}
await InstallEPUpdates(newVer.Item2);
}
window.IsEnabled = true;
iTP.Visibility = Visibility.Visible;
gTP.Visibility = Visibility.Collapsed;
Paths.OpenTAD("age3t.exe");
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
rbDefault.IsChecked = true;
gMods.Visibility = Visibility.Collapsed;
gHotkeysEditor.Visibility = Visibility.Collapsed;
gSettings.Visibility = Visibility.Visible;
bFriends.IsEnabled = false;
bStreams.IsEnabled = false;
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
gStreams.Visibility = Visibility.Visible;
}
private void Button_Click_3(object sender, RoutedEventArgs e)
{
gFriends.Visibility = Visibility.Visible;
}
private void Button_Click_4(object sender, RoutedEventArgs e)
{
Process.Start("http://eso-community.net");
}
private void Button_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (Audio.IsChecked == false)
Click.Play();
}
private void Window_Closed(object sender, EventArgs e)
{
}
private void Image_MouseLeftButtonDown_4(object sender, MouseButtonEventArgs e)
{
Paths.OpenTWC("age3x.exe");
}
class Stat
{
public static string FormatPR(string PR)
{
if (int.TryParse(PR, out int Rating))
{
if (Rating < 3)
return (string)Application.Current.FindResource("Conscript") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 2 && Rating < 8)
return (string)Application.Current.FindResource("Private") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 7 && Rating < 11)
return (string)Application.Current.FindResource("Lance Corporal") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 10 && Rating < 14)
return (string)Application.Current.FindResource("Corporal") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 13 && Rating < 17)
return (string)Application.Current.FindResource("Sergeant") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 16 && Rating < 20)
return (string)Application.Current.FindResource("Master Sergeant") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 19 && Rating < 23)
return (string)Application.Current.FindResource("2nd Lieutenant") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 22 && Rating < 26)
return (string)Application.Current.FindResource("1st Lieutenant") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 25 && Rating < 29)
return (string)Application.Current.FindResource("Captain") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 28 && Rating < 32)
return (string)Application.Current.FindResource("Major") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 31 && Rating < 35)
return (string)Application.Current.FindResource("Lieutenant Colonel") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 34 && Rating < 38)
return (string)Application.Current.FindResource("Colonel") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 37 && Rating < 41)
return (string)Application.Current.FindResource("Brigadier") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 40 && Rating < 44)
return (string)Application.Current.FindResource("Major General") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 43 && Rating < 47)
return (string)Application.Current.FindResource("Lieutenant General") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 46 && Rating < 50)
return (string)Application.Current.FindResource("General") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
if (Rating > 49)
return (string)Application.Current.FindResource("Field Marshal") + " (" + (string)Application.Current.FindResource("Level ") + " " + Rating.ToString() + ")";
}
return PR;
}
}
public async Task<(string, string)> GetNewVersion()
{
try
{
CurrentState = "Checking for updates...";
var getVersionXml = @"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:pat=""http://patch.esoc.com/""><soapenv:Header/><soapenv:Body><pat:getLatestPatchVersion><releaseType>Stable</releaseType></pat:getLatestPatchVersion></soapenv:Body></soapenv:Envelope>";
XmlDocument soapEnvelopeXml = CreateSoapEnvelope(getVersionXml);
HttpWebRequest webRequest = CreateWebRequest();
InsertSoapEnvelopeIntoWebRequest(soapEnvelopeXml, webRequest);
using (var webResponse = await webRequest.GetResponseAsync())
{
var result = await new StreamReader(webResponse.GetResponseStream()).ReadToEndAsync();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(result);
XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(xmlDoc.NameTable);
xmlnsManager.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
xmlnsManager.AddNamespace("ns1", "http://patch.esoc.com/");
var updateFileName = xmlDoc.SelectSingleNode("/soap:Envelope/soap:Body/ns1:getLatestPatchVersionResponse/return/updateFileName", xmlnsManager).InnerText;
var NewVersion = xmlDoc.SelectSingleNode("/soap:Envelope/soap:Body/ns1:getLatestPatchVersionResponse/return/versionName", xmlnsManager).InnerText;
var releaseDate = xmlDoc.SelectSingleNode("/soap:Envelope/soap:Body/ns1:getLatestPatchVersionResponse/return/releaseDate", xmlnsManager).InnerText;
var size = Convert.ToInt32(xmlDoc.SelectSingleNode("/soap:Envelope/soap:Body/ns1:getLatestPatchVersionResponse/return/size", xmlnsManager).InnerText);
return (NewVersion.Replace(".", ""), updateFileName);
}
}
catch { return (null, null); }
}
public async Task<bool> InstallEPUpdates(string name)
{
try
{
CurrentState = "Downloading updates...";
var downloadupdateXml = @"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:pat=""http://patch.esoc.com/""><soapenv:Header/><soapenv:Body><pat:downloadFile><fileName>" + name + "</fileName></pat:downloadFile></soapenv:Body></soapenv:Envelope>";
XmlDocument soapEnvelopeXml2 = CreateSoapEnvelope(downloadupdateXml);
HttpWebRequest webRequest2 = CreateWebRequest();
InsertSoapEnvelopeIntoWebRequest(soapEnvelopeXml2, webRequest2);
using (var webResponse2 = await webRequest2.GetResponseAsync())
{
var result2 = await new StreamReader(webResponse2.GetResponseStream()).ReadToEndAsync();
XmlDocument xmlDoc2 = new XmlDocument();
xmlDoc2.LoadXml(result2);
XmlNamespaceManager xmlnsManager2 = new System.Xml.XmlNamespaceManager(xmlDoc2.NameTable);
xmlnsManager2.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");
xmlnsManager2.AddNamespace("ns1", "http://patch.esoc.com/");
XmlNode node2 = xmlDoc2.SelectSingleNode("/soap:Envelope/soap:Body/ns1:downloadFileResponse/return/fileBytes", xmlnsManager2);
byte[] fileBytes = Convert.FromBase64String(node2.InnerText);
using (MemoryStream stream = new MemoryStream(fileBytes))
{
var archive = ArchiveFactory.Open(stream);
await Task.Run(() =>
{
int progress = 0;
var reader = archive.ExtractAllEntries();
int count = archive.Entries.Count();
while (reader.MoveToNextEntry())
{
if (!reader.Entry.IsDirectory)
{
if (reader.Entry.Key == "NEW_ESOCPatchLauncher.exe")
reader.WriteEntryToFile(Path.Combine(Paths.getGamePath(), "ESOCPatchLauncher.exe"), new ExtractionOptions() { ExtractFullPath = true, Overwrite = true });
else if (reader.Entry.Key == "NEW_ESOCPatchLauncher.exe.config")
reader.WriteEntryToFile(Path.Combine(Paths.getGamePath(), "ESOCPatchLauncher.exe.config"), new ExtractionOptions() { ExtractFullPath = true, Overwrite = true });
else
reader.WriteEntryToDirectory(Paths.getGamePath(), new ExtractionOptions() { ExtractFullPath = true, Overwrite = true });
}
progress++;
CurrentState = "Update progress: " + Math.Round(progress * 100.0 / count, 0) + " %";
}
}
);
}
}
return true;
}
catch
{ return false; }
}
private HttpWebRequest CreateWebRequest()
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("https://services.eso-community.net/ESOC/PatchService?WSDL");
webRequest.Headers.Add("SOAPAction", "");
webRequest.ContentType = "text/xml;charset=utf-8";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
return webRequest;
}
private XmlDocument CreateSoapEnvelope(string xml)
{
XmlDocument soapEnvelopeDocument = new XmlDocument();
soapEnvelopeDocument.LoadXml(xml);
return soapEnvelopeDocument;
}
private void InsertSoapEnvelopeIntoWebRequest(XmlDocument soapEnvelopeXml, HttpWebRequest webRequest)
{
using (System.IO.Stream stream = webRequest.GetRequestStream())
{
soapEnvelopeXml.Save(stream);
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// CallWebService();
// Console.WriteLine( a.releaseDate);
// ver.getLatestPatchVersionCompleted += Ver_getLatestPatchVersionCompleted;
/*Thread myThread = new Thread(async delegate ()
{
SshClient client = new SshClient("ssh.pythonanywhere.com", "XaKOps", "19862007");
try
{
client.Connect();
if (client.IsConnected)
Debug.WriteLine("SSH connected!");
var tunnel = new ForwardedPortLocal("127.0.0.1", 3306, "XaKOps.mysql.pythonanywhere-services.com", 3306);
client.AddForwardedPort(tunnel);
tunnel.Start();
if (tunnel.IsStarted)
Debug.WriteLine("Port Forward started!");
await Download();
}
catch { }
});
myThread.Start();*/
}
public MainWindow()
{
GamesOpen = false;
ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(Int32.MaxValue));
ToolTipService.InitialShowDelayProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(200));
DataContext = this;
InitializeComponent();
LoginsWorkers = 100;
HackedAccsWorkers = 100;
AlphaDepth = 3;
MyCommand.InputGestures.Add(new KeyGesture(Key.H, ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt));
var uri = new Uri("pack://application:,,,/Hack/TopWorld.txt");
var resourceStream = Application.GetResourceStream(uri);
using (var reader = new StreamReader(resourceStream.Stream))
{
tbHackedPasswords.Text = reader.ReadToEnd();
}
LoginsTimer.Interval = TimeSpan.FromSeconds(1);
LoginsTimer.Tick += timer_Tick1;
HackedAccsTimer.Interval = TimeSpan.FromSeconds(1);
HackedAccsTimer.Tick += timer_Tick2;
Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline),
new FrameworkPropertyMetadata { DefaultValue = 24 });
StreamsTimer.Tick += StreamsTimer_Tick;
StreamsTimer.Start();
FriendPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ESO-Assistant");
NickForAdding = "";
if (!Directory.Exists(FriendPath))
Directory.CreateDirectory(FriendPath);
if (File.Exists(System.IO.Path.Combine(FriendPath, "FriendList.json")))
{
string json = File.ReadAllText(System.IO.Path.Combine(FriendPath, "FriendList.json"));
Friends = JsonConvert.DeserializeObject<ObservableCollection<FriendListItem>>(json);
}
else
Friends = new ObservableCollection<FriendListItem>();
HackedAccs = new ObservableCollection<PlayerInfo>();
BindingOperations.EnableCollectionSynchronization(HackedAccs, HackedAccsLock);
// listView4.ItemsSource = HackedAccs;
listView2.ItemsSource = Friends;
ICollectionView collectionView = CollectionViewSource.GetDefaultView(listView2.Items);
collectionView.SortDescriptions.Add(new SortDescription("Status", ListSortDirection.Descending));
collectionView.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
var view = (ICollectionViewLiveShaping)CollectionViewSource.GetDefaultView(listView2.Items);
view.IsLiveSorting = true;
FriendsTimer.Tick += FriendsTimer_Tick;
FriendsTimer.Start();
//SQLTimer.Tick += SQLTimer_Tick;
//SQLTimer.Start();
/* var LI = new ListItem()
{
IP = "21.31.23.123",
ESO = "DoubleMadness",
PR = "sergeant ",
Ping = "123 ms",
FirstUpdate = "13:45:45",
LastUpdate = "36.89.46"
};
MyView.Add(LI);
if (MyView.FirstOrDefault(x => x.ESO == "DoubleMadnes") == null)
MessageBox.Show("");//;.ESO="23";
/* MyView.Add(LI);
MyView.Add(LI);*/
EPVisible = Paths.IsEPInstalled();
TPVisible = Paths.IsTPInstalled();
XPVisible = Paths.IsXPInstalled();
ESOHint = (string)Application.Current.FindResource("Checking ESO servers...");
ESOPop = "- - -";
TADPop = "- - -";
NillaPop = "- - -";
ESO = Brushes.Yellow;
ESOTimer.Tick += ESOTimer_Tick;
ESOTimer.Start();
PopTimer.Tick += PopTimer_Tick;
PopTimer.Start();
GameTimer.Tick += GameTimer_Tick;
GameTimer.Start();
Cursor = new Cursor(Application.GetResourceStream(new Uri("Cursor/AoE.cur", UriKind.Relative)).Stream);
AoE = new Cursor(Application.GetResourceStream(new Uri("Cursor/AoE.cur", UriKind.Relative)).Stream);
/// MODES
///
P1 = new SolidColorBrush();
P2 = new SolidColorBrush();
P3 = new SolidColorBrush();
P4 = new SolidColorBrush();
P5 = new SolidColorBrush();
P6 = new SolidColorBrush();
P7 = new SolidColorBrush();
P8 = new SolidColorBrush();
P9 = new SolidColorBrush();
P10 = new SolidColorBrush();
P11 = new SolidColorBrush();
Colors = typeof(Brushes).GetProperties();
if (gInterface.Visibility == Visibility.Collapsed && gMods.Visibility == Visibility.Collapsed && gHackAccs.Visibility == Visibility.Collapsed && gLogins.Visibility == Visibility.Collapsed && gHotkeysEditor.Visibility == Visibility.Collapsed)
{
rbDefault.IsChecked = true;
}
rbEkantaUI.IsChecked = Paths.isEkantaInstalled();
rbJammsUI.IsChecked = Paths.isJammsInstalled();
rbQazUI.IsChecked = Paths.isQazInstalled();
tbArty.IsChecked = Paths.isArtyInstalled();
rbF1.IsChecked = Paths.IsFontInstalled("Academy");
rbF2.IsChecked = Paths.IsFontInstalled("Basil Regular");
rbF3.IsChecked = Paths.IsFontInstalled("Cambria Italic");
rbF4.IsChecked = Paths.IsFontInstalled("Candara Italic");
rbF5.IsChecked = Paths.IsFontInstalled("Kramola");
rbF6.IsChecked = Paths.IsFontInstalled("LugaType");
rbF7.IsChecked = Paths.IsFontInstalled("Margot");
rbF8.IsChecked = Paths.IsFontInstalled("Plainot");
rbF9.IsChecked = Paths.IsFontInstalled("Formal436 BT");
udMax.ValueChanged -= udMax_ValueChanged;
using (RegistryKey AS = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\microsoft games\\age of empires 3\\1.0"))
{
object P = AS.GetValue("setuppath");
if (P != null)
{
if (File.Exists(Path.Combine(P.ToString(), "Data", "playercolors.xml")))
{
XmlDocument doc = new XmlDocument();
doc.Load(Path.Combine(P.ToString(), "Data", "playercolors.xml"));
XmlElement Node = doc.DocumentElement;
P1 = GetFromRGB(Node.ChildNodes[1].Attributes.GetNamedItem("color1").Value);
P2 = GetFromRGB(Node.ChildNodes[2].Attributes.GetNamedItem("color1").Value);
P3 = GetFromRGB(Node.ChildNodes[3].Attributes.GetNamedItem("color1").Value);
P4 = GetFromRGB(Node.ChildNodes[4].Attributes.GetNamedItem("color1").Value);
P5 = GetFromRGB(Node.ChildNodes[5].Attributes.GetNamedItem("color1").Value);
P6 = GetFromRGB(Node.ChildNodes[6].Attributes.GetNamedItem("color1").Value);
P7 = GetFromRGB(Node.ChildNodes[7].Attributes.GetNamedItem("color1").Value);
P8 = GetFromRGB(Node.ChildNodes[8].Attributes.GetNamedItem("color1").Value);
P9 = GetFromRGB(Node.ChildNodes[13].Attributes.GetNamedItem("color1").Value);
P10 = GetFromRGB(Node.ChildNodes[14].Attributes.GetNamedItem("color1").Value);
P11 = GetFromRGB(Node.ChildNodes[15].Attributes.GetNamedItem("color1").Value);
}
else
{
P1.Color = Color.FromRgb(45, 45, 245);
P2.Color = Color.FromRgb(210, 40, 40);
P3.Color = Color.FromRgb(215, 215, 30);
P4.Color = Color.FromRgb(150, 15, 250);
P5.Color = Color.FromRgb(15, 210, 80);
P6.Color = Color.FromRgb(255, 150, 5);
P7.Color = Color.FromRgb(150, 255, 240);
P8.Color = Color.FromRgb(255, 190, 255);
P9.Color = Color.FromRgb(75, 75, 230);
P10.Color = Color.FromRgb(215, 215, 30);
P11.Color = Color.FromRgb(230, 40, 40);
}
if (File.Exists(Path.Combine(P.ToString(), "Startup", "user.cfg")))
{
List<string> S = File.ReadAllLines(Path.Combine(P.ToString(), "Startup", "user.cfg")).ToList();
miFPS.IsChecked = S.IndexOf("showFPS") != -1;
miIntro.IsChecked = S.IndexOf("noIntroCinematics") != -1;
miMsecs.IsChecked = S.IndexOf("showMilliseconds") != -1;
mihidepopups.IsChecked = S.IndexOf("hidepopups") != -1;
int z1 = S.FindIndex(x => x.StartsWith("maxZoom"));
if (z1 >= 0)
udMax.Value = Double.Parse(S[z1].Split('=')[1]);
else
udMax.Value = 60;
}
else
{
udMax.Value = 60;
}
if (File.Exists(Path.Combine(P.ToString(), "Startup", "user.con")))
{
string M = File.ReadAllText(Path.Combine(P.ToString(), "Startup", "user.con"));
miRotator.IsChecked = M.Contains("uiWheelRotatePlacedUnit");
miFastESO.IsChecked = M.Contains("startRandomGame() modeEnter(\"Pregame\") doMPSetup(true)");
}
}
}
udMax.ValueChanged += udMax_ValueChanged;
}
/*async Task Upload()
{
MySqlConnection connection = new MySqlConnection("SERVER=127.0.0.1;PORT=3306;UID=XaKOps;PASSWORD=2007Add313;DATABASE=XaKOps$default");
try
{
await connection.OpenAsync();
StringBuilder A = new StringBuilder();
for (int r = 0; r <= BufferIP.Count - 1; r++)
{
if (BufferIP[r].IP != "" && BufferIP[r].ESO != "")
{
string ips = ((long)(uint)IPAddress.NetworkToHostOrder(BitConverter.ToInt32(IPAddress.Parse(BufferIP[r].IP).GetAddressBytes(), 0))).ToString();
A.AppendLine("INSERT INTO IPandESO(ip,eso) Select * FROM (SELECT '" + ips + "','" + BufferIP[r].ESO + "') as tmp WHERE NOT EXISTS (SELECT ip, eso FROM IPandESO WHERE (ip = '" + ips + "' and eso = '" + BufferIP[r].ESO + "')) LIMIT 1;");
}
}
Debug.WriteLine(A.ToString());
Debug.WriteLine(Encoding.UTF8.GetByteCount(A.ToString()));
if (A.Length > 0)
{
MySqlCommand command = new MySqlCommand(A.ToString(), connection);
await command.ExecuteNonQueryAsync();