Ejemplo n.º 1
0
        private static void StartUpdate(XmlDocument xmlContent)
        {
            string  url            = xmlContent.SelectSingleNode(@"/VersionInfo/Url/text()").Value;
            Version updaterVersion = new Version(xmlContent.SelectSingleNode(@"/VersionInfo/UpdaterVersion/text()").Value);

            string baseDir = $"{System.Environment.CurrentDirectory}\\";

            taskFiles.Clear();
            if (!File.Exists($"{baseDir}BFUpdater.exe") || CompareVersion(GetFileVersion($"{baseDir}BFUpdater.exe"), updaterVersion))
            {
                DownloadFile(taskFiles, $"{baseUrl}BFUpdater.exe", baseDir);
            }
            DownloadFile(taskFiles, url, baseDir);
            downloadProgressBar          = new DownloadProgressBar(taskFiles, "正在下載更新...", baseDir, true);
            downloadProgressBar.Closing += DownloadProgressBar_Closing;
            downloadProgressBar.ShowDialog();
        }