コード例 #1
0
 private async void Download()
 {
     try
     {
         StatusText.Text = "Starting downloader...";
         DFInstall dfi = DFInstall.ParseXml(StaticMemory.Args[1]);
         if (dfi == null)
         {
             return;
         }
         Core.Xml.DarkFrontier darkfile = Core.ServerRequest.GetDarkFrontier(dfi.ServerUrl);
         if (darkfile == null)
         {
             return;
         }
         dl = new Downloader(StatusText, dfi.ProductName);
         await(StaticMemory.DownloadFile = dl.DownloadFile(darkfile.Filename, darkfile.DownloadUrl));
         if (StaticMemory.Errored)
         {
             return;
         }
         StatusText.Text = "Copying the DarkFrontier";
         File.Copy(Assembly.GetExecutingAssembly().Location, TempController.GeneratedDir.FullName + "/update.exe");
         StatusText.Text = "Executing DarkFrontier";
         MainWindow.Instance.TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;
         Process  proc = new Process();
         DFUnpack dfu  = new DFUnpack(TempController.InstallId, darkfile.Filename, dfi.InstallPath, darkfile.DFPath);
         proc.StartInfo.Arguments = "unpack \"" + DFUnpack.ToString(dfu) + "\"";
         Debug.WriteLine("Using unpack: " + DFUnpack.ToString(dfu));
         proc.StartInfo.UseShellExecute = true;
         proc.StartInfo.FileName        = TempController.GeneratedDir.FullName + "/update.exe";
         Debug.WriteLine("Executable in " + TempController.GeneratedDir.FullName + "/update.exe");
         proc.StartInfo.Verb = "runas";
         Notify.Dispose();
         Debug.WriteLine("Process started? " + (proc.Start() ? "yes" : "no"));
         Application.Current.Shutdown(ExitCode.Unpacking);
     }
     catch (Exception e)
     {
         Debug.WriteLine("Exception: " + e.Message);
         Application.Current.Shutdown(ExitCode.InternalError);
         return;
     }
 }
コード例 #2
0
        public MainTest()
        {
            DFTest dft = ParseXml(StaticMemory.Args[1]);

            if (dft == null)
            {
                return;
            }
            Core.Xml.DarkFrontier dfr = ServerRequest.GetDarkFrontier(dft.ServerUrl);
            if (dfr == null)
            {
                return;
            }
            if (Versioner.Test(dfr.Version, dft.Version))
            {
                Application.Current.Shutdown(ExitCode.Updated);
            }
            else
            {
                Application.Current.Shutdown(ExitCode.Outdated);
            }
        }