private void svnUpdateDone(object sender, RunWorkerCompletedEventArgs e) { if (updated) { Play.Enabled = true; download.Visible = false; downloadprogress.Text = "Ready to play !"; } else { iSize = 0; iCount = 0; updating = false; download.Value = 0; download.Maximum = 0; downloadprogress.Text = "I am recovering a fail update, please be patient."; SvnDelete.findSvnDirectories(System.IO.Directory.GetCurrentDirectory()); svnWorker.RunWorkerAsync(); } }
/// <summary> /// While the server isn't up to date /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void doSvnUpdate(object sender, DoWorkEventArgs e) { client = new SvnClient(); client.Notify += onSvnNotify; client.Authentication.Clear(); client.Authentication.DefaultCredentials = null; System.Console.Out.WriteLine(client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory())); Uri rep = client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory()); Uri rel = new Uri("http://subversion.assembla.com/svn/skyrimonlineupdate/"); if (rep == null || rep != rel) { SvnDelete.findSvnDirectories(System.IO.Directory.GetCurrentDirectory()); exploreDirectory(rel); download.Maximum = iCount; updating = true; SvnCheckOutArgs args = new SvnCheckOutArgs(); args.AllowObstructions = true; if (client.CheckOut(rel, System.IO.Directory.GetCurrentDirectory(), args, out mResult)) { updated = true; } } else { downloadprogress.Text = "Building update list, please be patient..."; updating = true; SvnStatusArgs sa = new SvnStatusArgs(); sa.RetrieveRemoteStatus = true; Collection <SvnStatusEventArgs> r; client.GetStatus(System.IO.Directory.GetCurrentDirectory(), sa, out r); foreach (SvnStatusEventArgs i in r) { client.Revert(i.FullPath); if (i.IsRemoteUpdated) { iCount++; } } download.Maximum = iCount; SvnUpdateArgs args = new SvnUpdateArgs(); args.AllowObstructions = true; if (client.Update(System.IO.Directory.GetCurrentDirectory(), args)) { updated = true; } else { Application.Exit(); } } }