Note that there are some explanatory texts on larger screens.

plurals
  1. POmaking a patcher / downloading and running exe files silent
    primarykey
    data
    text
    <p>ok, i have made a program that needs to also patch a client. rather then downloading each file and overwriting, i would like to make a self extracting WinRAR file download then run silently and extract to a designated path. so far this is what i think i will need</p> <pre><code>{ //check for patch(client)(server).txt file //download the file MessageBox.Show("working", "Patcher", MessageBoxButtons.OK, MessageBoxIcon.Information); //check file for needs &amp; write to string //delete file //implement progress bar steps by files needed //find if file is already in directory //if not then download //finish and show msg (patcher will now extract) //msg ok resets progress bar //set steps for files needed //extract resources &lt;--- //overwrite text file //finish and show msg (Patch finished) } </code></pre> <p>I can accomplish all the checks and downloads but as for the extracting resources I am at a blank, also please review and see if i have missed any checks.</p> <p>edit: i finished everything but the extraction codes, check for approval</p> <pre><code> public void extractrar(string fileneeded) { string realfileneeded = "ini\\update\\" + fileneeded; count++; } public void extractexe(string fileneeded) { string realfileneeded = "ini\\update\\" + fileneeded; count++; } public void downloadfile(string fileneeded) { //find if file is already in directory if (!File.Exists("ini\\update\\" + fileneeded)) { webClient.DownloadFile("http://webaddress.com/folder/" + fileneeded, "ini\\update\\" + fileneeded); count++; progressBar1.PerformStep(); if (!fileneeded.Contains(".rar") || !fileneeded.Contains(".exe")) { File.Move("ini\\update\\" + fileneeded, fileneeded); } } else { count++; progressbar1.performstep(); } private void button6_Click(object sender, EventArgs e)//patcher { progressBar1.Value = 0; progressadvance(2); if (File.Exists("version.dat") == true)//check for version file { TextReader reader1 = File.OpenText("version.dat"); int x = int.Parse(reader1.ReadLine()); int clientVer = x; reader1.Close(); progressadvance(2); webClient.DownloadFile("http://divinecreation.no-ip.info/patchCO5165/update.dat", "ini\\update.dat"); progressadvance(2); TextReader reader2 = File.OpenText("ini\\update.dat"); int y = int.Parse(reader2.ReadLine()); int serverVer = y; reader2.Close(); progressadvance(2); File.Delete("ini\\update.dat"); progressadvance(2); if (clientVer &lt; serverVer) { string NeedPath = Application.StartupPath + "ini\\update\\patch(" + clientVer + ")(" + serverVer + ").txt"; string smallNeedPath = "ini\\update\\patch(" + clientVer + ")(" + serverVer + ").txt"; if (MessageBox.Show("Possible patch, Continue?", "Patcher", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.Yes) { progressBar1.Value = 0; //download the file webClient.DownloadFile("http://divinecreation.no-ip.info/patchCO5165/patch(" + clientVer + ")(" + serverVer + ").txt", smallNeedPath); progressadvance(2); //check for patch(client)(server).txt file if (File.Exists(smallNeedPath)) { //check file for needs TextReader reader3 = File.OpenText(smallNeedPath); string z = (reader3.ReadLine()); string[] bits = z.Split(' '); reader3.Close(); progressadvance(2); //delete file File.Delete(smallNeedPath); progressadvance(2); //implement progress steps by files needed progressBar1.Value = 0; progressBar1.Maximum = (3 + bits.Length); //download needed files while (count &lt; bits.Length) { downloadfile(bits[count]); } //reset counter count = 0; progressadvance(1); //finish and show msg (patcher will now extract) //msg ok resets progress bar if (MessageBox.Show("Neccesarry files downloaded, preparing extraction check", "Patcher", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.OK) { //set steps for files needed progressBar1.Value = 0; //find if files needing extraction while (bits[count].Contains(".rar")) { //extract resources via rar extractrar(bits[count]); } //find if files needing execution while (bits[count].Contains(".exe")) { //extract resources via exe extractexe(bits[count]); } //overwrite text file using (StreamWriter newTask = new StreamWriter("version.dat", false)) { newTask.WriteLine(serverVer.ToString()); } //finish and show msg (Patch finished) MessageBox.Show("client patched successfully", "Patcher", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Error during patch [please allow downloaded files]", "Patcher", MessageBoxButtons.OK, MessageBoxIcon.Error); progressBar1.Value = 0; } } else { progressBar1.Value = 0; } } else { MessageBox.Show("Your client is already patched", "Patcher", MessageBoxButtons.OK, MessageBoxIcon.Information); progressBar1.PerformStep(); progressBar1.PerformStep(); } } else if (MessageBox.Show("Please create a Version.dat file with your client version", "Patcher", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == System.Windows.Forms.DialogResult.Retry) { progressBar1.Value = 0; button6_Click(sender, e); } else { progressBar1.Value = 0; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload