|
You last visited: Today at 11:23
Advertisement
Autopatcher
Discussion on Autopatcher within the CO2 Private Server forum part of the Conquer Online 2 category.
09/29/2011, 09:52
|
#1
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Autopatcher
So I coded an autopatcher, not sure if it will work or what. Haven't tested it yet as I'm in college, but if someone would look my coder over and tell me what I could do better or if there is something wrong?
Thanks
Code:
int CurrentVersion = 1001;
string loc = "";
public Form1()
{
InitializeComponent();
}
bool IsDone = false;
private void StartPatching()
{
CurrentVersion++;
WebClient cl = new WebClient();
cl.DownloadFile(loc + "\\" + CurrentVersion + ".exe", Environment.CurrentDirectory + "\\" + CurrentVersion + ".exe");
cl.DownloadProgressChanged += new DownloadProgressChangedEventHandler(HandleProgress);
cl.DownloadFileCompleted += new AsyncCompletedEventHandler(HandleComplete);
}
private void HandleProgress(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Value += e.ProgressPercentage;
}
private void HandleComplete(object sender, AsyncCompletedEventArgs e)
{
progressBar1.Value = 0;
IsDone = false;
}
private void Form1_Load(object sender, EventArgs e)
{
IniFile I = new IniFile("Config.ini", "Configuration");
CurrentVersion = I.ReadInt32(I.Section, "Version", 1001);
loc = I.ReadString(I.Section, "PatchingLocation", "");
webBrowser1.Navigate(I.ReadString(I.Section, "News", ""));
try
{
WebClient cl = new WebClient();
int RealVersion = int.Parse(cl.DownloadString(I.ReadString(I.Section, "VersionUrl", "")));
while (RealVersion > CurrentVersion)
{
if (!IsDone)
{
IsDone = true;
StartPatching();
}
}
button1.Enabled = true;
}
catch
{
MessageBox.Show("Could not connect to the autopatching server. Please check your network or settings.");
Environment.Exit(0);
}
}
|
|
|
09/29/2011, 09:57
|
#2
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 32
|
Looks good to me. Other then not saving the current version, which u may or may not of forgot to do. One thing you may look into is monitoring if the patch is cancelled in the middle or not. I havent seen anyone do it yet, just a idea. Could cause problems otherwise.
|
|
|
09/29/2011, 10:00
|
#3
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Quote:
Originally Posted by 12k
Looks good to me. Other then not saving the current version, which u may or may not of forgot to do. One thing you may look into is monitoring if the patch is cancelled in the middle or not. I havent seen anyone do it yet, just a idea. Could cause problems otherwise.
|
Yeah, not done. Was more the download part/version check, but thanks for the head up ^^
|
|
|
09/29/2011, 10:09
|
#4
|
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 32
|
You just going to use self-extracting archives and run them when their done downloading i take it? Such as
Quote:
private void HandleComplete(object sender, AsyncCompletedEventArgs e)
{
progressBar1.Value = 0;
IsDone = false;
Process.Start(Environment.CurrentDirectory + CurrentVersion + ".exe");
}
|
|
|
|
09/29/2011, 10:15
|
#5
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Quote:
Originally Posted by 12k
You just going to use self-extracting archives and run them when their done downloading i take it? Such as
|
I have done the other part. If they are closing in the middle of a download, then it will ask them if they are sure they wanna cancel it and if they cancel it, then it will go one patch back. Forgot about that part, thanks ^^
|
|
|
 |
Similar Threads
|
[Release]Autopatcher
01/15/2012 - CO2 PServer Guides & Releases - 14 Replies
Hello all, this is my first project that has been fully successful. This Autopatcher is *basically* fail-safe. If you just absolutely cannot get it to work, just delete the Configuration.ini file, it will generate a new one upon loading the program.
How to use *This explanation is for server owners*: You just take my attachment and extract it into your client's main folder, the same folder with your Conquer.exe. You then open up the Configuration.ini file and edit the values to match yours....
|
[AutoPatcher]
07/20/2010 - CO2 Private Server - 3 Replies
I was trying to make an autopatcher, but im kinda stucked with reading from host.
I tried: (changed IPHERE to ip)
Ini Configg = new Ini(System.Windows.Forms.Application.StartupPath + @"\IPHERE\autopatcher\Config.ini");
string ThePath = Configg.ReadValue("Config", "Patch");
didnt work, anybody got a solution how i can read it from the host?
The autopatcher folder is in AppServ\www folder
|
[HELP]AutoPatcher
02/28/2010 - CO2 Private Server - 0 Replies
I get an error when I launch the program it throws this error:
System.ArgumentException: Item has already been added. Key in dictionary: 'IniParser+SectionPair' Key being added: 'IniParser+SectionPair'
at IniParser..ctor(String iniPath)
at CoPinoyPatcher.frmPatcher.Completed(Object sender, AsyncCompletedEventArgs e)
at System.Net.WebClient.OnDownloadFileCompleted(Async CompletedEventArgs e)
at System.Net.WebClient.DownloadFileOperationComplete d(Object arg)
But when I click Continue...
|
autopatcher help
01/18/2010 - EO PServer Hosting - 17 Replies
im trying to put an autopatcher on our server, im using the one Forcer and FunHacker released (right on its on my personal computer not the server)... i need to know how to put a directory on our site.
|
All times are GMT +1. The time now is 11:23.
|
|