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

            // Copy the list of datafiles
            m_args.ChangedFiles.ForEach(x => datafiles.Add(x));

            foreach (var dfv in datafiles)
            {
                // Work out the new names of the files
                string urn         = String.Format(CultureConstants.DefaultCulture, "{0}/{1}", dfv.Url, dfv.Name);
                string oldFilename = Path.Combine(EveClient.EVEMonDataDir, dfv.Name);
                string newFilename = String.Format(CultureConstants.DefaultCulture, "{0}.tmp", oldFilename);

                // If the file already exists delete it
                if (File.Exists(newFilename))
                {
                    File.Delete(newFilename);
                }

                // Show the download dialog, which will download the file
                using (UpdateDownloadForm f = new UpdateDownloadForm(urn, newFilename))
                {
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        string   filename = Path.GetFileName(newFilename);
                        Datafile datafile = new Datafile(filename);

                        if (datafile.MD5Sum != dfv.MD5Sum)
                        {
                            File.Delete(newFilename);
                            continue;
                        }

                        ReplaceDatafile(oldFilename, newFilename);
                        m_args.ChangedFiles.Remove(dfv);
                    }
                }
            }
        }
Esempio n. 2
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (cbAutoInstall.Enabled && cbAutoInstall.Checked)
     {
         Uri    updateURI     = new Uri(m_args.AutoInstallUrl);
         string localFilename = Path.Combine(EveClient.EVEMonDataDir, Path.GetFileName(updateURI.AbsolutePath));
         using (UpdateDownloadForm f = new UpdateDownloadForm(m_args.AutoInstallUrl, localFilename))
         {
             f.ShowDialog();
             if (f.DialogResult == DialogResult.OK)
             {
                 ExecPatcher(localFilename, m_args.AutoInstallArguments);
             }
         }
     }
     else
     {
         Process.Start(m_args.UpdateUrl);
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Esempio n. 3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            foreach (DatafileVersion dfv in m_args.ChangedFiles)
            {
                string urn         = String.Format(CultureInfo.CurrentCulture, "{0}/{1}", dfv.Url, dfv.Name);
                string oldFilename = Path.Combine(EveClient.EVEMonDataDir, dfv.Name);

                string newFilename = String.Format(CultureInfo.CurrentCulture, "{0}.tmp", oldFilename);
                File.Delete(newFilename);
                using (UpdateDownloadForm f = new UpdateDownloadForm(urn, newFilename))
                {
                    f.ShowDialog();
                    if (f.DialogResult == DialogResult.OK)
                    {
                        try
                        {
                            File.Delete(oldFilename + ".bak");
                            File.Copy(oldFilename, oldFilename + ".bak");
                            File.Delete(oldFilename);
                            File.Move(newFilename, oldFilename);
                        }
                        catch (IOException ex)
                        {
                            ExceptionHandler.LogException(ex, true);
                        }
                        // download, patch and update settings MD5.
                    }
                }
            }
            EveClient.Datafiles.Refresh();
            Settings.SaveImmediate();

            MessageBox.Show("Your datafiles have been updated. Please restart EVEMon for them to take effect.", "Data Files Updated", MessageBoxButtons.OK);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        /// <summary>
        /// Downloads the updates.
        /// </summary>
        private void DownloadUpdates()
        {
            List<SerializableDatafile> datafiles = new List<SerializableDatafile>();

            // Copy the list of datafiles
            m_args.ChangedFiles.ForEach(x => datafiles.Add(x));

            foreach (var dfv in datafiles)
            {
                // Work out the new names of the files
                string urn = String.Format(CultureConstants.DefaultCulture, "{0}/{1}", dfv.Url, dfv.Name);
                string oldFilename = Path.Combine(EveClient.EVEMonDataDir, dfv.Name);
                string newFilename = String.Format(CultureConstants.DefaultCulture, "{0}.tmp", oldFilename);

                // If the file already exists delete it
                if (File.Exists(newFilename))
                    File.Delete(newFilename);

                // Show the download dialog, which will download the file
                using (UpdateDownloadForm f = new UpdateDownloadForm(urn, newFilename))
                {
                    if (f.ShowDialog() == DialogResult.OK)
                    {
                        string filename = Path.GetFileName(newFilename);
                        Datafile datafile = new Datafile(filename);

                        if (datafile.MD5Sum != dfv.MD5Sum)
                        {
                            File.Delete(newFilename);
                            continue;
                        }

                        ReplaceDatafile(oldFilename, newFilename);
                        m_args.ChangedFiles.Remove(dfv);
                    }
                }
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Occurs on "update" button click.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (cbAutoInstall.Enabled && cbAutoInstall.Checked)
     {
         Uri updateURI = new Uri(m_args.InstallerUrl);
         string localFilename = Path.Combine(EveClient.EVEMonDataDir, Path.GetFileName(updateURI.AbsolutePath));
         using (UpdateDownloadForm f = new UpdateDownloadForm(m_args.InstallerUrl, localFilename))
         {
             f.ShowDialog();
             if (f.DialogResult == DialogResult.OK)
             {
                 ExecPatcher(localFilename, m_args.AutoInstallArguments);
             }
         }
     }
     else
     {
         Process.Start(m_args.ForumUrl);
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }