Beispiel #1
0
        public static void ApplyUpdateIfNeccessary()
        {
            var thisLocation           = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var pendingUpdateDirectory = Path.Combine(thisLocation, DownloadAndExtracter.PENDING_UPDATE_DIRECTORYNAME);

            if (Directory.Exists(pendingUpdateDirectory))
            {
                var tempDir = DownloadAndExtracter.GetTempPath() + Guid.NewGuid();
                Directory.CreateDirectory(tempDir);
                CopyAllFiles(pendingUpdateDirectory, tempDir);
                var p = new Process()
                {
                    StartInfo = new ProcessStartInfo()
                    {
                        CreateNoWindow   = false,
                        UseShellExecute  = true,
                        Arguments        = "\"" + thisLocation + "\"",
                        WorkingDirectory = tempDir,
                        FileName         = Path.Combine(tempDir, "DayZCommanderUpdater.exe")
                    }
                };
                p.Start();
                Environment.Exit(0);
            }
        }
        private void VersionCheckComplete(object sender, VersionCheckCompleteEventArgs args)
        {
            LatestVersion = args.Version;

            if (args.IsNew)
            {
                var extracter = new DownloadAndExtracter(args.Version);
                extracter.ExtractComplete += ExtractComplete;
                extracter.DownloadAndExtract();
                Status = STATUS_DOWNLOADING;
            }
            else
            {
                Status = STATUS_UPTODATE;
            }
        }