예제 #1
0
        /// <summary>
        /// Downloads the updates.
        /// </summary>
        private void DownloadUpdates()
        {
            List <SerializableDatafile> datafiles = new List <SerializableDatafile>();

            // Copy the new datafiles to a new list
            datafiles.AddRange(m_args.ChangedFiles);

            // Show the download dialog, which will download the files
            using (DataUpdateDownloadForm form = new DataUpdateDownloadForm(datafiles))
            {
                form.ShowDialog();
            }

            foreach (SerializableDatafile versionDatafile in datafiles.Where(datafile => datafile.IsDownloaded))
            {
                string oldFilename  = Path.Combine(EveMonClient.EVEMonDataDir, versionDatafile.Name);
                string tempFilename = $"{oldFilename}.tmp";

                Datafile downloadedDatafile = new Datafile(Path.GetFileName(tempFilename));

                if (versionDatafile.MD5Sum != null && versionDatafile.MD5Sum != downloadedDatafile.MD5Sum)
                {
                    FileHelper.DeleteFile(tempFilename);
                    continue;
                }

                UpdateManager.ReplaceDatafile(oldFilename, tempFilename);
                m_args.ChangedFiles.Remove(versionDatafile);
            }
        }
예제 #2
0
        /// <summary>
        /// Downloads the updates.
        /// </summary>
        private void DownloadUpdates()
        {
            List<SerializableDatafile> datafiles = new List<SerializableDatafile>();

            // Copy the new datafiles to a new list
            datafiles.AddRange(m_args.ChangedFiles);

            // Show the download dialog, which will download the files
            using (DataUpdateDownloadForm form = new DataUpdateDownloadForm(datafiles))
            {
                form.ShowDialog();
            }

            foreach (SerializableDatafile versionDatafile in datafiles.Where(datafile => datafile.IsDownloaded))
            {
                string oldFilename = Path.Combine(EveMonClient.EVEMonDataDir, versionDatafile.Name);
                string tempFilename = $"{oldFilename}.tmp";

                Datafile downloadedDatafile = new Datafile(Path.GetFileName(tempFilename));

                if (versionDatafile.MD5Sum != null && versionDatafile.MD5Sum != downloadedDatafile.MD5Sum)
                {
                    FileHelper.DeleteFile(tempFilename);
                    continue;
                }

                UpdateManager.ReplaceDatafile(oldFilename, tempFilename);
                m_args.ChangedFiles.Remove(versionDatafile);
            }
        }