コード例 #1
0
ファイル: UpdateNotifyForm.cs プロジェクト: wbSD/evemon
        /// <summary>
        /// Downloads the update.
        /// </summary>
        private bool DownloadUpdate()
        {
            string filename = Path.GetFileName(m_args.InstallerUrl.AbsoluteUri);

            if (String.IsNullOrWhiteSpace(filename))
            {
                return(false);
            }

            string localFilename = Path.Combine(EveMonClient.EVEMonDataDir, filename);

            // If the file already exists delete it
            if (File.Exists(localFilename))
            {
                UpdateManager.DeleteInstallationFiles();
            }

            using (UpdateDownloadForm form = new UpdateDownloadForm(m_args.InstallerUrl, localFilename))
            {
                if (m_formClosing || form.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }

                string downloadedFileMD5Sum = Util.CreateMD5From(localFilename);
                if (m_args.MD5Sum != null && m_args.MD5Sum != downloadedFileMD5Sum)
                {
                    return(false);
                }

                UpdateManager.DeleteDataFiles();
                ExecutePatcher(localFilename, m_args.AutoInstallArguments);
                DialogResult = DialogResult.OK;
            }
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Downloads the update.
        /// </summary>
        private bool DownloadUpdate()
        {
            string filename = Path.GetFileName(m_args.InstallerUrl.AbsoluteUri);
            if (String.IsNullOrWhiteSpace(filename))
                return false;

            string localFilename = Path.Combine(EveMonClient.EVEMonDataDir, filename);

            // If the file already exists delete it
            if (File.Exists(localFilename))
                UpdateManager.DeleteInstallationFiles();

            using (UpdateDownloadForm form = new UpdateDownloadForm(m_args.InstallerUrl, localFilename))
            {
                if (m_formClosing || form.ShowDialog() != DialogResult.OK)
                    return false;

                string downloadedFileMD5Sum = Util.CreateMD5From(localFilename);
                if (m_args.MD5Sum != null && m_args.MD5Sum != downloadedFileMD5Sum)
                    return false;

                UpdateManager.DeleteDataFiles();
                ExecutePatcher(localFilename, m_args.AutoInstallArguments);
                DialogResult = DialogResult.OK;
            }
            return true;
        }