Come da titolo, mi servirebbe un aiuto circa l'implementazione di un codice C#
Allora, il codice in questione fa parte di un "updater" che ha il compito di verificare remotamente la versione di alcuni files, e nel caso aggiornarli (scaricando l'update compresso ed estraendolo).
Finora sono riuscito ad ottenere questo:
codice:
try {
string localversion;
using (StreamReader streamReader = File.OpenText("version"))
{
localversion = streamReader.ReadToEnd();
Properties.Settings.Default.localversion = localversion.ToString();
}
this.Invoke((MethodInvoker)delegate() { label6.Text = "Checking for updates ..."; });
this.Invoke((MethodInvoker)delegate() { pictureBox1.Image = Properties.Resources.url_bw1; });
var webClient = new WebClient();
string readHtml = webClient.DownloadString(Server + "version");
string version = readHtml.ToString();
if (version.ToString() == localversion.ToString())
{
this.Invoke((MethodInvoker)delegate() { label6.Text = "Your client is up to date."; });
this.Invoke((MethodInvoker)delegate() { progressBar1.Value = 100; });
this.Invoke((MethodInvoker)delegate() { pictureBox1.Enabled = true; });
this.Invoke((MethodInvoker)delegate() { pictureBox1.Image = Properties.Resources.url_501; });
}
else
{
this.Invoke((MethodInvoker)delegate() { label6.Text = "Updating, please wait ..."; });
Properties.Settings.Default.remoteversion = version;
WebClient webClient2 = new WebClient();
Uri uri = new Uri(Server + localversion + ".zip");
webClient2.DownloadFileAsync(uri, localversion + ".zip");
webClient2.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback);
webClient2.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCallback2);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
e fino qui tutto bene, tuttavia il software mi scarica SOLO l'update più recente rispetto la versione client dei files, a me servirebbe che scaricasse anche tutti i precedenti update se i files lato client non fossero aggiornati. Altrimenti mi troverei tra qualche mese a dover elaborare una patch di 100GB e passa solo perchè altrimenti i client "datati" non avrebbero i files necessari... ed è un problema.
Ho provato implementando un
senza risultato.. idee?