Advertisement
xMagrao

Untitled

Dec 28th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.32 KB | None | 0 0
  1. using Ionic.Zip;
  2. using Microsoft.VisualBasic.Devices;
  3. using Microsoft.VisualBasic.FileIO;
  4. using p2qlx;
  5. using Point_Blank_Launcher.Properties;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Diagnostics;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.Net;
  13. using System.Runtime.InteropServices;
  14. using System.Security.Cryptography;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. using System.Xml;
  18. //All credits to Coyote per decompile and fix errors in source
  19. //Do not remove credits...
  20. namespace Point_Blank_Launcher
  21. {
  22. public class Launcher : Form
  23. {
  24. public WebClient web = new WebClient();
  25.  
  26. public WebClient launchUpdate = new WebClient();
  27.  
  28. public WebClient gameUpdate = new WebClient();
  29.  
  30. public int lastVersion = -1;
  31.  
  32. public bool loadingVerif;
  33.  
  34. public Computer myComputer = new Computer();
  35.  
  36. public Point_Blank_Launcher.Connection conc;
  37.  
  38. private Point NewPoint;
  39.  
  40. private IContainer components;
  41.  
  42. private Label label1;
  43.  
  44. private Label label2;
  45.  
  46. private Label label3;
  47.  
  48. private Label label4;
  49.  
  50. private PictureBox pictureBox1;
  51.  
  52. private Button Verif;
  53.  
  54. private Button Button_Update;
  55.  
  56. private Button Start;
  57. //All credits to Coyote per decompile and fix errors in source
  58. //Do not remove credits...
  59. private PictureBox TotalBar;
  60.  
  61. private PictureBox ArchiveBar;
  62.  
  63. private Label fileName;
  64. //All credits to Coyote per decompile and fix errors in source
  65. //Do not remove credits...
  66. private Timer timer6;
  67.  
  68. private PictureBox pictureBox4;
  69. private WebBrowser webBrowser1;
  70. private ListBox listBox1;
  71.  
  72. public Launcher(Point_Blank_Launcher.Connection c)
  73. {
  74. this.conc = c;
  75. this.InitializeComponent();
  76. this.web.DownloadFileCompleted += new AsyncCompletedEventHandler(this.web_DownloadCompleted);
  77. this.gameUpdate.DownloadFileCompleted += new AsyncCompletedEventHandler(this.gameUpdate_DownloadCompleted);
  78. this.launchUpdate.DownloadFileCompleted += new AsyncCompletedEventHandler(this.launchUpdate_DownloadCompleted);
  79. this.gameUpdate.DownloadProgressChanged += new DownloadProgressChangedEventHandler(this.gameUpdate_DownloadProgressChanged);
  80. }
  81.  
  82. public void Bar1SetProgress(long received, long maximum, bool progress)
  83. {
  84. this.ArchiveBar.Width = (int)(received * (long)417 / maximum);
  85. }
  86.  
  87. public void Bar2SetProgress(ulong received, ulong maximum)
  88. {
  89. this.TotalBar.Width = (int)(received * (long)417 / maximum);
  90. }
  91.  
  92. private void Button_Update_Click(object sender, EventArgs e)
  93. {
  94. this.Button_Update.Enabled = false;
  95. this.fileName.Visible = true;
  96. int.Parse(this.web.DownloadString("http://blazepb.ml/versions/last_client_version.txt"));
  97. int num = int.Parse(this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0"));
  98. int num1 = num + 1;
  99. this.myComputer.FileSystem.CreateDirectory(string.Concat(Application.StartupPath, "\\_DownloadPatchFiles"));
  100. try
  101. {
  102. WebClient webClient = this.gameUpdate;
  103. Uri uri = new Uri(string.Concat("http://blazepb.ml/versions/updates/Update_", num1, ".zip"));
  104. object[] startupPath = new object[] { Application.StartupPath, "\\_DownloadPatchFiles\\Update_", num1, ".zip" };
  105. webClient.DownloadFileAsync(uri, string.Concat(startupPath));
  106. }
  107. catch
  108. {
  109. this.teste("[ERROR] Código 3*2");
  110. MessageBox.Show("error");
  111. }
  112. this.Verif.Enabled = false;
  113. this.Verif.BackgroundImage = Resources.checkd_button;
  114. this.Start.BackgroundImage = Resources.startd_button;
  115. this.Verif.Refresh();
  116. this.label1.Text = Config.downl_file;
  117. this.label1.Refresh();
  118. this.fileName.Text = string.Concat("Update_", num1, ".zip");
  119. this.fileName.Refresh();
  120. }
  121. //All credits to Coyote per decompile and fix errors in source
  122. //Do not remove credits...
  123. private void Button_Update_MouseLeave(object sender, EventArgs e)
  124. {
  125. this.Button_Update.BackgroundImage = Resources.upda_button;
  126. }
  127.  
  128. private void Button_Update_MouseMove(object sender, MouseEventArgs e)
  129. {
  130. this.Button_Update.BackgroundImage = Resources.upda2_button;
  131. }
  132.  
  133. private void button1_Click(object sender, EventArgs e)
  134. {
  135. MessageBox.Show("vsf");
  136. }
  137.  
  138. public static string check(string v, string[] tst)
  139. {
  140. string str;
  141. int num = 0;
  142. while (true)
  143. {
  144. if (num >= (int)tst.Length)
  145. {
  146. str = "";
  147. break;
  148. }
  149. else if (!(tst[num].Substring(Application.StartupPath.Length) == v))
  150. {
  151. num++;
  152. }
  153. else
  154. {
  155. str = tst[num];
  156. break;
  157. }
  158. }
  159. return str;
  160. }
  161. //All credits to Coyote per decompile and fix errors in source
  162. //Do not remove credits...
  163. protected override void Dispose(bool disposing)
  164. {
  165. if ((!disposing ? false : this.components != null))
  166. {
  167. this.components.Dispose();
  168. }
  169. base.Dispose(disposing);
  170. }
  171.  
  172. private void EscreverArquivo(string arquivo, string secao, string chave, string valor)
  173. {
  174. Launcher.WritePrivateProfileString(secao, chave, valor, arquivo);
  175. }
  176.  
  177. private void form_Closing(object sender, FormClosedEventArgs e)
  178. {
  179. this.conc.Close();
  180. }
  181.  
  182. private void gameUpdate_DownloadCompleted(object sender, AsyncCompletedEventArgs e)
  183. {
  184. if (e.Error == null)
  185. {
  186. int num = int.Parse(this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0"));
  187. int num1 = num + 1;
  188. this.label1.Text = Config.excract_file;
  189. this.ArchiveBar.Width = 0;
  190. string startupPath = Application.StartupPath;
  191. object[] actualVersion = new object[] { Application.StartupPath, "\\_DownloadPatchFiles\\Update_", num1, ".zip" };
  192. this.unzip(startupPath, string.Concat(actualVersion));
  193. this.Start.Enabled = false;
  194. this.Button_Update.SendToBack();
  195. this.Button_Update.Enabled = false;
  196. this.timer6.Start();
  197. Label label = this.label4;
  198. actualVersion = new object[] { Config.actual_version, num, "/", this.lastVersion };
  199. label.Text = string.Concat(actualVersion);
  200. Directory.Delete(string.Concat(Application.StartupPath, "\\_DownloadPatchFiles"), true);
  201. this.ArchiveBar.Width = 417;
  202. }
  203. }
  204. //All credits to Coyote per decompile and fix errors in source
  205. //Do not remove credits...
  206. private void gameUpdate_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
  207. {
  208. this.Bar1SetProgress(e.BytesReceived, e.TotalBytesToReceive, false);
  209. }
  210.  
  211. public byte[] GeraChecksum(string filePath)
  212. {
  213. Stream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
  214. byte[] bytes = (new UnicodeEncoding()).GetBytes("Macoratti");
  215. byte[] numArray = (new HMACSHA1(bytes, true)).ComputeHash(fileStream);
  216. fileStream.Close();
  217. return numArray;
  218. }
  219.  
  220. protected string getMD5HashFromFile(string fileName)
  221. {
  222. string str = "";
  223. MD5 mD5 = MD5.Create();
  224. try
  225. {
  226. FileStream fileStream = File.OpenRead(fileName);
  227. try
  228. {
  229. str = BitConverter.ToString(mD5.ComputeHash(fileStream)).Replace("-", string.Empty);
  230. fileStream.Close();
  231. }
  232. finally
  233. {
  234. if (fileStream != null)
  235. {
  236. ((IDisposable)fileStream).Dispose();
  237. }
  238. }
  239. }
  240. finally
  241. {
  242. if (mD5 != null)
  243. {
  244. ((IDisposable)mD5).Dispose();
  245. }
  246. }
  247. return str;
  248. }
  249. //All credits to Coyote per decompile and fix errors in source
  250. //Do not remove credits...
  251. [DllImport("Kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false, SetLastError = true)]
  252. public static extern bool GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int size, string lpFileName);
  253.  
  254. private void InitializeComponent()
  255. {
  256. this.components = new System.ComponentModel.Container();
  257. this.label1 = new System.Windows.Forms.Label();
  258. this.label2 = new System.Windows.Forms.Label();
  259. this.label3 = new System.Windows.Forms.Label();
  260. this.label4 = new System.Windows.Forms.Label();
  261. this.pictureBox1 = new System.Windows.Forms.PictureBox();
  262. this.Start = new System.Windows.Forms.Button();
  263. this.Verif = new System.Windows.Forms.Button();
  264. this.Button_Update = new System.Windows.Forms.Button();
  265. this.TotalBar = new System.Windows.Forms.PictureBox();
  266. this.ArchiveBar = new System.Windows.Forms.PictureBox();
  267. this.fileName = new System.Windows.Forms.Label();
  268. this.timer6 = new System.Windows.Forms.Timer(this.components);
  269. this.pictureBox4 = new System.Windows.Forms.PictureBox();
  270. this.listBox1 = new System.Windows.Forms.ListBox();
  271. this.webBrowser1 = new System.Windows.Forms.WebBrowser();
  272. ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
  273. ((System.ComponentModel.ISupportInitialize)(this.TotalBar)).BeginInit();
  274. ((System.ComponentModel.ISupportInitialize)(this.ArchiveBar)).BeginInit();
  275. ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
  276. this.SuspendLayout();
  277. //
  278. // label1
  279. //
  280. this.label1.AutoSize = true;
  281. this.label1.BackColor = System.Drawing.Color.Transparent;
  282. this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
  283. this.label1.ForeColor = System.Drawing.Color.Black;
  284. this.label1.Location = new System.Drawing.Point(53, 369);
  285. this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
  286. this.label1.Name = "label1";
  287. this.label1.Size = new System.Drawing.Size(145, 13);
  288. this.label1.TabIndex = 0;
  289. this.label1.Text = "Texto padrão não carregado.";
  290. //
  291. // label2
  292. //
  293. this.label2.AutoSize = true;
  294. this.label2.BackColor = System.Drawing.Color.Transparent;
  295. this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
  296. this.label2.ForeColor = System.Drawing.Color.Black;
  297. this.label2.Location = new System.Drawing.Point(19, 292);
  298. this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
  299. this.label2.Name = "label2";
  300. this.label2.Size = new System.Drawing.Size(23, 13);
  301. this.label2.TabIndex = 1;
  302. this.label2.Text = "File";
  303. //
  304. // label3
  305. //
  306. this.label3.AutoSize = true;
  307. this.label3.BackColor = System.Drawing.Color.Transparent;
  308. this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
  309. this.label3.ForeColor = System.Drawing.Color.Black;
  310. this.label3.Location = new System.Drawing.Point(19, 309);
  311. this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
  312. this.label3.Name = "label3";
  313. this.label3.Size = new System.Drawing.Size(31, 13);
  314. this.label3.TabIndex = 2;
  315. this.label3.Text = "Total";
  316. this.label3.Click += new System.EventHandler(this.label3_Click);
  317. //
  318. // label4
  319. //
  320. this.label4.AutoSize = true;
  321. this.label4.BackColor = System.Drawing.Color.Transparent;
  322. this.label4.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  323. this.label4.ForeColor = System.Drawing.Color.Transparent;
  324. this.label4.Location = new System.Drawing.Point(53, 69);
  325. this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
  326. this.label4.Name = "label4";
  327. this.label4.Size = new System.Drawing.Size(81, 14);
  328. this.label4.TabIndex = 3;
  329. this.label4.Text = "Carregando...";
  330. //
  331. // pictureBox1
  332. //
  333. this.pictureBox1.BackColor = System.Drawing.Color.White;
  334. this.pictureBox1.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.Close1;
  335. this.pictureBox1.Location = new System.Drawing.Point(465, 6);
  336. this.pictureBox1.Margin = new System.Windows.Forms.Padding(2);
  337. this.pictureBox1.Name = "pictureBox1";
  338. this.pictureBox1.Size = new System.Drawing.Size(21, 20);
  339. this.pictureBox1.TabIndex = 4;
  340. this.pictureBox1.TabStop = false;
  341. this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
  342. this.pictureBox1.MouseEnter += new System.EventHandler(this.pictureBox1_MouseMove);
  343. this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
  344. //
  345. // Start
  346. //
  347. this.Start.BackColor = System.Drawing.Color.Transparent;
  348. this.Start.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.start_button;
  349. this.Start.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
  350. this.Start.FlatAppearance.BorderSize = 0;
  351. this.Start.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  352. this.Start.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
  353. this.Start.ForeColor = System.Drawing.Color.Transparent;
  354. this.Start.Location = new System.Drawing.Point(398, 339);
  355. this.Start.Margin = new System.Windows.Forms.Padding(2);
  356. this.Start.Name = "Start";
  357. this.Start.Size = new System.Drawing.Size(84, 43);
  358. this.Start.TabIndex = 7;
  359. this.Start.UseVisualStyleBackColor = true;
  360. this.Start.Click += new System.EventHandler(this.Start_Click);
  361. this.Start.MouseLeave += new System.EventHandler(this.Start_MouseLeave);
  362. this.Start.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Start_MouseMove);
  363. //
  364. // Verif
  365. //
  366. this.Verif.BackColor = System.Drawing.Color.Transparent;
  367. this.Verif.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.check_button;
  368. this.Verif.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
  369. this.Verif.FlatAppearance.BorderSize = 0;
  370. this.Verif.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  371. this.Verif.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
  372. this.Verif.ForeColor = System.Drawing.Color.Transparent;
  373. this.Verif.Location = new System.Drawing.Point(337, 338);
  374. this.Verif.Margin = new System.Windows.Forms.Padding(2);
  375. this.Verif.Name = "Verif";
  376. this.Verif.Size = new System.Drawing.Size(53, 43);
  377. this.Verif.TabIndex = 8;
  378. this.Verif.UseVisualStyleBackColor = false;
  379. this.Verif.Click += new System.EventHandler(this.Verif_Click);
  380. this.Verif.MouseLeave += new System.EventHandler(this.Verif_MouseLeave);
  381. this.Verif.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Verif_MouseMove);
  382. //
  383. // Button_Update
  384. //
  385. this.Button_Update.BackColor = System.Drawing.Color.Transparent;
  386. this.Button_Update.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.upda2_button;
  387. this.Button_Update.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
  388. this.Button_Update.FlatAppearance.BorderSize = 0;
  389. this.Button_Update.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  390. this.Button_Update.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
  391. this.Button_Update.ForeColor = System.Drawing.Color.Transparent;
  392. this.Button_Update.Location = new System.Drawing.Point(398, 339);
  393. this.Button_Update.Margin = new System.Windows.Forms.Padding(2);
  394. this.Button_Update.Name = "Button_Update";
  395. this.Button_Update.Size = new System.Drawing.Size(84, 43);
  396. this.Button_Update.TabIndex = 9;
  397. this.Button_Update.UseVisualStyleBackColor = true;
  398. this.Button_Update.Click += new System.EventHandler(this.Button_Update_Click);
  399. this.Button_Update.MouseLeave += new System.EventHandler(this.Button_Update_MouseLeave);
  400. this.Button_Update.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Button_Update_MouseMove);
  401. //
  402. // TotalBar
  403. //
  404. this.TotalBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(198)))), ((int)(((byte)(86)))), ((int)(((byte)(12)))));
  405. this.TotalBar.Location = new System.Drawing.Point(62, 312);
  406. this.TotalBar.Name = "TotalBar";
  407. this.TotalBar.Size = new System.Drawing.Size(417, 9);
  408. this.TotalBar.TabIndex = 10;
  409. this.TotalBar.TabStop = false;
  410. this.TotalBar.Click += new System.EventHandler(this.TotalBar_Click);
  411. //
  412. // ArchiveBar
  413. //
  414. this.ArchiveBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(125)))), ((int)(((byte)(0)))));
  415. this.ArchiveBar.Location = new System.Drawing.Point(62, 295);
  416. this.ArchiveBar.Name = "ArchiveBar";
  417. this.ArchiveBar.Size = new System.Drawing.Size(417, 9);
  418. this.ArchiveBar.TabIndex = 11;
  419. this.ArchiveBar.TabStop = false;
  420. this.ArchiveBar.Click += new System.EventHandler(this.ArchiveBar_Click);
  421. //
  422. // fileName
  423. //
  424. this.fileName.AutoSize = true;
  425. this.fileName.BackColor = System.Drawing.Color.Transparent;
  426. this.fileName.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
  427. this.fileName.ForeColor = System.Drawing.Color.Black;
  428. this.fileName.Location = new System.Drawing.Point(19, 334);
  429. this.fileName.Name = "fileName";
  430. this.fileName.Size = new System.Drawing.Size(59, 13);
  431. this.fileName.TabIndex = 14;
  432. this.fileName.Text = "Arquivo.zip";
  433. this.fileName.Visible = false;
  434. this.fileName.Click += new System.EventHandler(this.fileName_Click);
  435. //
  436. // timer6
  437. //
  438. this.timer6.Tick += new System.EventHandler(this.timer6_Tick);
  439. //
  440. // pictureBox4
  441. //
  442. this.pictureBox4.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.Minimize1;
  443. this.pictureBox4.Location = new System.Drawing.Point(438, 6);
  444. this.pictureBox4.Name = "pictureBox4";
  445. this.pictureBox4.Size = new System.Drawing.Size(21, 20);
  446. this.pictureBox4.TabIndex = 15;
  447. this.pictureBox4.TabStop = false;
  448. this.pictureBox4.Click += new System.EventHandler(this.pictureBox4_Click);
  449. this.pictureBox4.MouseLeave += new System.EventHandler(this.pictureBox4_MouseLeave);
  450. this.pictureBox4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox4_MouseMove);
  451. //
  452. // listBox1
  453. //
  454. this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  455. this.listBox1.FormattingEnabled = true;
  456. this.listBox1.Location = new System.Drawing.Point(398, 90);
  457. this.listBox1.Name = "listBox1";
  458. this.listBox1.Size = new System.Drawing.Size(17, 4);
  459. this.listBox1.TabIndex = 16;
  460. this.listBox1.Visible = false;
  461. //
  462. // webBrowser1
  463. //
  464. this.webBrowser1.IsWebBrowserContextMenuEnabled = false;
  465. this.webBrowser1.Location = new System.Drawing.Point(13, 41);
  466. this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
  467. this.webBrowser1.Name = "webBrowser1";
  468. this.webBrowser1.ScrollBarsEnabled = false;
  469. this.webBrowser1.Size = new System.Drawing.Size(473, 235);
  470. this.webBrowser1.TabIndex = 17;
  471. this.webBrowser1.Url = new System.Uri("http://blazepb.ml/webs/2/index.html", System.UriKind.Absolute);
  472. this.webBrowser1.WebBrowserShortcutsEnabled = false;
  473. this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
  474. //
  475. // Launcher
  476. //
  477. this.AutoScaleDimensions = new System.Drawing.SizeF(4F, 7F);
  478. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  479. this.BackColor = System.Drawing.SystemColors.WindowFrame;
  480. this.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.background;
  481. this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
  482. this.ClientSize = new System.Drawing.Size(500, 400);
  483. this.Controls.Add(this.webBrowser1);
  484. this.Controls.Add(this.listBox1);
  485. this.Controls.Add(this.pictureBox4);
  486. this.Controls.Add(this.fileName);
  487. this.Controls.Add(this.TotalBar);
  488. this.Controls.Add(this.ArchiveBar);
  489. this.Controls.Add(this.Verif);
  490. this.Controls.Add(this.pictureBox1);
  491. this.Controls.Add(this.label4);
  492. this.Controls.Add(this.label2);
  493. this.Controls.Add(this.label3);
  494. this.Controls.Add(this.Start);
  495. this.Controls.Add(this.Button_Update);
  496. this.Controls.Add(this.label1);
  497. this.DoubleBuffered = true;
  498. this.Font = new System.Drawing.Font("Microsoft Sans Serif", 5F);
  499. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
  500. this.Icon = global::Point_Blank_Launcher.Properties.Resources.Icon;
  501. this.Margin = new System.Windows.Forms.Padding(2);
  502. this.MaximizeBox = false;
  503. this.MinimizeBox = false;
  504. this.Name = "Launcher";
  505. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  506. this.Text = "PBLauncher";
  507. this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.form_Closing);
  508. this.Load += new System.EventHandler(this.Launcher_Load);
  509. this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.launcher_MouseDown);
  510. this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.launcher_MouseMove);
  511. ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
  512. ((System.ComponentModel.ISupportInitialize)(this.TotalBar)).EndInit();
  513. ((System.ComponentModel.ISupportInitialize)(this.ArchiveBar)).EndInit();
  514. ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
  515. this.ResumeLayout(false);
  516. this.PerformLayout();
  517.  
  518. }
  519.  
  520. private void Launcher_Load(object sender, EventArgs e)
  521. {
  522. Settings variable = new Settings();
  523. if (variable.language == "Português (Brasil)")
  524. {
  525. Config.LanguageBRAZILIAN();
  526. }
  527. else if (variable.language == "English")
  528. {
  529. Config.LanguageENGLISH();
  530. }
  531. this.teste("Conexão efetuada com sucesso.");
  532. this.label1.Text = Config.status;
  533. this.label2.Text = Config.file;
  534. this.label3.Text = Config.total;
  535. base.WindowState = FormWindowState.Normal;
  536. base.Visible = true;
  537. this.label4.Visible = true;
  538. this.lastVersion = int.Parse(this.web.DownloadString("http://blazepb.ml/versions/last_client_version.txt"));
  539. this.label4.Text = string.Concat(Config.actual_version, this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0"), "/", this.lastVersion.ToString());
  540. this.Start.Enabled = false;
  541. this.web.DownloadString("http://blazepb.ml/versions/last_launcher_version.txt");
  542. string str = "";
  543. byte[] numArray = this.GeraChecksum(string.Concat(Application.StartupPath, "\\PBLauncher.exe"));
  544. if (this.myComputer.FileSystem.DirectoryExists(string.Concat(Application.StartupPath, "\\_LauncherPatchFiles")))
  545. {
  546. this.myComputer.FileSystem.DeleteDirectory(string.Concat(Application.StartupPath, "\\_LauncherPatchFiles"), DeleteDirectoryOption.DeleteAllContents);
  547. }
  548. for (int i = 0; i < (int)numArray.Length; i++)
  549. {
  550. str = string.Concat(str, string.Format("{0:X2}", numArray[i]));
  551. }
  552. if (!(this.lastVersion.ToString() == this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0")))
  553. {
  554. this.ArchiveBar.Width = 0;
  555. this.TotalBar.Width = 0;
  556. this.label1.Text = Config.update;
  557. this.Verif.Enabled = false;
  558. this.Verif.BackgroundImage = Resources.checkd_button;
  559. this.Start.Visible = false;
  560. }
  561. else
  562. {
  563. this.label1.Text = Config.game_is_ok;
  564. this.Start.Enabled = true;
  565. this.Verif.Enabled = true;
  566. this.xmlLoad();
  567. }
  568. }
  569.  
  570. private void launcher_MouseDown(object sender, MouseEventArgs e)
  571. {
  572. if (Control.MouseButtons == System.Windows.Forms.MouseButtons.Left)
  573. {
  574. int left = base.Left;
  575. Point mousePosition = Control.MousePosition;
  576. this.NewPoint.X = left - mousePosition.X;
  577. int top = base.Top;
  578. Point point = Control.MousePosition;
  579. this.NewPoint.Y = top - point.Y;
  580. }
  581. }
  582.  
  583. private void launcher_MouseMove(object sender, MouseEventArgs e)
  584. {
  585. if (Control.MouseButtons == System.Windows.Forms.MouseButtons.Left)
  586. {
  587. int x = this.NewPoint.X;
  588. Point mousePosition = Control.MousePosition;
  589. base.Left = x + mousePosition.X;
  590. int y = this.NewPoint.Y;
  591. mousePosition = Control.MousePosition;
  592. base.Top = y + mousePosition.Y;
  593. }
  594. }
  595.  
  596. private void launchUpdate_DownloadCompleted(object sender, AsyncCompletedEventArgs e)
  597. {
  598. if (e.Error == null)
  599. {
  600. MessageBox.Show("v");
  601. }
  602. }
  603.  
  604. private string LerArquivo(string arquivo, string secao, string chave, string valorPadrao)
  605. {
  606. StringBuilder stringBuilder = new StringBuilder(500);
  607. Launcher.GetPrivateProfileString(secao, chave, valorPadrao, stringBuilder, 500, arquivo);
  608. return stringBuilder.ToString();
  609. }
  610.  
  611. public static SortedList<string, string> loadXML(string path)
  612. {
  613. SortedList<string, string> strs = new SortedList<string, string>();
  614. XmlDocument xmlDocument = new XmlDocument();
  615. FileStream fileStream = new FileStream(path, FileMode.Open);
  616. if (fileStream.Length != (long)0)
  617. {
  618. try
  619. {
  620. xmlDocument.Load(fileStream);
  621. for (XmlNode i = xmlDocument.FirstChild; i != null; i = i.NextSibling)
  622. {
  623. if ("list".Equals(i.Name))
  624. {
  625. for (XmlNode j = i.FirstChild; j != null; j = j.NextSibling)
  626. {
  627. if ("f".Equals(j.Name))
  628. {
  629. XmlNamedNodeMap attributes = j.Attributes;
  630. string value = attributes.GetNamedItem("n").Value;
  631. if (!strs.ContainsKey(value))
  632. {
  633. strs.Add(value, attributes.GetNamedItem("m").Value);
  634. }
  635. }
  636. }
  637. }
  638. }
  639. }
  640. catch
  641. {
  642. }
  643. }
  644. fileStream.Dispose();
  645. fileStream.Close();
  646. return strs;
  647. }
  648.  
  649. private List<XMLModel> parse(string path)
  650. {
  651. List<XMLModel> xMLModels = new List<XMLModel>();
  652. XmlDocument xmlDocument = new XmlDocument();
  653. FileStream fileStream = new FileStream(path, FileMode.Open);
  654. if (fileStream.Length == (long)0)
  655. {
  656. this.teste("[ERROR] Código 4*1");
  657. }
  658. else
  659. {
  660. try
  661. {
  662. xmlDocument.Load(fileStream);
  663. for (XmlNode i = xmlDocument.FirstChild; i != null; i = i.NextSibling)
  664. {
  665. if ("list".Equals(i.Name))
  666. {
  667. for (XmlNode j = i.FirstChild; j != null; j = j.NextSibling)
  668. {
  669. if ("file".Equals(j.Name))
  670. {
  671. XmlNamedNodeMap attributes = j.Attributes;
  672. xMLModels.Add(new XMLModel(attributes.GetNamedItem("local").Value));
  673. }
  674. }
  675. }
  676. }
  677. }
  678. catch (XmlException xmlException)
  679. {
  680. MessageBox.Show(xmlException.ToString());
  681. }
  682. }
  683. fileStream.Dispose();
  684. fileStream.Close();
  685. return xMLModels;
  686. }
  687.  
  688. private void pictureBox1_Click(object sender, EventArgs e)
  689. {
  690. if (MessageBox.Show(Config.leave, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
  691. {
  692. base.Close();
  693. }
  694. }
  695.  
  696. private void pictureBox1_MouseLeave(object sender, EventArgs e)
  697. {
  698. this.pictureBox1.Image = Resources.exit_button;
  699. }
  700.  
  701. private void pictureBox1_MouseMove(object sender, EventArgs e)
  702. {
  703. this.pictureBox1.Image = Resources.exit3_button1;
  704. }
  705.  
  706. private void pictureBox4_Click(object sender, EventArgs e)
  707. {
  708. base.WindowState = FormWindowState.Minimized;
  709. }
  710.  
  711. private void pictureBox4_MouseLeave(object sender, EventArgs e)
  712. {
  713. this.pictureBox4.BackgroundImage = Resources.minim_button;
  714. }
  715.  
  716. private void pictureBox4_MouseMove(object sender, MouseEventArgs e)
  717. {
  718. this.pictureBox4.BackgroundImage = Resources.minim2_button;
  719. }
  720.  
  721. private void Start_Click(object sender, EventArgs e)
  722. {
  723. try
  724. {
  725. Process.Start(string.Concat(Application.StartupPath, "\\PointBlank.exe"), Config.password);
  726. }
  727. catch
  728. {
  729. this.teste("[ERROR] Código 5*0");
  730. }
  731. base.Close();
  732. }
  733.  
  734. private void Start_MouseLeave(object sender, EventArgs e)
  735. {
  736. this.Start.BackgroundImage = Resources.start_button;
  737. }
  738.  
  739. private void Start_MouseMove(object sender, MouseEventArgs e)
  740. {
  741. this.Start.BackgroundImage = Resources.start2_button;
  742. }
  743.  
  744. private void teste(string texto)
  745. {
  746. string str = string.Concat(Application.StartupPath, "\\PBLauncher.log");
  747. DateTime now = DateTime.Now;
  748. StreamWriter streamWriter = new StreamWriter(str, true);
  749. string[] strArrays = new string[] { "[", now.ToString("yyyy/MM/dd"), " | ", now.ToString("HH:mm"), "] ", texto };
  750. streamWriter.WriteLine(string.Concat(strArrays));
  751. streamWriter.Flush();
  752. streamWriter.Close();
  753. }
  754.  
  755. private void timer6_Tick(object sender, EventArgs e)
  756. {
  757. this.lastVersion = int.Parse(this.web.DownloadString("http://blazepb.ml/versions/last_client_version.txt"));
  758. Label label = this.label4;
  759. object[] actualVersion = new object[] { Config.actual_version, this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0"), "/", this.lastVersion };
  760. label.Text = string.Concat(actualVersion);
  761. if (this.lastVersion != int.Parse(this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "launcher", "version_launcher", "0")))
  762. {
  763. int num = int.Parse(this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0")) + 1;
  764. this.myComputer.FileSystem.CreateDirectory(string.Concat(Application.StartupPath, "\\_DownloadPatchFiles"));
  765. try
  766. {
  767. WebClient webClient = this.gameUpdate;
  768. Uri uri = new Uri(string.Concat("http://blazepb.ml/versions/updates/Update_", num, ".zip"));
  769. actualVersion = new object[] { Application.StartupPath, "\\_DownloadPatchFiles\\Update_", num, ".zip" };
  770. webClient.DownloadFileAsync(uri, string.Concat(actualVersion));
  771. }
  772. catch (Exception exception)
  773. {
  774. MessageBox.Show(exception.ToString());
  775. }//All credits to Coyote per decompile and fix errors in source
  776. //Do not remove credits...
  777. this.Verif.Enabled = false;
  778. this.Verif.BackgroundImage = Resources.checkd_button;
  779. this.Bar2SetProgress((ulong)0, (ulong)100);
  780. this.label1.Text = Config.downl_file;
  781. this.fileName.Text = string.Concat("Update_", num, ".zip");
  782. this.timer6.Stop();
  783. }
  784. else
  785. {
  786. this.label1.Text = Config.game_is_ok;
  787. this.Start.Enabled = true;
  788. this.Verif.Enabled = true;
  789. this.Start.BackgroundImage = Resources.start_button;
  790. this.Verif.BackgroundImage = Resources.check_button;
  791. this.Button_Update.Enabled = false;
  792. this.Start.Visible = true;
  793. this.Button_Update.Visible = false;
  794. this.fileName.Visible = false;
  795. this.xmlLoad();
  796. this.timer6.Stop();
  797. }//All credits to Coyote per decompile and fix errors in source
  798. //Do not remove credits...
  799. }
  800.  
  801. public void unzip(string TargetDir, string ZipToUnpack)
  802. {
  803. try
  804. {
  805. ZipFile zipFile = ZipFile.Read(ZipToUnpack);
  806. try//All credits to Coyote per decompile and fix errors in source
  807. //Do not remove credits...
  808. {
  809. zipFile.ExtractProgress += new EventHandler<ExtractProgressEventArgs>(this.unzip_ExtractProgressChanged);
  810. int num = 0;
  811. int num1 = 0;
  812. foreach (ZipEntry zipEntry in zipFile)
  813. {
  814. if (!zipEntry.IsDirectory)
  815. {
  816. num1++;
  817. }
  818. }
  819. this.fileName.Visible = true;
  820. foreach (ZipEntry zipEntry1 in zipFile)
  821. {
  822. string fileName = zipEntry1.FileName;
  823. if (fileName.Contains("/"))
  824. {
  825. int num2 = fileName.LastIndexOf("/");
  826. fileName = fileName.Substring(num2 + 1);
  827. }
  828. if (!zipEntry1.IsDirectory)
  829. {
  830. this.fileName.Text = fileName;
  831. base.Update();
  832. this.Refresh();
  833. int num3 = num + 1;
  834. num = num3;
  835. this.Bar2SetProgress((ulong)num3, (ulong)num1);
  836. }//All credits to Coyote per decompile and fix errors in source
  837. //Do not remove credits...
  838. zipEntry1.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently);
  839. }
  840. }
  841. finally
  842. {
  843. if (zipFile != null)
  844. {
  845. zipFile.Dispose();
  846. }
  847. }
  848. }
  849. catch (Exception exception)
  850. {
  851. MessageBox.Show(exception.ToString());
  852. }//All credits to Coyote per decompile and fix errors in source
  853. //Do not remove credits...
  854. }
  855.  
  856. private void unzip_ExtractProgressChanged(object sender, ExtractProgressEventArgs e)
  857. {
  858. try
  859. {
  860. if (e.TotalBytesToTransfer != (long)0)
  861. {
  862. this.Bar1SetProgress(e.BytesTransferred, e.TotalBytesToTransfer, false);
  863. }//All credits to Coyote per decompile and fix errors in source
  864. //Do not remove credits...
  865. this.ArchiveBar.Refresh();
  866. this.ArchiveBar.Update();
  867. }
  868. catch (Exception exception)
  869. {
  870. MessageBox.Show(exception.ToString());
  871. }
  872. }
  873.  
  874. private void Verif_Click(object sender, EventArgs e)
  875. {//All credits to Coyote per decompile and fix errors in source
  876. //Do not remove credits...
  877. this.loadingVerif = true;
  878. SortedList<string, string> strs = Launcher.loadXML(string.Concat(Application.StartupPath, "\\UserFileList.dat"));
  879. List<string> strs1 = new List<string>();
  880. this.label1.Text = Config.verif_files;
  881. this.fileName.Visible = true;
  882. this.Verif.Enabled = false;
  883. this.Verif.BackgroundImage = Resources.checkd_button;
  884. this.Start.Enabled = false;
  885. this.Start.BackgroundImage = Resources.startd_button;
  886. for (int i = 0; i < strs.Count; i++)
  887. {//All credits to Coyote per decompile and fix errors in source
  888. //Do not remove credits...
  889. Application.DoEvents();
  890. string item = strs.Keys[i];
  891. string str = "";
  892. string startupPath = Application.StartupPath;
  893. int num = item.LastIndexOf("\\");
  894. string str1 = item.Substring(num + 1);
  895. this.fileName.Text = str1;
  896. if (strs.TryGetValue(item, out str))
  897. {
  898. if (!File.Exists(string.Concat(startupPath, item)))
  899. {
  900. strs1.Add(item);
  901. }
  902. else if (this.getMD5HashFromFile(string.Concat(startupPath, item)) != str)
  903. {
  904. strs1.Add(item);
  905. }
  906. }
  907. this.Bar2SetProgress((ulong)i, (ulong)strs.Count);
  908. base.Update();
  909. }//All credits to Coyote per decompile and fix errors in source
  910. //Do not remove credits...
  911. foreach (string str2 in strs1)
  912. {
  913. this.listBox1.Items.Add(str2);
  914. }
  915. this.listBox1.Visible = true;
  916. this.fileName.Visible = false;
  917. this.Verif.Enabled = true;
  918. this.Verif.BackgroundImage = Resources.check_button;
  919. this.Start.BackgroundImage = Resources.start_button;
  920. this.Start.Enabled = true;
  921. this.label1.Text = Config.game_is_ok;
  922. this.loadingVerif = false;
  923. }
  924.  
  925. private void Verif_MouseLeave(object sender, EventArgs e)//All credits to Coyote per decompile and fix errors in source
  926. //Do not remove credits...
  927. {
  928. if (!this.loadingVerif)
  929. {
  930. this.Verif.BackgroundImage = Resources.check_button;
  931. }
  932. }
  933.  
  934. private void Verif_MouseMove(object sender, MouseEventArgs e)
  935. {//All credits to Coyote per decompile and fix errors in source
  936. //Do not remove credits...
  937. this.Verif.BackgroundImage = Resources.check2_button;
  938. }
  939.  
  940. private void web_DownloadCompleted(object sender, AsyncCompletedEventArgs e)
  941. {
  942. if (e.Error == null)
  943. {
  944. MessageBox.Show("v");
  945. }
  946. }
  947.  
  948. [DllImport("Kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false, SetLastError = true)]//All credits to Coyote per decompile and fix errors in source
  949. //Do not remove credits...
  950. public static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName);
  951.  
  952. public void xmlLoad()
  953. {//All credits to Coyote per decompile and fix errors in source
  954. //Do not remove credits...
  955. if (File.Exists(string.Concat(Application.StartupPath, "\\removes.xml")))
  956. {
  957. List<XMLModel> xMLModels = this.parse(string.Concat(Application.StartupPath, "\\removes.xml"));
  958. int num = 0;
  959. this.label1.Text = "Fazendo limpeza de arquivos inúteis.";
  960. this.Verif.Enabled = false;
  961. this.Verif.BackgroundImage = Resources.checkd_button;
  962. this.fileName.Visible = true;
  963. foreach (XMLModel xMLModel in xMLModels)
  964. {
  965. num++;
  966. if (File.Exists(string.Concat(Application.StartupPath, xMLModel.local)))
  967. {//All credits to Coyote per decompile and fix errors in source
  968. //Do not remove credits...
  969. this.fileName.Text = xMLModel.local;
  970. File.Delete(string.Concat(Application.StartupPath, xMLModel.local));
  971. }
  972. this.Bar2SetProgress((ulong)num, (ulong)xMLModels.Count);
  973. }
  974. File.Delete(string.Concat(Application.StartupPath, "\\removes.xml"));
  975. this.label1.Text = Config.game_is_ok;
  976. this.fileName.Visible = false;//All credits to Coyote per decompile and fix errors in source
  977. //Do not remove credits...
  978. this.Start.Enabled = true;
  979. this.Verif.Enabled = true;
  980. this.Start.BackgroundImage = Resources.start_button;//All credits to Coyote per decompile and fix errors in source
  981. //Do not remove credits...
  982. this.Verif.BackgroundImage = Resources.check_button;
  983. }
  984. }
  985.  
  986. private void fileName_Click(object sender, EventArgs e)
  987. {
  988.  
  989. }
  990.  
  991. private void TotalBar_Click(object sender, EventArgs e)
  992. {
  993.  
  994. }
  995.  
  996. private void label3_Click(object sender, EventArgs e)
  997. {
  998.  
  999. }
  1000.  
  1001. private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  1002. {
  1003.  
  1004. }
  1005.  
  1006. private void ArchiveBar_Click(object sender, EventArgs e)
  1007. {
  1008.  
  1009. }
  1010. }
  1011. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement