Advertisement
Guest User

Untitled

a guest
May 18th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.06 KB | None | 0 0
  1. using Microsoft.VisualBasic;
  2. using Microsoft.VisualBasic.CompilerServices;
  3. using Microsoft.VisualBasic.FileIO;
  4. using System;
  5. using System.ComponentModel;
  6. using System.Diagnostics;
  7. using System.Drawing;
  8. using System.IO;
  9. using System.Media;
  10. using System.Net;
  11. using System.Net.Sockets;
  12. using System.Runtime.CompilerServices;
  13. using System.Security.Cryptography;
  14. using System.Text;
  15. using System.Threading;
  16. using System.Windows.Forms;
  17. using WindowsApplication1.My;
  18. namespace WindowsApplication1
  19. {
  20. [DesignerGenerated]
  21. public class Form1 : Form
  22. {
  23. private IContainer components;
  24. [AccessedThroughProperty("Timer1")]
  25. private System.Windows.Forms.Timer _Timer1;
  26. [AccessedThroughProperty("NotifyIcon1")]
  27. private NotifyIcon _NotifyIcon1;
  28. [AccessedThroughProperty("Gioca")]
  29. private Button _Gioca;
  30. [AccessedThroughProperty("Opzioni")]
  31. private Button _Opzioni;
  32. [AccessedThroughProperty("Forum")]
  33. private Button _Forum;
  34. [AccessedThroughProperty("Esci")]
  35. private Button _Esci;
  36. [AccessedThroughProperty("BoxTesto")]
  37. private Label _BoxTesto;
  38. [AccessedThroughProperty("ProgressBarTotal")]
  39. private ProgressBar _ProgressBarTotal;
  40. [AccessedThroughProperty("ProgressBarCurrent")]
  41. private ProgressBar _ProgressBarCurrent;
  42. [AccessedThroughProperty("Label4")]
  43. private Label _Label4;
  44. [AccessedThroughProperty("Label3")]
  45. private Label _Label3;
  46. [AccessedThroughProperty("percentageParz")]
  47. private Label _percentageParz;
  48. [AccessedThroughProperty("percentageTot")]
  49. private Label _percentageTot;
  50. [AccessedThroughProperty("TextBox1")]
  51. private TextBox _TextBox1;
  52. [AccessedThroughProperty("Label2")]
  53. private Label _Label2;
  54. [AccessedThroughProperty("velocita")]
  55. private Label _velocita;
  56. [AccessedThroughProperty("rapportoByte")]
  57. private Label _rapportoByte;
  58. [AccessedThroughProperty("cmbBoxLingua")]
  59. private ComboBox _cmbBoxLingua;
  60. [AccessedThroughProperty("Label1")]
  61. private Label _Label1;
  62. private string ip_add;
  63. private string linkForum;
  64. private string linkPatchlist;
  65. private string linkPosFileDown;
  66. public string nomeLauncher;
  67. private string linkSitoWebVersioneUpdater;
  68. private string linkWebDownPatchUpdater;
  69. private string argumentLauncher;
  70. private string Virtual_log;
  71. private int Virtual_id;
  72. private int ProcesID;
  73. private Process myProcess;
  74. public string localFileMD5;
  75. public string localFileName;
  76. public string filePath;
  77. public string grafica;
  78. public string lingua;
  79. public bool controllore;
  80. [AccessedThroughProperty("download")]
  81. private WebClient _download;
  82. [AccessedThroughProperty("client")]
  83. private WebClient _client;
  84. public int ciclon;
  85. public string[] vettoreNomi;
  86. public string[] vettorePeso;
  87. public string[] vettoreCrc;
  88. public string[] vettoreMD5;
  89. public string[] vettoreLink;
  90. public short numRows;
  91. public short puntoDiArrivo;
  92. public int tP;
  93. public int bitPrec;
  94. private double vel;
  95. public SoundPlayer audio;
  96. public SoundPlayer audio2;
  97. public SoundPlayer avvia;
  98. public SoundPlayer dig;
  99. public bool avvia2;
  100. public bool esciaudio;
  101. public bool wirp;
  102. public bool voing;
  103. internal virtual System.Windows.Forms.Timer Timer1
  104. {
  105. get
  106. {
  107. return this._Timer1;
  108. }
  109. [MethodImpl(MethodImplOptions.Synchronized)]
  110. set
  111. {
  112. EventHandler value2 = new EventHandler(this.Timer1_Tick);
  113. if (this._Timer1 != null)
  114. {
  115. this._Timer1.Tick -= value2;
  116. }
  117. this._Timer1 = value;
  118. if (this._Timer1 != null)
  119. {
  120. this._Timer1.Tick += value2;
  121. }
  122. }
  123. }
  124. internal virtual NotifyIcon NotifyIcon1
  125. {
  126. get
  127. {
  128. return this._NotifyIcon1;
  129. }
  130. [MethodImpl(MethodImplOptions.Synchronized)]
  131. set
  132. {
  133. this._NotifyIcon1 = value;
  134. }
  135. }
  136. internal virtual Button Gioca
  137. {
  138. get
  139. {
  140. return this._Gioca;
  141. }
  142. [MethodImpl(MethodImplOptions.Synchronized)]
  143. set
  144. {
  145. EventHandler value2 = new EventHandler(this.Gioca_Click);
  146. EventHandler value3 = new EventHandler(this.Sopra_Gioca);
  147. if (this._Gioca != null)
  148. {
  149. this._Gioca.Click -= value2;
  150. this._Gioca.MouseHover -= value3;
  151. }
  152. this._Gioca = value;
  153. if (this._Gioca != null)
  154. {
  155. this._Gioca.Click += value2;
  156. this._Gioca.MouseHover += value3;
  157. }
  158. }
  159. }
  160. internal virtual Button Opzioni
  161. {
  162. get
  163. {
  164. return this._Opzioni;
  165. }
  166. [MethodImpl(MethodImplOptions.Synchronized)]
  167. set
  168. {
  169. EventHandler value2 = new EventHandler(this.Opzioni_Click);
  170. EventHandler value3 = new EventHandler(this.Sopra_opzioni);
  171. if (this._Opzioni != null)
  172. {
  173. this._Opzioni.Click -= value2;
  174. this._Opzioni.MouseHover -= value3;
  175. }
  176. this._Opzioni = value;
  177. if (this._Opzioni != null)
  178. {
  179. this._Opzioni.Click += value2;
  180. this._Opzioni.MouseHover += value3;
  181. }
  182. }
  183. }
  184. internal virtual Button Forum
  185. {
  186. get
  187. {
  188. return this._Forum;
  189. }
  190. [MethodImpl(MethodImplOptions.Synchronized)]
  191. set
  192. {
  193. EventHandler value2 = new EventHandler(this.Forum_Click);
  194. EventHandler value3 = new EventHandler(this.Sopra_forum);
  195. if (this._Forum != null)
  196. {
  197. this._Forum.Click -= value2;
  198. this._Forum.MouseHover -= value3;
  199. }
  200. this._Forum = value;
  201. if (this._Forum != null)
  202. {
  203. this._Forum.Click += value2;
  204. this._Forum.MouseHover += value3;
  205. }
  206. }
  207. }
  208. internal virtual Button Esci
  209. {
  210. get
  211. {
  212. return this._Esci;
  213. }
  214. [MethodImpl(MethodImplOptions.Synchronized)]
  215. set
  216. {
  217. EventHandler value2 = new EventHandler(this.Esci_Click);
  218. EventHandler value3 = new EventHandler(this.Sopra_Esci);
  219. if (this._Esci != null)
  220. {
  221. this._Esci.Click -= value2;
  222. this._Esci.MouseHover -= value3;
  223. }
  224. this._Esci = value;
  225. if (this._Esci != null)
  226. {
  227. this._Esci.Click += value2;
  228. this._Esci.MouseHover += value3;
  229. }
  230. }
  231. }
  232. internal virtual Label BoxTesto
  233. {
  234. get
  235. {
  236. return this._BoxTesto;
  237. }
  238. [MethodImpl(MethodImplOptions.Synchronized)]
  239. set
  240. {
  241. this._BoxTesto = value;
  242. }
  243. }
  244. internal virtual ProgressBar ProgressBarTotal
  245. {
  246. get
  247. {
  248. return this._ProgressBarTotal;
  249. }
  250. [MethodImpl(MethodImplOptions.Synchronized)]
  251. set
  252. {
  253. this._ProgressBarTotal = value;
  254. }
  255. }
  256. internal virtual ProgressBar ProgressBarCurrent
  257. {
  258. get
  259. {
  260. return this._ProgressBarCurrent;
  261. }
  262. [MethodImpl(MethodImplOptions.Synchronized)]
  263. set
  264. {
  265. this._ProgressBarCurrent = value;
  266. }
  267. }
  268. internal virtual Label Label4
  269. {
  270. get
  271. {
  272. return this._Label4;
  273. }
  274. [MethodImpl(MethodImplOptions.Synchronized)]
  275. set
  276. {
  277. this._Label4 = value;
  278. }
  279. }
  280. internal virtual Label Label3
  281. {
  282. get
  283. {
  284. return this._Label3;
  285. }
  286. [MethodImpl(MethodImplOptions.Synchronized)]
  287. set
  288. {
  289. this._Label3 = value;
  290. }
  291. }
  292. internal virtual Label percentageParz
  293. {
  294. get
  295. {
  296. return this._percentageParz;
  297. }
  298. [MethodImpl(MethodImplOptions.Synchronized)]
  299. set
  300. {
  301. this._percentageParz = value;
  302. }
  303. }
  304. internal virtual Label percentageTot
  305. {
  306. get
  307. {
  308. return this._percentageTot;
  309. }
  310. [MethodImpl(MethodImplOptions.Synchronized)]
  311. set
  312. {
  313. this._percentageTot = value;
  314. }
  315. }
  316. internal virtual TextBox TextBox1
  317. {
  318. get
  319. {
  320. return this._TextBox1;
  321. }
  322. [MethodImpl(MethodImplOptions.Synchronized)]
  323. set
  324. {
  325. this._TextBox1 = value;
  326. }
  327. }
  328. internal virtual Label Label2
  329. {
  330. get
  331. {
  332. return this._Label2;
  333. }
  334. [MethodImpl(MethodImplOptions.Synchronized)]
  335. set
  336. {
  337. this._Label2 = value;
  338. }
  339. }
  340. internal virtual Label velocita
  341. {
  342. get
  343. {
  344. return this._velocita;
  345. }
  346. [MethodImpl(MethodImplOptions.Synchronized)]
  347. set
  348. {
  349. this._velocita = value;
  350. }
  351. }
  352. internal virtual Label rapportoByte
  353. {
  354. get
  355. {
  356. return this._rapportoByte;
  357. }
  358. [MethodImpl(MethodImplOptions.Synchronized)]
  359. set
  360. {
  361. this._rapportoByte = value;
  362. }
  363. }
  364. internal virtual ComboBox cmbBoxLingua
  365. {
  366. get
  367. {
  368. return this._cmbBoxLingua;
  369. }
  370. [MethodImpl(MethodImplOptions.Synchronized)]
  371. set
  372. {
  373. EventHandler value2 = new EventHandler(this.cmbBoxLingua_SelectedIndexChanged);
  374. if (this._cmbBoxLingua != null)
  375. {
  376. this._cmbBoxLingua.SelectedIndexChanged -= value2;
  377. }
  378. this._cmbBoxLingua = value;
  379. if (this._cmbBoxLingua != null)
  380. {
  381. this._cmbBoxLingua.SelectedIndexChanged += value2;
  382. }
  383. }
  384. }
  385. internal virtual Label Label1
  386. {
  387. get
  388. {
  389. return this._Label1;
  390. }
  391. [MethodImpl(MethodImplOptions.Synchronized)]
  392. set
  393. {
  394. this._Label1 = value;
  395. }
  396. }
  397. public virtual WebClient download
  398. {
  399. get
  400. {
  401. return this._download;
  402. }
  403. [MethodImpl(MethodImplOptions.Synchronized)]
  404. set
  405. {
  406. this._download = value;
  407. }
  408. }
  409. public virtual WebClient client
  410. {
  411. get
  412. {
  413. return this._client;
  414. }
  415. [MethodImpl(MethodImplOptions.Synchronized)]
  416. set
  417. {
  418. AsyncCompletedEventHandler value2 = new AsyncCompletedEventHandler(this.client_DownloadFileCompleted);
  419. DownloadProgressChangedEventHandler value3 = new DownloadProgressChangedEventHandler(this.client_DownloadProgressChanged);
  420. if (this._client != null)
  421. {
  422. this._client.DownloadFileCompleted -= value2;
  423. this._client.DownloadProgressChanged -= value3;
  424. }
  425. this._client = value;
  426. if (this._client != null)
  427. {
  428. this._client.DownloadFileCompleted += value2;
  429. this._client.DownloadProgressChanged += value3;
  430. }
  431. }
  432. }
  433. public Form1()
  434. {
  435. base.Load += new EventHandler(this.Form1_Load);
  436. this.ip_add = "91.121.204.49";
  437. this.linkForum = "http://kingofworldmt2thereborn.com/bo/";
  438. this.linkPatchlist = "http://kingofworldmt2thereborn.com/patch/clientVersion1/patchlist";
  439. this.linkPosFileDown = "http://kingofworldmt2thereborn.com/patch/clientVersion1/patchfiles/";
  440. this.nomeLauncher = "metin2client.exe";
  441. this.linkSitoWebVersioneUpdater = "http://kingofworldmt2thereborn.com/patch/clientVersion1/patcherUpdater/version.txt";
  442. this.linkWebDownPatchUpdater = "http://kingofworldmt2thereborn.com/patch/clientVersion1/patcherUpdater/NuovoPatcherUpdater/patcherUpdater.exe";
  443. this.argumentLauncher = " --DFGGH435FGSD";
  444. this.Virtual_log = "aX2fww5dM";
  445. this.Virtual_id = 1;
  446. this.myProcess = new Process();
  447. this.grafica = "nulla";
  448. this.lingua = "Italiano";
  449. this.controllore = true;
  450. this.download = new WebClient();
  451. this.client = new WebClient();
  452. this.ciclon = 0;
  453. this.vettoreNomi = new string[51];
  454. this.vettorePeso = new string[51];
  455. this.vettoreCrc = new string[51];
  456. this.vettoreMD5 = new string[51];
  457. this.vettoreLink = new string[51];
  458. this.puntoDiArrivo = 0;
  459. this.tP = 0;
  460. this.bitPrec = 0;
  461. this.vel = 0.0;
  462. this.audio = new SoundPlayer();
  463. this.audio2 = new SoundPlayer();
  464. this.avvia = new SoundPlayer();
  465. this.dig = new SoundPlayer();
  466. this.avvia2 = true;
  467. this.esciaudio = true;
  468. this.wirp = true;
  469. this.voing = true;
  470. this.InitializeComponent();
  471. }
  472. [DebuggerNonUserCode]
  473. protected override void Dispose(bool disposing)
  474. {
  475. try
  476. {
  477. if (disposing && this.components != null)
  478. {
  479. this.components.Dispose();
  480. }
  481. }
  482. finally
  483. {
  484. base.Dispose(disposing);
  485. }
  486. }
  487. [DebuggerStepThrough]
  488. private void InitializeComponent()
  489. {
  490. this.components = new Container();
  491. ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(Form1));
  492. this.Timer1 = new System.Windows.Forms.Timer(this.components);
  493. this.NotifyIcon1 = new NotifyIcon(this.components);
  494. this.Gioca = new Button();
  495. this.Opzioni = new Button();
  496. this.Forum = new Button();
  497. this.Esci = new Button();
  498. this.BoxTesto = new Label();
  499. this.ProgressBarTotal = new ProgressBar();
  500. this.ProgressBarCurrent = new ProgressBar();
  501. this.Label4 = new Label();
  502. this.Label3 = new Label();
  503. this.percentageParz = new Label();
  504. this.percentageTot = new Label();
  505. this.TextBox1 = new TextBox();
  506. this.Label2 = new Label();
  507. this.velocita = new Label();
  508. this.rapportoByte = new Label();
  509. this.cmbBoxLingua = new ComboBox();
  510. this.Label1 = new Label();
  511. this.SuspendLayout();
  512. componentResourceManager.ApplyResources(this.NotifyIcon1, "NotifyIcon1");
  513. this.Gioca.BackColor = Color.Transparent;
  514. componentResourceManager.ApplyResources(this.Gioca, "Gioca");
  515. this.Gioca.FlatAppearance.BorderSize = 0;
  516. this.Gioca.ForeColor = Color.Transparent;
  517. this.Gioca.Name = "Gioca";
  518. this.Gioca.UseVisualStyleBackColor = false;
  519. this.Opzioni.BackColor = Color.Transparent;
  520. componentResourceManager.ApplyResources(this.Opzioni, "Opzioni");
  521. this.Opzioni.FlatAppearance.BorderSize = 0;
  522. this.Opzioni.ForeColor = Color.Transparent;
  523. this.Opzioni.Name = "Opzioni";
  524. this.Opzioni.UseVisualStyleBackColor = false;
  525. this.Forum.BackColor = Color.Transparent;
  526. componentResourceManager.ApplyResources(this.Forum, "Forum");
  527. this.Forum.FlatAppearance.BorderSize = 0;
  528. this.Forum.ForeColor = Color.Transparent;
  529. this.Forum.Name = "Forum";
  530. this.Forum.UseVisualStyleBackColor = false;
  531. this.Esci.BackColor = Color.Transparent;
  532. componentResourceManager.ApplyResources(this.Esci, "Esci");
  533. this.Esci.FlatAppearance.BorderSize = 0;
  534. this.Esci.ForeColor = Color.Transparent;
  535. this.Esci.Name = "Esci";
  536. this.Esci.UseVisualStyleBackColor = false;
  537. this.BoxTesto.BackColor = Color.Transparent;
  538. componentResourceManager.ApplyResources(this.BoxTesto, "BoxTesto");
  539. this.BoxTesto.ForeColor = Color.FromArgb(224, 224, 224);
  540. this.BoxTesto.Name = "BoxTesto";
  541. this.ProgressBarTotal.ForeColor = Color.FromArgb(0, 192, 192);
  542. componentResourceManager.ApplyResources(this.ProgressBarTotal, "ProgressBarTotal");
  543. this.ProgressBarTotal.Name = "ProgressBarTotal";
  544. this.ProgressBarCurrent.ForeColor = Color.FromArgb(0, 192, 192);
  545. componentResourceManager.ApplyResources(this.ProgressBarCurrent, "ProgressBarCurrent");
  546. this.ProgressBarCurrent.Name = "ProgressBarCurrent";
  547. componentResourceManager.ApplyResources(this.Label4, "Label4");
  548. this.Label4.BackColor = Color.Transparent;
  549. this.Label4.ForeColor = SystemColors.Highlight;
  550. this.Label4.Name = "Label4";
  551. componentResourceManager.ApplyResources(this.Label3, "Label3");
  552. this.Label3.BackColor = Color.Transparent;
  553. this.Label3.ForeColor = SystemColors.Highlight;
  554. this.Label3.Name = "Label3";
  555. componentResourceManager.ApplyResources(this.percentageParz, "percentageParz");
  556. this.percentageParz.BackColor = Color.Transparent;
  557. this.percentageParz.ForeColor = SystemColors.Highlight;
  558. this.percentageParz.Name = "percentageParz";
  559. componentResourceManager.ApplyResources(this.percentageTot, "percentageTot");
  560. this.percentageTot.BackColor = Color.Transparent;
  561. this.percentageTot.ForeColor = SystemColors.Highlight;
  562. this.percentageTot.Name = "percentageTot";
  563. this.TextBox1.BackColor = Color.Black;
  564. this.TextBox1.ForeColor = Color.FromArgb(0, 192, 192);
  565. componentResourceManager.ApplyResources(this.TextBox1, "TextBox1");
  566. this.TextBox1.Name = "TextBox1";
  567. componentResourceManager.ApplyResources(this.Label2, "Label2");
  568. this.Label2.BackColor = Color.Transparent;
  569. this.Label2.ForeColor = SystemColors.Highlight;
  570. this.Label2.Name = "Label2";
  571. componentResourceManager.ApplyResources(this.velocita, "velocita");
  572. this.velocita.BackColor = Color.Transparent;
  573. this.velocita.ForeColor = SystemColors.Highlight;
  574. this.velocita.Name = "velocita";
  575. componentResourceManager.ApplyResources(this.rapportoByte, "rapportoByte");
  576. this.rapportoByte.BackColor = Color.Transparent;
  577. this.rapportoByte.ForeColor = SystemColors.Highlight;
  578. this.rapportoByte.Name = "rapportoByte";
  579. this.cmbBoxLingua.DropDownStyle = ComboBoxStyle.DropDownList;
  580. this.cmbBoxLingua.FormattingEnabled = true;
  581. this.cmbBoxLingua.Items.AddRange(new object[]
  582. {
  583. componentResourceManager.GetString("cmbBoxLingua.Items"),
  584. componentResourceManager.GetString("cmbBoxLingua.Items1"),
  585. componentResourceManager.GetString("cmbBoxLingua.Items2"),
  586. componentResourceManager.GetString("cmbBoxLingua.Items3")
  587. });
  588. componentResourceManager.ApplyResources(this.cmbBoxLingua, "cmbBoxLingua");
  589. this.cmbBoxLingua.Name = "cmbBoxLingua";
  590. componentResourceManager.ApplyResources(this.Label1, "Label1");
  591. this.Label1.BackColor = Color.Transparent;
  592. this.Label1.ForeColor = Color.Orange;
  593. this.Label1.Name = "Label1";
  594. componentResourceManager.ApplyResources(this, "$this");
  595. this.AutoScaleMode = AutoScaleMode.Font;
  596. this.BackColor = SystemColors.ControlDarkDark;
  597. this.Controls.Add(this.Label1);
  598. this.Controls.Add(this.cmbBoxLingua);
  599. this.Controls.Add(this.rapportoByte);
  600. this.Controls.Add(this.velocita);
  601. this.Controls.Add(this.Label2);
  602. this.Controls.Add(this.TextBox1);
  603. this.Controls.Add(this.percentageTot);
  604. this.Controls.Add(this.percentageParz);
  605. this.Controls.Add(this.Label3);
  606. this.Controls.Add(this.Label4);
  607. this.Controls.Add(this.ProgressBarCurrent);
  608. this.Controls.Add(this.ProgressBarTotal);
  609. this.Controls.Add(this.BoxTesto);
  610. this.Controls.Add(this.Esci);
  611. this.Controls.Add(this.Forum);
  612. this.Controls.Add(this.Opzioni);
  613. this.Controls.Add(this.Gioca);
  614. this.DoubleBuffered = true;
  615. this.FormBorderStyle = FormBorderStyle.None;
  616. this.Name = "Form1";
  617. this.TransparencyKey = Color.FromArgb(255, 128, 0);
  618. this.ResumeLayout(false);
  619. this.PerformLayout();
  620. }
  621. private void Form1_Load(object sender, EventArgs e)
  622. {
  623. this.TransparencyKey = this.BackColor;
  624. this.FormBorderStyle = FormBorderStyle.None;
  625. this.Timer1.Interval = 1000;
  626. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "\\BGM\\Whirrp.wav"))
  627. {
  628. this.audio.SoundLocation = Microsoft.VisualBasic.FileSystem.CurDir() + "\\BGM\\Whirrp.wav";
  629. this.audio.Load();
  630. }
  631. else
  632. {
  633. this.wirp = false;
  634. }
  635. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "\\BGM\\jaeryun_fail.wav"))
  636. {
  637. this.avvia.SoundLocation = Microsoft.VisualBasic.FileSystem.CurDir() + "\\BGM\\jaeryun_fail.wav";
  638. this.avvia.Load();
  639. }
  640. else
  641. {
  642. this.avvia2 = false;
  643. }
  644. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "\\BGM\\dig.wav"))
  645. {
  646. this.dig.SoundLocation = Microsoft.VisualBasic.FileSystem.CurDir() + "\\BGM\\dig.wav";
  647. this.dig.Load();
  648. }
  649. else
  650. {
  651. this.esciaudio = false;
  652. }
  653. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "\\BGM\\swing_2.wav"))
  654. {
  655. this.audio2.SoundLocation = Microsoft.VisualBasic.FileSystem.CurDir() + "\\BGM\\swing_2.wav";
  656. this.audio2.Load();
  657. }
  658. else
  659. {
  660. this.voing = false;
  661. }
  662. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/KingOfWorld - TheReborn - Patch.exe"))
  663. {
  664. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/KingOfWorld - TheReborn - Patch.exe");
  665. }
  666. if (this.checkRun("patcherUpdater"))
  667. {
  668. Interaction.MsgBox("Il client non deve essere avviato\r\nprima dell'avvio del Autopatcher!", MsgBoxStyle.OkOnly, null);
  669. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patch.txt"))
  670. {
  671. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patch.txt");
  672. }
  673. if (MyProject.Computer.FileSystem.DirectoryExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp"))
  674. {
  675. MyProject.Computer.FileSystem.DeleteDirectory(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp", DeleteDirectoryOption.DeleteAllContents);
  676. }
  677. this.spegni();
  678. }
  679. else
  680. {
  681. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/versionNet.txt"))
  682. {
  683. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/versionNet.txt");
  684. }
  685. MyProject.Computer.Network.DownloadFile(this.linkSitoWebVersioneUpdater, Microsoft.VisualBasic.FileSystem.CurDir() + "\\versionNet.txt");
  686. string left;
  687. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "\\version.ast"))
  688. {
  689. left = File.ReadAllText(Microsoft.VisualBasic.FileSystem.CurDir() + "\\version.ast");
  690. }
  691. else
  692. {
  693. left = "0";
  694. }
  695. string right = File.ReadAllText(Microsoft.VisualBasic.FileSystem.CurDir() + "\\versionNet.txt");
  696. if (Operators.CompareString(left, right, false) == 0)
  697. {
  698. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "\\versionNet.txt"))
  699. {
  700. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "\\versionNet.txt");
  701. }
  702. }
  703. else if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/patcherUpdater.exe"))
  704. {
  705. string pathName = Microsoft.VisualBasic.FileSystem.CurDir() + "\\patcherUpdater.exe";
  706. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/version.ast"))
  707. {
  708. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/version.ast");
  709. }
  710. MyProject.Computer.FileSystem.RenameFile("versionNet.txt", "version.ast");
  711. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "\\versionNet.txt"))
  712. {
  713. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "\\versionNet.txt");
  714. }
  715. this.ProcesID = Interaction.Shell(pathName, AppWinStyle.NormalFocus, false, -1);
  716. this.spegni();
  717. }
  718. else
  719. {
  720. MyProject.Computer.Network.DownloadFile(this.linkWebDownPatchUpdater, "patcherUpdater.exe");
  721. string pathName2 = Microsoft.VisualBasic.FileSystem.CurDir() + "\\patcherUpdater.exe";
  722. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/version.ast"))
  723. {
  724. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/version.ast");
  725. }
  726. MyProject.Computer.FileSystem.RenameFile("versionNet.txt", "version.ast");
  727. Interaction.Shell(pathName2, AppWinStyle.NormalFocus, false, -1);
  728. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/versionNet.txt"))
  729. {
  730. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/versionNet.txt");
  731. }
  732. this.spegni();
  733. }
  734. this.letsGo();
  735. }
  736. }
  737. private static string SocketSendReceive(string server, int port)
  738. {
  739. Encoding aSCII = Encoding.ASCII;
  740. string s = "GET /AIS/patcher.php?id=1&key_svc=aX2fww5dM HTTP/1.1\r\nHost: " + server + "\r\nConnection: Close\r\n\r\n";
  741. byte[] bytes = aSCII.GetBytes(s);
  742. byte[] array = new byte[256];
  743. Socket socket = Form1.ConnectSocket(server, port);
  744. if (socket == null)
  745. {
  746. return "Connection failed";
  747. }
  748. socket.Send(bytes, bytes.Length, SocketFlags.None);
  749. string text = "";
  750. int num;
  751. do
  752. {
  753. num = socket.Receive(array, array.Length, SocketFlags.None);
  754. text += Encoding.ASCII.GetString(array, 0, num);
  755. }
  756. while (num > 0);
  757. return text;
  758. }
  759. private static Socket ConnectSocket(string server, int port)
  760. {
  761. Socket result = null;
  762. IPHostEntry hostEntry = Dns.GetHostEntry(server);
  763. IPAddress[] addressList = hostEntry.AddressList;
  764. checked
  765. {
  766. for (int i = 0; i < addressList.Length; i++)
  767. {
  768. IPAddress address = addressList[i];
  769. IPEndPoint iPEndPoint = new IPEndPoint(address, port);
  770. Socket socket = new Socket(iPEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
  771. socket.Connect(iPEndPoint);
  772. if (socket.Connected)
  773. {
  774. result = socket;
  775. break;
  776. }
  777. }
  778. return result;
  779. }
  780. }
  781. public void letsGo()
  782. {
  783. this.downloadPatchlist();
  784. this.getNumRows();
  785. this.carica();
  786. }
  787. public object downloadFileAtIndex(short indx)
  788. {
  789. this.filePath = this.vettoreNomi[(int)indx];
  790. this.TextBox1.AppendText("Controllo file " + this.vettoreNomi[(int)indx] + " in corso..\r\n");
  791. this.TextBox1.Update();
  792. checked
  793. {
  794. if (MyProject.Computer.FileSystem.FileExists(this.vettoreNomi[(int)indx]))
  795. {
  796. Console.WriteLine("file " + this.vettoreNomi[(int)indx] + " presente");
  797. if (Operators.CompareString(this.vettoreMD5[(int)indx], this.getMd5(this.vettoreNomi[(int)indx]), false) == 0)
  798. {
  799. Console.WriteLine("file " + this.vettoreNomi[(int)indx] + " Genuino.");
  800. if (this.puntoDiArrivo >= this.numRows)
  801. {
  802. Console.WriteLine("Fine Array!");
  803. ProgressBar progressBarTotal = this.ProgressBarTotal;
  804. progressBarTotal.Value++;
  805. this.percentageTot.Text = Conversions.ToString(Conversion.Int((double)(100 * this.ProgressBarTotal.Value) / (double)this.numRows)) + " %";
  806. this.percentageTot.Update();
  807. this.TextBox1.AppendText("Controllo file terminato.\r\n");
  808. this.TextBox1.Update();
  809. this.Gioca.Enabled = true;
  810. this.Gioca.Visible = true;
  811. this.Gioca.Update();
  812. }
  813. else
  814. {
  815. if (this.puntoDiArrivo != 0)
  816. {
  817. ProgressBar progressBarTotal = this.ProgressBarTotal;
  818. progressBarTotal.Value++;
  819. this.percentageTot.Text = Conversions.ToString(Conversion.Int((double)(100 * this.ProgressBarTotal.Value) / (double)this.numRows)) + " %";
  820. this.percentageTot.Update();
  821. }
  822. this.puntoDiArrivo += 1;
  823. this.downloadFileAtIndex(this.puntoDiArrivo);
  824. }
  825. }
  826. else
  827. {
  828. Console.WriteLine("File " + this.vettoreNomi[(int)indx] + "Corrotto");
  829. if (MyProject.Computer.FileSystem.FileExists(this.vettoreNomi[(int)indx]))
  830. {
  831. MyProject.Computer.FileSystem.DeleteFile(this.vettoreNomi[(int)indx]);
  832. this.NotifyIcon1.ShowBalloonTip(3000, "File Corrotto", "Il file " + this.vettoreNomi[(int)indx] + " risulta corrotto, verrà ora scaricato...", ToolTipIcon.Info);
  833. this.TextBox1.AppendText("Il file " + this.vettoreNomi[(int)indx] + " risulta corrotto, verrà ora scaricato...\r\n");
  834. this.TextBox1.Update();
  835. this.client = new WebClient();
  836. this.client.DownloadFileAsync(new Uri(this.linkPosFileDown + this.vettoreNomi[(int)indx]), Microsoft.VisualBasic.FileSystem.CurDir() + "/" + this.vettoreNomi[(int)indx]);
  837. this.NotifyIcon1.ShowBalloonTip(3000, "Downloading", "Scaricamento in corso..", ToolTipIcon.Info);
  838. Console.WriteLine("Scaricamento avviato di:" + this.vettoreNomi[(int)indx]);
  839. Console.WriteLine(Microsoft.VisualBasic.FileSystem.CurDir() + "/" + this.vettoreNomi[(int)indx]);
  840. if (!this.Timer1.Enabled)
  841. {
  842. this.Timer1.Start();
  843. }
  844. this.tP = (int)indx;
  845. }
  846. else
  847. {
  848. Interaction.MsgBox("Errore 03! File " + this.vettoreNomi[(int)indx] + " non trovato!", MsgBoxStyle.OkOnly, null);
  849. this.spegni();
  850. }
  851. }
  852. }
  853. else
  854. {
  855. Console.WriteLine("file " + this.vettoreNomi[(int)indx] + "NON presente");
  856. this.TextBox1.AppendText("File " + this.vettoreNomi[(int)indx] + " mancante, avviamento download...\r\n");
  857. this.TextBox1.Update();
  858. this.client = new WebClient();
  859. this.client.DownloadFileAsync(new Uri(this.linkPosFileDown + this.vettoreNomi[(int)indx]), Microsoft.VisualBasic.FileSystem.CurDir() + "/" + this.vettoreNomi[(int)indx]);
  860. if (!this.Timer1.Enabled)
  861. {
  862. this.Timer1.Start();
  863. }
  864. this.tP = (int)indx;
  865. }
  866. Console.WriteLine("punto di arrivo= " + Conversions.ToString((int)this.puntoDiArrivo));
  867. Console.WriteLine("indx= " + Conversions.ToString((int)indx));
  868. object result;
  869. return result;
  870. }
  871. }
  872. private void Gioca_Click(object sender, EventArgs e)
  873. {
  874. this.Gioca.Enabled = false;
  875. this.Esci.Enabled = false;
  876. if (this.avvia2)
  877. {
  878. this.avvia.Play();
  879. }
  880. this.TextBox1.AppendText(" Buon Game!");
  881. this.TextBox1.Update();
  882. Thread.Sleep(Conversions.ToInteger("1500"));
  883. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/" + this.nomeLauncher))
  884. {
  885. string pathName = string.Concat(new string[]
  886. {
  887. Microsoft.VisualBasic.FileSystem.CurDir(),
  888. "\\",
  889. this.nomeLauncher,
  890. " ",
  891. this.argumentLauncher
  892. });
  893. try
  894. {
  895. this.ProcesID = Interaction.Shell(pathName, AppWinStyle.NormalFocus, false, -1);
  896. }
  897. catch (Exception expr_C7)
  898. {
  899. ProjectData.SetProjectError(expr_C7);
  900. Console.WriteLine("Eccezione start Gestita.");
  901. Console.WriteLine("Avvio nuovo modulo");
  902. string pathName2 = this.nomeLauncher + " " + this.argumentLauncher;
  903. this.ProcesID = Interaction.Shell(pathName2, AppWinStyle.NormalFocus, false, -1);
  904. ProjectData.ClearProjectError();
  905. }
  906. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patch.txt"))
  907. {
  908. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patch.txt");
  909. }
  910. if (MyProject.Computer.FileSystem.DirectoryExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp"))
  911. {
  912. MyProject.Computer.FileSystem.DeleteDirectory(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp", DeleteDirectoryOption.DeleteAllContents);
  913. }
  914. this.spegni();
  915. }
  916. else
  917. {
  918. Interaction.MsgBox("- Errore 01 - Launcher mancante\rChiedi aiuto nel forum!", MsgBoxStyle.OkOnly, null);
  919. this.spegni();
  920. }
  921. }
  922. private void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
  923. {
  924. if (MyProject.Computer.FileSystem.FileExists(this.vettoreNomi[(int)this.puntoDiArrivo]))
  925. {
  926. this.NotifyIcon1.ShowBalloonTip(3000, "Scaricato", this.vettoreNomi[(int)this.puntoDiArrivo] + " scaricato con successo!", ToolTipIcon.Info);
  927. this.TextBox1.AppendText(this.vettoreNomi[(int)this.puntoDiArrivo] + " scaricato con successo!\r\n");
  928. this.TextBox1.Update();
  929. }
  930. else
  931. {
  932. this.NotifyIcon1.ShowBalloonTip(3000, "Errore", "Problma nel download di " + this.vettoreNomi[(int)this.puntoDiArrivo] + "!", ToolTipIcon.Error);
  933. Interaction.MsgBox("Problema nel download di " + this.vettoreNomi[(int)this.puntoDiArrivo] + "!\r\n", MsgBoxStyle.OkOnly, null);
  934. this.spegni();
  935. }
  936. checked
  937. {
  938. if (this.puntoDiArrivo >= this.numRows)
  939. {
  940. ProgressBar progressBarTotal = this.ProgressBarTotal;
  941. progressBarTotal.Value++;
  942. this.percentageTot.Text = Conversions.ToString(Conversion.Int((double)(100 * this.ProgressBarTotal.Value) / (double)this.numRows)) + " %";
  943. this.percentageTot.Update();
  944. this.TextBox1.AppendText("Controllo file terminato.\r\n");
  945. this.TextBox1.Update();
  946. this.Gioca.Enabled = true;
  947. this.Gioca.Visible = true;
  948. this.Gioca.Update();
  949. }
  950. else
  951. {
  952. if (this.puntoDiArrivo != 0)
  953. {
  954. ProgressBar progressBarTotal = this.ProgressBarTotal;
  955. progressBarTotal.Value++;
  956. this.percentageTot.Text = Conversions.ToString(Conversion.Int((double)(100 * this.ProgressBarTotal.Value) / (double)this.numRows)) + " %";
  957. this.percentageTot.Update();
  958. }
  959. this.puntoDiArrivo += 1;
  960. this.downloadFileAtIndex(this.puntoDiArrivo);
  961. }
  962. }
  963. }
  964. private object carica()
  965. {
  966. checked
  967. {
  968. this.vettoreNomi = new string[(int)(this.numRows + 1)];
  969. this.vettorePeso = new string[(int)(this.numRows + 1)];
  970. this.vettoreCrc = new string[(int)(this.numRows + 1)];
  971. this.vettoreMD5 = new string[(int)(this.numRows + 1)];
  972. this.vettoreLink = new string[(int)(this.numRows + 1)];
  973. if (MyProject.Computer.FileSystem.FileExists("testTemp/patchlist"))
  974. {
  975. StreamReader streamReader = MyProject.Computer.FileSystem.OpenTextFileReader("testTemp/patchlist");
  976. string text = streamReader.ReadLine();
  977. int arg_9F_0 = 0;
  978. int num = (int)this.numRows;
  979. for (int i = arg_9F_0; i <= num; i++)
  980. {
  981. Console.WriteLine("Ciclo n° " + Conversions.ToString(i));
  982. string[] array = text.Split(new char[]
  983. {
  984. '|'
  985. });
  986. this.vettoreNomi[i] = array[0];
  987. this.vettorePeso[i] = array[1];
  988. this.vettoreCrc[i] = array[2];
  989. this.vettoreMD5[i] = array[3];
  990. this.vettoreLink[i] = array[4];
  991. text = streamReader.ReadLine();
  992. }
  993. streamReader.Close();
  994. this.ProgressBarTotal.Minimum = 0;
  995. this.ProgressBarTotal.Maximum = (int)this.numRows;
  996. this.ProgressBarCurrent.Minimum = 0;
  997. this.ProgressBarCurrent.Maximum = 100;
  998. if (this.puntoDiArrivo >= 0)
  999. {
  1000. this.downloadFileAtIndex(this.puntoDiArrivo);
  1001. }
  1002. else
  1003. {
  1004. Interaction.MsgBox("Errore 02!", MsgBoxStyle.OkOnly, null);
  1005. this.spegni();
  1006. }
  1007. }
  1008. else
  1009. {
  1010. this.spegni();
  1011. }
  1012. object result;
  1013. return result;
  1014. }
  1015. }
  1016. public void getNumRows()
  1017. {
  1018. checked
  1019. {
  1020. if (MyProject.Computer.FileSystem.FileExists("testTemp/patchlist"))
  1021. {
  1022. StreamReader streamReader = MyProject.Computer.FileSystem.OpenTextFileReader("testTemp/patchlist");
  1023. string left = streamReader.ReadLine();
  1024. this.numRows = 0;
  1025. while (Operators.CompareString(left, "", false) != 0)
  1026. {
  1027. this.numRows += 1;
  1028. left = streamReader.ReadLine();
  1029. }
  1030. streamReader.Close();
  1031. this.numRows -= 1;
  1032. }
  1033. else
  1034. {
  1035. Interaction.MsgBox("Errore 06 - consulta il forum!", MsgBoxStyle.Critical, null);
  1036. this.spegni();
  1037. Application.Exit();
  1038. }
  1039. }
  1040. }
  1041. public void downloadPatchlist()
  1042. {
  1043. try
  1044. {
  1045. MyProject.Computer.FileSystem.CreateDirectory(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp");
  1046. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patchlist"))
  1047. {
  1048. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patchlist");
  1049. MyProject.Computer.Network.DownloadFile(this.linkPatchlist, Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patchlist");
  1050. }
  1051. else if (MyProject.Computer.Network.Ping("127.0.1", 1000))
  1052. {
  1053. MyProject.Computer.Network.DownloadFile(this.linkPatchlist, Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patchlist");
  1054. }
  1055. else
  1056. {
  1057. Interaction.MsgBox("Rilevata assenza di connessione internet!", MsgBoxStyle.OkOnly, null);
  1058. this.spegni();
  1059. }
  1060. this.TextBox1.AppendText("\r\nPatchlist raggiunta con successo!\r\n");
  1061. this.TextBox1.Update();
  1062. }
  1063. catch (Exception expr_F3)
  1064. {
  1065. ProjectData.SetProjectError(expr_F3);
  1066. Interaction.MsgBox("Problema raggiungimento Patchlist! \\n Sarai comunque abilitato a loggare.", MsgBoxStyle.Exclamation, null);
  1067. this.Gioca.Enabled = true;
  1068. this.Gioca.Visible = true;
  1069. this.Gioca.Update();
  1070. ProjectData.ClearProjectError();
  1071. }
  1072. }
  1073. private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
  1074. {
  1075. this.ProgressBarCurrent.Value = e.ProgressPercentage;
  1076. this.percentageParz.Text = Conversions.ToString(e.ProgressPercentage) + " %";
  1077. this.percentageParz.Update();
  1078. this.rapportoByte.Visible = true;
  1079. if (Conversions.ToDouble(this.vettorePeso[this.tP]) > 1000.0)
  1080. {
  1081. if (e.ProgressPercentage >= 98)
  1082. {
  1083. this.rapportoByte.Text = string.Concat(new string[]
  1084. {
  1085. "( ",
  1086. Conversions.ToString(Conversion.Int(Conversions.ToDouble(this.vettorePeso[this.tP]) / 1000.0)),
  1087. " KB di ",
  1088. Conversions.ToString(Conversion.Int(Conversions.ToDouble(this.vettorePeso[this.tP]) / 1000.0)),
  1089. " )"
  1090. });
  1091. this.rapportoByte.Update();
  1092. }
  1093. else
  1094. {
  1095. this.rapportoByte.Text = string.Concat(new string[]
  1096. {
  1097. "( ",
  1098. Conversions.ToString(Conversion.Int((double)e.BytesReceived / 1000.0)),
  1099. " KB di ",
  1100. Conversions.ToString(Conversion.Int(Conversions.ToDouble(this.vettorePeso[this.tP]) / 1000.0)),
  1101. " )"
  1102. });
  1103. this.rapportoByte.Update();
  1104. }
  1105. }
  1106. else if (e.ProgressPercentage >= 98)
  1107. {
  1108. this.rapportoByte.Text = string.Concat(new string[]
  1109. {
  1110. "( ",
  1111. this.vettorePeso[this.tP],
  1112. " B di ",
  1113. this.vettorePeso[this.tP],
  1114. " )"
  1115. });
  1116. this.rapportoByte.Update();
  1117. }
  1118. else
  1119. {
  1120. this.rapportoByte.Text = string.Concat(new string[]
  1121. {
  1122. "( ",
  1123. Conversions.ToString(e.BytesReceived),
  1124. " B di ",
  1125. this.vettorePeso[this.tP],
  1126. " )"
  1127. });
  1128. this.rapportoByte.Update();
  1129. }
  1130. if (e.ProgressPercentage > 99)
  1131. {
  1132. this.velocita.Text = "0 KBytes/s";
  1133. this.velocita.Update();
  1134. Console.WriteLine("download completato");
  1135. this.Timer1.Stop();
  1136. this.vel = 0.0;
  1137. this.bitPrec = 0;
  1138. }
  1139. checked
  1140. {
  1141. this.vel = (double)(e.BytesReceived - unchecked((long)this.bitPrec));
  1142. Console.WriteLine(string.Concat(new string[]
  1143. {
  1144. "Vel(",
  1145. Conversions.ToString(this.vel),
  1146. ")= ",
  1147. Conversions.ToString(e.BytesReceived),
  1148. " - ",
  1149. Conversions.ToString(this.bitPrec)
  1150. }));
  1151. this.bitPrec = (int)e.BytesReceived;
  1152. Console.WriteLine("bitPrec after assign= " + Conversions.ToString(this.bitPrec));
  1153. }
  1154. }
  1155. private string ByteArrayToString(byte[] arrInput)
  1156. {
  1157. checked
  1158. {
  1159. StringBuilder stringBuilder = new StringBuilder(arrInput.Length * 2);
  1160. int arg_12_0 = 0;
  1161. int num = arrInput.Length - 1;
  1162. for (int i = arg_12_0; i <= num; i++)
  1163. {
  1164. stringBuilder.Append(arrInput[i].ToString("X2"));
  1165. }
  1166. return stringBuilder.ToString().ToLower();
  1167. }
  1168. }
  1169. public string getMd5(string filePath)
  1170. {
  1171. string result;
  1172. if (MyProject.Computer.FileSystem.FileExists(filePath))
  1173. {
  1174. using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
  1175. {
  1176. using (MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider())
  1177. {
  1178. byte[] arrInput = mD5CryptoServiceProvider.ComputeHash(fileStream);
  1179. result = this.ByteArrayToString(arrInput);
  1180. }
  1181. }
  1182. }
  1183. return result;
  1184. }
  1185. private void Sopra_Gioca(object sender, EventArgs e)
  1186. {
  1187. this.Gioca.Focus();
  1188. if (this.voing)
  1189. {
  1190. this.audio2.Play();
  1191. }
  1192. }
  1193. private void Sopra_Esci(object sender, EventArgs e)
  1194. {
  1195. this.Esci.Focus();
  1196. if (this.voing)
  1197. {
  1198. this.audio2.Play();
  1199. }
  1200. }
  1201. private void Sopra_opzioni(object sender, EventArgs e)
  1202. {
  1203. this.Opzioni.Focus();
  1204. if (this.voing)
  1205. {
  1206. this.audio2.Play();
  1207. }
  1208. }
  1209. private void Sopra_forum(object sender, EventArgs e)
  1210. {
  1211. this.Forum.Focus();
  1212. if (this.voing)
  1213. {
  1214. this.audio2.Play();
  1215. }
  1216. }
  1217. private void Esci_Click(object sender, EventArgs e)
  1218. {
  1219. this.Esci.Enabled = false;
  1220. this.Gioca.Enabled = false;
  1221. if (this.esciaudio)
  1222. {
  1223. this.dig.Play();
  1224. Thread.Sleep(Conversions.ToInteger("600"));
  1225. }
  1226. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patch.txt"))
  1227. {
  1228. MyProject.Computer.FileSystem.DeleteFile(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp/patch.txt");
  1229. }
  1230. if (MyProject.Computer.FileSystem.DirectoryExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp"))
  1231. {
  1232. MyProject.Computer.FileSystem.DeleteDirectory(Microsoft.VisualBasic.FileSystem.CurDir() + "/testTemp", DeleteDirectoryOption.DeleteAllContents);
  1233. }
  1234. this.spegni();
  1235. }
  1236. private void Opzioni_Click(object sender, EventArgs e)
  1237. {
  1238. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "\\config.exe"))
  1239. {
  1240. try
  1241. {
  1242. string pathName = Microsoft.VisualBasic.FileSystem.CurDir() + "\\config.exe";
  1243. Interaction.Shell(pathName, AppWinStyle.NormalFocus, false, -1);
  1244. return;
  1245. }
  1246. catch (Exception expr_3C)
  1247. {
  1248. ProjectData.SetProjectError(expr_3C);
  1249. this.ProcesID = Interaction.Shell("config.exe", AppWinStyle.NormalFocus, false, -1);
  1250. ProjectData.ClearProjectError();
  1251. return;
  1252. }
  1253. }
  1254. Interaction.MsgBox("File di impostazioni non trovato!", MsgBoxStyle.OkOnly, null);
  1255. }
  1256. public bool checkRun(string name)
  1257. {
  1258. Process[] processes = Process.GetProcesses();
  1259. checked
  1260. {
  1261. for (int i = 0; i < processes.Length; i++)
  1262. {
  1263. Process process = processes[i];
  1264. if (process.ProcessName.StartsWith(name))
  1265. {
  1266. return true;
  1267. }
  1268. }
  1269. return false;
  1270. }
  1271. }
  1272. public void spegni()
  1273. {
  1274. this.NotifyIcon1.Dispose();
  1275. this.Close();
  1276. }
  1277. private void Forum_Click(object sender, EventArgs e)
  1278. {
  1279. Process.Start(this.linkForum);
  1280. }
  1281. private void Timer1_Tick(object sender, EventArgs e)
  1282. {
  1283. this.velocita.Text = Conversions.ToString(Conversion.Int(this.vel)) + " Kb/s";
  1284. this.velocita.Update();
  1285. }
  1286. private void cmbBoxLingua_SelectedIndexChanged(object sender, EventArgs e)
  1287. {
  1288. if (MyProject.Computer.FileSystem.FileExists(Microsoft.VisualBasic.FileSystem.CurDir() + "/locale.cfg"))
  1289. {
  1290. string text = Microsoft.VisualBasic.FileSystem.CurDir() + "/locale.cfg";
  1291. string[] array = File.ReadAllLines(Microsoft.VisualBasic.FileSystem.CurDir() + "/locale.cfg");
  1292. if (Operators.CompareString(this.cmbBoxLingua.Text, "Italiano", false) == 0)
  1293. {
  1294. array[0] = "10000 1252 it";
  1295. }
  1296. else if (Operators.CompareString(this.cmbBoxLingua.Text, "English", false) == 0)
  1297. {
  1298. array[0] = "10000 1252 en";
  1299. }
  1300. else if (Operators.CompareString(this.cmbBoxLingua.Text, "Deuch", false) == 0)
  1301. {
  1302. Interaction.MsgBox("Funzione in costruzione", MsgBoxStyle.OkOnly, null);
  1303. }
  1304. else if (Operators.CompareString(this.cmbBoxLingua.Text, "Român", false) == 0)
  1305. {
  1306. Interaction.MsgBox("Funzione in costruzione", MsgBoxStyle.OkOnly, null);
  1307. }
  1308. File.WriteAllLines(Microsoft.VisualBasic.FileSystem.CurDir() + "/locale.cfg", array);
  1309. }
  1310. else
  1311. {
  1312. MessageBox.Show("Errore durante la lettura del file: 'locale.cfg' !");
  1313. }
  1314. }
  1315. }
  1316. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement