Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Ionic.Zip;
- using Microsoft.VisualBasic.Devices;
- using Microsoft.VisualBasic.FileIO;
- using p2qlx;
- using Point_Blank_Launcher.Properties;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Drawing;
- using System.IO;
- using System.Net;
- using System.Runtime.InteropServices;
- using System.Security.Cryptography;
- using System.Text;
- using System.Windows.Forms;
- using System.Xml;
- //All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- namespace Point_Blank_Launcher
- {
- public class Launcher : Form
- {
- public WebClient web = new WebClient();
- public WebClient launchUpdate = new WebClient();
- public WebClient gameUpdate = new WebClient();
- public int lastVersion = -1;
- public bool loadingVerif;
- public Computer myComputer = new Computer();
- public Point_Blank_Launcher.Connection conc;
- private Point NewPoint;
- private IContainer components;
- private Label label1;
- private Label label2;
- private Label label3;
- private Label label4;
- private PictureBox pictureBox1;
- private Button Verif;
- private Button Button_Update;
- private Button Start;
- //All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- private PictureBox TotalBar;
- private PictureBox ArchiveBar;
- private Label fileName;
- //All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- private Timer timer6;
- private PictureBox pictureBox4;
- private WebBrowser webBrowser1;
- private ListBox listBox1;
- public Launcher(Point_Blank_Launcher.Connection c)
- {
- this.conc = c;
- this.InitializeComponent();
- this.web.DownloadFileCompleted += new AsyncCompletedEventHandler(this.web_DownloadCompleted);
- this.gameUpdate.DownloadFileCompleted += new AsyncCompletedEventHandler(this.gameUpdate_DownloadCompleted);
- this.launchUpdate.DownloadFileCompleted += new AsyncCompletedEventHandler(this.launchUpdate_DownloadCompleted);
- this.gameUpdate.DownloadProgressChanged += new DownloadProgressChangedEventHandler(this.gameUpdate_DownloadProgressChanged);
- }
- public void Bar1SetProgress(long received, long maximum, bool progress)
- {
- this.ArchiveBar.Width = (int)(received * (long)417 / maximum);
- }
- public void Bar2SetProgress(ulong received, ulong maximum)
- {
- this.TotalBar.Width = (int)(received * (long)417 / maximum);
- }
- private void Button_Update_Click(object sender, EventArgs e)
- {
- this.Button_Update.Enabled = false;
- this.fileName.Visible = true;
- int.Parse(this.web.DownloadString("http://blazepb.ml/versions/last_client_version.txt"));
- int num = int.Parse(this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0"));
- int num1 = num + 1;
- this.myComputer.FileSystem.CreateDirectory(string.Concat(Application.StartupPath, "\\_DownloadPatchFiles"));
- try
- {
- WebClient webClient = this.gameUpdate;
- Uri uri = new Uri(string.Concat("http://blazepb.ml/versions/updates/Update_", num1, ".zip"));
- object[] startupPath = new object[] { Application.StartupPath, "\\_DownloadPatchFiles\\Update_", num1, ".zip" };
- webClient.DownloadFileAsync(uri, string.Concat(startupPath));
- }
- catch
- {
- this.teste("[ERROR] Código 3*2");
- MessageBox.Show("error");
- }
- this.Verif.Enabled = false;
- this.Verif.BackgroundImage = Resources.checkd_button;
- this.Start.BackgroundImage = Resources.startd_button;
- this.Verif.Refresh();
- this.label1.Text = Config.downl_file;
- this.label1.Refresh();
- this.fileName.Text = string.Concat("Update_", num1, ".zip");
- this.fileName.Refresh();
- }
- //All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- private void Button_Update_MouseLeave(object sender, EventArgs e)
- {
- this.Button_Update.BackgroundImage = Resources.upda_button;
- }
- private void Button_Update_MouseMove(object sender, MouseEventArgs e)
- {
- this.Button_Update.BackgroundImage = Resources.upda2_button;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- MessageBox.Show("vsf");
- }
- public static string check(string v, string[] tst)
- {
- string str;
- int num = 0;
- while (true)
- {
- if (num >= (int)tst.Length)
- {
- str = "";
- break;
- }
- else if (!(tst[num].Substring(Application.StartupPath.Length) == v))
- {
- num++;
- }
- else
- {
- str = tst[num];
- break;
- }
- }
- return str;
- }
- //All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- protected override void Dispose(bool disposing)
- {
- if ((!disposing ? false : this.components != null))
- {
- this.components.Dispose();
- }
- base.Dispose(disposing);
- }
- private void EscreverArquivo(string arquivo, string secao, string chave, string valor)
- {
- Launcher.WritePrivateProfileString(secao, chave, valor, arquivo);
- }
- private void form_Closing(object sender, FormClosedEventArgs e)
- {
- this.conc.Close();
- }
- private void gameUpdate_DownloadCompleted(object sender, AsyncCompletedEventArgs e)
- {
- if (e.Error == null)
- {
- int num = int.Parse(this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0"));
- int num1 = num + 1;
- this.label1.Text = Config.excract_file;
- this.ArchiveBar.Width = 0;
- string startupPath = Application.StartupPath;
- object[] actualVersion = new object[] { Application.StartupPath, "\\_DownloadPatchFiles\\Update_", num1, ".zip" };
- this.unzip(startupPath, string.Concat(actualVersion));
- this.Start.Enabled = false;
- this.Button_Update.SendToBack();
- this.Button_Update.Enabled = false;
- this.timer6.Start();
- Label label = this.label4;
- actualVersion = new object[] { Config.actual_version, num, "/", this.lastVersion };
- label.Text = string.Concat(actualVersion);
- Directory.Delete(string.Concat(Application.StartupPath, "\\_DownloadPatchFiles"), true);
- this.ArchiveBar.Width = 417;
- }
- }
- //All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- private void gameUpdate_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
- {
- this.Bar1SetProgress(e.BytesReceived, e.TotalBytesToReceive, false);
- }
- public byte[] GeraChecksum(string filePath)
- {
- Stream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
- byte[] bytes = (new UnicodeEncoding()).GetBytes("Macoratti");
- byte[] numArray = (new HMACSHA1(bytes, true)).ComputeHash(fileStream);
- fileStream.Close();
- return numArray;
- }
- protected string getMD5HashFromFile(string fileName)
- {
- string str = "";
- MD5 mD5 = MD5.Create();
- try
- {
- FileStream fileStream = File.OpenRead(fileName);
- try
- {
- str = BitConverter.ToString(mD5.ComputeHash(fileStream)).Replace("-", string.Empty);
- fileStream.Close();
- }
- finally
- {
- if (fileStream != null)
- {
- ((IDisposable)fileStream).Dispose();
- }
- }
- }
- finally
- {
- if (mD5 != null)
- {
- ((IDisposable)mD5).Dispose();
- }
- }
- return str;
- }
- //All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- [DllImport("Kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false, SetLastError = true)]
- public static extern bool GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int size, string lpFileName);
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.Start = new System.Windows.Forms.Button();
- this.Verif = new System.Windows.Forms.Button();
- this.Button_Update = new System.Windows.Forms.Button();
- this.TotalBar = new System.Windows.Forms.PictureBox();
- this.ArchiveBar = new System.Windows.Forms.PictureBox();
- this.fileName = new System.Windows.Forms.Label();
- this.timer6 = new System.Windows.Forms.Timer(this.components);
- this.pictureBox4 = new System.Windows.Forms.PictureBox();
- this.listBox1 = new System.Windows.Forms.ListBox();
- this.webBrowser1 = new System.Windows.Forms.WebBrowser();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.TotalBar)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.ArchiveBar)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.BackColor = System.Drawing.Color.Transparent;
- this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
- this.label1.ForeColor = System.Drawing.Color.Black;
- this.label1.Location = new System.Drawing.Point(53, 369);
- this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(145, 13);
- this.label1.TabIndex = 0;
- this.label1.Text = "Texto padrão não carregado.";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.BackColor = System.Drawing.Color.Transparent;
- this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
- this.label2.ForeColor = System.Drawing.Color.Black;
- this.label2.Location = new System.Drawing.Point(19, 292);
- this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(23, 13);
- this.label2.TabIndex = 1;
- this.label2.Text = "File";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.BackColor = System.Drawing.Color.Transparent;
- this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
- this.label3.ForeColor = System.Drawing.Color.Black;
- this.label3.Location = new System.Drawing.Point(19, 309);
- this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(31, 13);
- this.label3.TabIndex = 2;
- this.label3.Text = "Total";
- this.label3.Click += new System.EventHandler(this.label3_Click);
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.BackColor = System.Drawing.Color.Transparent;
- this.label4.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label4.ForeColor = System.Drawing.Color.Transparent;
- this.label4.Location = new System.Drawing.Point(53, 69);
- this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(81, 14);
- this.label4.TabIndex = 3;
- this.label4.Text = "Carregando...";
- //
- // pictureBox1
- //
- this.pictureBox1.BackColor = System.Drawing.Color.White;
- this.pictureBox1.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.Close1;
- this.pictureBox1.Location = new System.Drawing.Point(465, 6);
- this.pictureBox1.Margin = new System.Windows.Forms.Padding(2);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(21, 20);
- this.pictureBox1.TabIndex = 4;
- this.pictureBox1.TabStop = false;
- this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
- this.pictureBox1.MouseEnter += new System.EventHandler(this.pictureBox1_MouseMove);
- this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
- //
- // Start
- //
- this.Start.BackColor = System.Drawing.Color.Transparent;
- this.Start.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.start_button;
- this.Start.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.Start.FlatAppearance.BorderSize = 0;
- this.Start.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.Start.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
- this.Start.ForeColor = System.Drawing.Color.Transparent;
- this.Start.Location = new System.Drawing.Point(398, 339);
- this.Start.Margin = new System.Windows.Forms.Padding(2);
- this.Start.Name = "Start";
- this.Start.Size = new System.Drawing.Size(84, 43);
- this.Start.TabIndex = 7;
- this.Start.UseVisualStyleBackColor = true;
- this.Start.Click += new System.EventHandler(this.Start_Click);
- this.Start.MouseLeave += new System.EventHandler(this.Start_MouseLeave);
- this.Start.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Start_MouseMove);
- //
- // Verif
- //
- this.Verif.BackColor = System.Drawing.Color.Transparent;
- this.Verif.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.check_button;
- this.Verif.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.Verif.FlatAppearance.BorderSize = 0;
- this.Verif.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.Verif.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
- this.Verif.ForeColor = System.Drawing.Color.Transparent;
- this.Verif.Location = new System.Drawing.Point(337, 338);
- this.Verif.Margin = new System.Windows.Forms.Padding(2);
- this.Verif.Name = "Verif";
- this.Verif.Size = new System.Drawing.Size(53, 43);
- this.Verif.TabIndex = 8;
- this.Verif.UseVisualStyleBackColor = false;
- this.Verif.Click += new System.EventHandler(this.Verif_Click);
- this.Verif.MouseLeave += new System.EventHandler(this.Verif_MouseLeave);
- this.Verif.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Verif_MouseMove);
- //
- // Button_Update
- //
- this.Button_Update.BackColor = System.Drawing.Color.Transparent;
- this.Button_Update.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.upda2_button;
- this.Button_Update.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.Button_Update.FlatAppearance.BorderSize = 0;
- this.Button_Update.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.Button_Update.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
- this.Button_Update.ForeColor = System.Drawing.Color.Transparent;
- this.Button_Update.Location = new System.Drawing.Point(398, 339);
- this.Button_Update.Margin = new System.Windows.Forms.Padding(2);
- this.Button_Update.Name = "Button_Update";
- this.Button_Update.Size = new System.Drawing.Size(84, 43);
- this.Button_Update.TabIndex = 9;
- this.Button_Update.UseVisualStyleBackColor = true;
- this.Button_Update.Click += new System.EventHandler(this.Button_Update_Click);
- this.Button_Update.MouseLeave += new System.EventHandler(this.Button_Update_MouseLeave);
- this.Button_Update.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Button_Update_MouseMove);
- //
- // TotalBar
- //
- this.TotalBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(198)))), ((int)(((byte)(86)))), ((int)(((byte)(12)))));
- this.TotalBar.Location = new System.Drawing.Point(62, 312);
- this.TotalBar.Name = "TotalBar";
- this.TotalBar.Size = new System.Drawing.Size(417, 9);
- this.TotalBar.TabIndex = 10;
- this.TotalBar.TabStop = false;
- this.TotalBar.Click += new System.EventHandler(this.TotalBar_Click);
- //
- // ArchiveBar
- //
- this.ArchiveBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(125)))), ((int)(((byte)(0)))));
- this.ArchiveBar.Location = new System.Drawing.Point(62, 295);
- this.ArchiveBar.Name = "ArchiveBar";
- this.ArchiveBar.Size = new System.Drawing.Size(417, 9);
- this.ArchiveBar.TabIndex = 11;
- this.ArchiveBar.TabStop = false;
- this.ArchiveBar.Click += new System.EventHandler(this.ArchiveBar_Click);
- //
- // fileName
- //
- this.fileName.AutoSize = true;
- this.fileName.BackColor = System.Drawing.Color.Transparent;
- this.fileName.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
- this.fileName.ForeColor = System.Drawing.Color.Black;
- this.fileName.Location = new System.Drawing.Point(19, 334);
- this.fileName.Name = "fileName";
- this.fileName.Size = new System.Drawing.Size(59, 13);
- this.fileName.TabIndex = 14;
- this.fileName.Text = "Arquivo.zip";
- this.fileName.Visible = false;
- this.fileName.Click += new System.EventHandler(this.fileName_Click);
- //
- // timer6
- //
- this.timer6.Tick += new System.EventHandler(this.timer6_Tick);
- //
- // pictureBox4
- //
- this.pictureBox4.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.Minimize1;
- this.pictureBox4.Location = new System.Drawing.Point(438, 6);
- this.pictureBox4.Name = "pictureBox4";
- this.pictureBox4.Size = new System.Drawing.Size(21, 20);
- this.pictureBox4.TabIndex = 15;
- this.pictureBox4.TabStop = false;
- this.pictureBox4.Click += new System.EventHandler(this.pictureBox4_Click);
- this.pictureBox4.MouseLeave += new System.EventHandler(this.pictureBox4_MouseLeave);
- this.pictureBox4.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox4_MouseMove);
- //
- // listBox1
- //
- this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.listBox1.FormattingEnabled = true;
- this.listBox1.Location = new System.Drawing.Point(398, 90);
- this.listBox1.Name = "listBox1";
- this.listBox1.Size = new System.Drawing.Size(17, 4);
- this.listBox1.TabIndex = 16;
- this.listBox1.Visible = false;
- //
- // webBrowser1
- //
- this.webBrowser1.IsWebBrowserContextMenuEnabled = false;
- this.webBrowser1.Location = new System.Drawing.Point(13, 41);
- this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
- this.webBrowser1.Name = "webBrowser1";
- this.webBrowser1.ScrollBarsEnabled = false;
- this.webBrowser1.Size = new System.Drawing.Size(473, 235);
- this.webBrowser1.TabIndex = 17;
- this.webBrowser1.Url = new System.Uri("http://blazepb.ml/webs/2/index.html", System.UriKind.Absolute);
- this.webBrowser1.WebBrowserShortcutsEnabled = false;
- this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
- //
- // Launcher
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(4F, 7F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.SystemColors.WindowFrame;
- this.BackgroundImage = global::Point_Blank_Launcher.Properties.Resources.background;
- this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.ClientSize = new System.Drawing.Size(500, 400);
- this.Controls.Add(this.webBrowser1);
- this.Controls.Add(this.listBox1);
- this.Controls.Add(this.pictureBox4);
- this.Controls.Add(this.fileName);
- this.Controls.Add(this.TotalBar);
- this.Controls.Add(this.ArchiveBar);
- this.Controls.Add(this.Verif);
- this.Controls.Add(this.pictureBox1);
- this.Controls.Add(this.label4);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.Start);
- this.Controls.Add(this.Button_Update);
- this.Controls.Add(this.label1);
- this.DoubleBuffered = true;
- this.Font = new System.Drawing.Font("Microsoft Sans Serif", 5F);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
- this.Icon = global::Point_Blank_Launcher.Properties.Resources.Icon;
- this.Margin = new System.Windows.Forms.Padding(2);
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "Launcher";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "PBLauncher";
- this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.form_Closing);
- this.Load += new System.EventHandler(this.Launcher_Load);
- this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.launcher_MouseDown);
- this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.launcher_MouseMove);
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.TotalBar)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.ArchiveBar)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- private void Launcher_Load(object sender, EventArgs e)
- {
- Settings variable = new Settings();
- if (variable.language == "Português (Brasil)")
- {
- Config.LanguageBRAZILIAN();
- }
- else if (variable.language == "English")
- {
- Config.LanguageENGLISH();
- }
- this.teste("Conexão efetuada com sucesso.");
- this.label1.Text = Config.status;
- this.label2.Text = Config.file;
- this.label3.Text = Config.total;
- base.WindowState = FormWindowState.Normal;
- base.Visible = true;
- this.label4.Visible = true;
- this.lastVersion = int.Parse(this.web.DownloadString("http://blazepb.ml/versions/last_client_version.txt"));
- this.label4.Text = string.Concat(Config.actual_version, this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0"), "/", this.lastVersion.ToString());
- this.Start.Enabled = false;
- this.web.DownloadString("http://blazepb.ml/versions/last_launcher_version.txt");
- string str = "";
- byte[] numArray = this.GeraChecksum(string.Concat(Application.StartupPath, "\\PBLauncher.exe"));
- if (this.myComputer.FileSystem.DirectoryExists(string.Concat(Application.StartupPath, "\\_LauncherPatchFiles")))
- {
- this.myComputer.FileSystem.DeleteDirectory(string.Concat(Application.StartupPath, "\\_LauncherPatchFiles"), DeleteDirectoryOption.DeleteAllContents);
- }
- for (int i = 0; i < (int)numArray.Length; i++)
- {
- str = string.Concat(str, string.Format("{0:X2}", numArray[i]));
- }
- if (!(this.lastVersion.ToString() == this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0")))
- {
- this.ArchiveBar.Width = 0;
- this.TotalBar.Width = 0;
- this.label1.Text = Config.update;
- this.Verif.Enabled = false;
- this.Verif.BackgroundImage = Resources.checkd_button;
- this.Start.Visible = false;
- }
- else
- {
- this.label1.Text = Config.game_is_ok;
- this.Start.Enabled = true;
- this.Verif.Enabled = true;
- this.xmlLoad();
- }
- }
- private void launcher_MouseDown(object sender, MouseEventArgs e)
- {
- if (Control.MouseButtons == System.Windows.Forms.MouseButtons.Left)
- {
- int left = base.Left;
- Point mousePosition = Control.MousePosition;
- this.NewPoint.X = left - mousePosition.X;
- int top = base.Top;
- Point point = Control.MousePosition;
- this.NewPoint.Y = top - point.Y;
- }
- }
- private void launcher_MouseMove(object sender, MouseEventArgs e)
- {
- if (Control.MouseButtons == System.Windows.Forms.MouseButtons.Left)
- {
- int x = this.NewPoint.X;
- Point mousePosition = Control.MousePosition;
- base.Left = x + mousePosition.X;
- int y = this.NewPoint.Y;
- mousePosition = Control.MousePosition;
- base.Top = y + mousePosition.Y;
- }
- }
- private void launchUpdate_DownloadCompleted(object sender, AsyncCompletedEventArgs e)
- {
- if (e.Error == null)
- {
- MessageBox.Show("v");
- }
- }
- private string LerArquivo(string arquivo, string secao, string chave, string valorPadrao)
- {
- StringBuilder stringBuilder = new StringBuilder(500);
- Launcher.GetPrivateProfileString(secao, chave, valorPadrao, stringBuilder, 500, arquivo);
- return stringBuilder.ToString();
- }
- public static SortedList<string, string> loadXML(string path)
- {
- SortedList<string, string> strs = new SortedList<string, string>();
- XmlDocument xmlDocument = new XmlDocument();
- FileStream fileStream = new FileStream(path, FileMode.Open);
- if (fileStream.Length != (long)0)
- {
- try
- {
- xmlDocument.Load(fileStream);
- for (XmlNode i = xmlDocument.FirstChild; i != null; i = i.NextSibling)
- {
- if ("list".Equals(i.Name))
- {
- for (XmlNode j = i.FirstChild; j != null; j = j.NextSibling)
- {
- if ("f".Equals(j.Name))
- {
- XmlNamedNodeMap attributes = j.Attributes;
- string value = attributes.GetNamedItem("n").Value;
- if (!strs.ContainsKey(value))
- {
- strs.Add(value, attributes.GetNamedItem("m").Value);
- }
- }
- }
- }
- }
- }
- catch
- {
- }
- }
- fileStream.Dispose();
- fileStream.Close();
- return strs;
- }
- private List<XMLModel> parse(string path)
- {
- List<XMLModel> xMLModels = new List<XMLModel>();
- XmlDocument xmlDocument = new XmlDocument();
- FileStream fileStream = new FileStream(path, FileMode.Open);
- if (fileStream.Length == (long)0)
- {
- this.teste("[ERROR] Código 4*1");
- }
- else
- {
- try
- {
- xmlDocument.Load(fileStream);
- for (XmlNode i = xmlDocument.FirstChild; i != null; i = i.NextSibling)
- {
- if ("list".Equals(i.Name))
- {
- for (XmlNode j = i.FirstChild; j != null; j = j.NextSibling)
- {
- if ("file".Equals(j.Name))
- {
- XmlNamedNodeMap attributes = j.Attributes;
- xMLModels.Add(new XMLModel(attributes.GetNamedItem("local").Value));
- }
- }
- }
- }
- }
- catch (XmlException xmlException)
- {
- MessageBox.Show(xmlException.ToString());
- }
- }
- fileStream.Dispose();
- fileStream.Close();
- return xMLModels;
- }
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show(Config.leave, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
- {
- base.Close();
- }
- }
- private void pictureBox1_MouseLeave(object sender, EventArgs e)
- {
- this.pictureBox1.Image = Resources.exit_button;
- }
- private void pictureBox1_MouseMove(object sender, EventArgs e)
- {
- this.pictureBox1.Image = Resources.exit3_button1;
- }
- private void pictureBox4_Click(object sender, EventArgs e)
- {
- base.WindowState = FormWindowState.Minimized;
- }
- private void pictureBox4_MouseLeave(object sender, EventArgs e)
- {
- this.pictureBox4.BackgroundImage = Resources.minim_button;
- }
- private void pictureBox4_MouseMove(object sender, MouseEventArgs e)
- {
- this.pictureBox4.BackgroundImage = Resources.minim2_button;
- }
- private void Start_Click(object sender, EventArgs e)
- {
- try
- {
- Process.Start(string.Concat(Application.StartupPath, "\\PointBlank.exe"), Config.password);
- }
- catch
- {
- this.teste("[ERROR] Código 5*0");
- }
- base.Close();
- }
- private void Start_MouseLeave(object sender, EventArgs e)
- {
- this.Start.BackgroundImage = Resources.start_button;
- }
- private void Start_MouseMove(object sender, MouseEventArgs e)
- {
- this.Start.BackgroundImage = Resources.start2_button;
- }
- private void teste(string texto)
- {
- string str = string.Concat(Application.StartupPath, "\\PBLauncher.log");
- DateTime now = DateTime.Now;
- StreamWriter streamWriter = new StreamWriter(str, true);
- string[] strArrays = new string[] { "[", now.ToString("yyyy/MM/dd"), " | ", now.ToString("HH:mm"), "] ", texto };
- streamWriter.WriteLine(string.Concat(strArrays));
- streamWriter.Flush();
- streamWriter.Close();
- }
- private void timer6_Tick(object sender, EventArgs e)
- {
- this.lastVersion = int.Parse(this.web.DownloadString("http://blazepb.ml/versions/last_client_version.txt"));
- Label label = this.label4;
- object[] actualVersion = new object[] { Config.actual_version, this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0"), "/", this.lastVersion };
- label.Text = string.Concat(actualVersion);
- if (this.lastVersion != int.Parse(this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "launcher", "version_launcher", "0")))
- {
- int num = int.Parse(this.LerArquivo(string.Concat(Application.StartupPath, "\\config.zpt"), "Launcher", "version_launcher", "0")) + 1;
- this.myComputer.FileSystem.CreateDirectory(string.Concat(Application.StartupPath, "\\_DownloadPatchFiles"));
- try
- {
- WebClient webClient = this.gameUpdate;
- Uri uri = new Uri(string.Concat("http://blazepb.ml/versions/updates/Update_", num, ".zip"));
- actualVersion = new object[] { Application.StartupPath, "\\_DownloadPatchFiles\\Update_", num, ".zip" };
- webClient.DownloadFileAsync(uri, string.Concat(actualVersion));
- }
- catch (Exception exception)
- {
- MessageBox.Show(exception.ToString());
- }//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- this.Verif.Enabled = false;
- this.Verif.BackgroundImage = Resources.checkd_button;
- this.Bar2SetProgress((ulong)0, (ulong)100);
- this.label1.Text = Config.downl_file;
- this.fileName.Text = string.Concat("Update_", num, ".zip");
- this.timer6.Stop();
- }
- else
- {
- this.label1.Text = Config.game_is_ok;
- this.Start.Enabled = true;
- this.Verif.Enabled = true;
- this.Start.BackgroundImage = Resources.start_button;
- this.Verif.BackgroundImage = Resources.check_button;
- this.Button_Update.Enabled = false;
- this.Start.Visible = true;
- this.Button_Update.Visible = false;
- this.fileName.Visible = false;
- this.xmlLoad();
- this.timer6.Stop();
- }//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- }
- public void unzip(string TargetDir, string ZipToUnpack)
- {
- try
- {
- ZipFile zipFile = ZipFile.Read(ZipToUnpack);
- try//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- {
- zipFile.ExtractProgress += new EventHandler<ExtractProgressEventArgs>(this.unzip_ExtractProgressChanged);
- int num = 0;
- int num1 = 0;
- foreach (ZipEntry zipEntry in zipFile)
- {
- if (!zipEntry.IsDirectory)
- {
- num1++;
- }
- }
- this.fileName.Visible = true;
- foreach (ZipEntry zipEntry1 in zipFile)
- {
- string fileName = zipEntry1.FileName;
- if (fileName.Contains("/"))
- {
- int num2 = fileName.LastIndexOf("/");
- fileName = fileName.Substring(num2 + 1);
- }
- if (!zipEntry1.IsDirectory)
- {
- this.fileName.Text = fileName;
- base.Update();
- this.Refresh();
- int num3 = num + 1;
- num = num3;
- this.Bar2SetProgress((ulong)num3, (ulong)num1);
- }//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- zipEntry1.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently);
- }
- }
- finally
- {
- if (zipFile != null)
- {
- zipFile.Dispose();
- }
- }
- }
- catch (Exception exception)
- {
- MessageBox.Show(exception.ToString());
- }//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- }
- private void unzip_ExtractProgressChanged(object sender, ExtractProgressEventArgs e)
- {
- try
- {
- if (e.TotalBytesToTransfer != (long)0)
- {
- this.Bar1SetProgress(e.BytesTransferred, e.TotalBytesToTransfer, false);
- }//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- this.ArchiveBar.Refresh();
- this.ArchiveBar.Update();
- }
- catch (Exception exception)
- {
- MessageBox.Show(exception.ToString());
- }
- }
- private void Verif_Click(object sender, EventArgs e)
- {//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- this.loadingVerif = true;
- SortedList<string, string> strs = Launcher.loadXML(string.Concat(Application.StartupPath, "\\UserFileList.dat"));
- List<string> strs1 = new List<string>();
- this.label1.Text = Config.verif_files;
- this.fileName.Visible = true;
- this.Verif.Enabled = false;
- this.Verif.BackgroundImage = Resources.checkd_button;
- this.Start.Enabled = false;
- this.Start.BackgroundImage = Resources.startd_button;
- for (int i = 0; i < strs.Count; i++)
- {//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- Application.DoEvents();
- string item = strs.Keys[i];
- string str = "";
- string startupPath = Application.StartupPath;
- int num = item.LastIndexOf("\\");
- string str1 = item.Substring(num + 1);
- this.fileName.Text = str1;
- if (strs.TryGetValue(item, out str))
- {
- if (!File.Exists(string.Concat(startupPath, item)))
- {
- strs1.Add(item);
- }
- else if (this.getMD5HashFromFile(string.Concat(startupPath, item)) != str)
- {
- strs1.Add(item);
- }
- }
- this.Bar2SetProgress((ulong)i, (ulong)strs.Count);
- base.Update();
- }//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- foreach (string str2 in strs1)
- {
- this.listBox1.Items.Add(str2);
- }
- this.listBox1.Visible = true;
- this.fileName.Visible = false;
- this.Verif.Enabled = true;
- this.Verif.BackgroundImage = Resources.check_button;
- this.Start.BackgroundImage = Resources.start_button;
- this.Start.Enabled = true;
- this.label1.Text = Config.game_is_ok;
- this.loadingVerif = false;
- }
- private void Verif_MouseLeave(object sender, EventArgs e)//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- {
- if (!this.loadingVerif)
- {
- this.Verif.BackgroundImage = Resources.check_button;
- }
- }
- private void Verif_MouseMove(object sender, MouseEventArgs e)
- {//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- this.Verif.BackgroundImage = Resources.check2_button;
- }
- private void web_DownloadCompleted(object sender, AsyncCompletedEventArgs e)
- {
- if (e.Error == null)
- {
- MessageBox.Show("v");
- }
- }
- [DllImport("Kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false, SetLastError = true)]//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- public static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName);
- public void xmlLoad()
- {//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- if (File.Exists(string.Concat(Application.StartupPath, "\\removes.xml")))
- {
- List<XMLModel> xMLModels = this.parse(string.Concat(Application.StartupPath, "\\removes.xml"));
- int num = 0;
- this.label1.Text = "Fazendo limpeza de arquivos inúteis.";
- this.Verif.Enabled = false;
- this.Verif.BackgroundImage = Resources.checkd_button;
- this.fileName.Visible = true;
- foreach (XMLModel xMLModel in xMLModels)
- {
- num++;
- if (File.Exists(string.Concat(Application.StartupPath, xMLModel.local)))
- {//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- this.fileName.Text = xMLModel.local;
- File.Delete(string.Concat(Application.StartupPath, xMLModel.local));
- }
- this.Bar2SetProgress((ulong)num, (ulong)xMLModels.Count);
- }
- File.Delete(string.Concat(Application.StartupPath, "\\removes.xml"));
- this.label1.Text = Config.game_is_ok;
- this.fileName.Visible = false;//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- this.Start.Enabled = true;
- this.Verif.Enabled = true;
- this.Start.BackgroundImage = Resources.start_button;//All credits to Coyote per decompile and fix errors in source
- //Do not remove credits...
- this.Verif.BackgroundImage = Resources.check_button;
- }
- }
- private void fileName_Click(object sender, EventArgs e)
- {
- }
- private void TotalBar_Click(object sender, EventArgs e)
- {
- }
- private void label3_Click(object sender, EventArgs e)
- {
- }
- private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
- {
- }
- private void ArchiveBar_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement