diff --git a/VPUpdater/DownloadForm.cs b/VPUpdater/DownloadForm.cs index 6d79d71..367aa85 100644 --- a/VPUpdater/DownloadForm.cs +++ b/VPUpdater/DownloadForm.cs @@ -13,11 +13,7 @@ namespace VPUpdater #region Using Directives using System; - using System.ComponentModel; - using System.Diagnostics; - using System.IO; using System.Net; - using System.Threading.Tasks; using System.Windows.Forms; using Properties; using Version = SemVer.Version; @@ -31,9 +27,7 @@ public partial class DownloadForm : Form { #region Fields - private string setupTempFile = ""; private readonly string[] commandLineArgs; - private readonly WebClient client = new WebClient(); private readonly Updater updater; private readonly VirtualParadise virtualParadise; @@ -51,7 +45,7 @@ public DownloadForm(string[] args) // Store CLI args as DI to pass to VP this.commandLineArgs = args; this.virtualParadise = VirtualParadise.GetCurrent(); - this.updater = new Updater(this.virtualParadise); + this.updater = new Updater(); } #endregion @@ -96,15 +90,6 @@ private void ButtonCancel_Click(object sender, EventArgs e) Environment.Exit(0); } - /// - /// Checks for a Virtual Paradise update. - /// - /// Returns if the there is an updated and the user accepted, otherwise. - private async Task CheckForUpdates() - { - return await this.updater.FetchLatest(); - } - /// /// Called when the form first loads. /// diff --git a/VPUpdater/Program.cs b/VPUpdater/Program.cs index 55bfe4a..4a59447 100644 --- a/VPUpdater/Program.cs +++ b/VPUpdater/Program.cs @@ -10,10 +10,14 @@ namespace VPUpdater { + #region Using Directives + using System; using System.Linq; using System.Windows.Forms; + #endregion + /// /// Application entry class. /// diff --git a/VPUpdater/Updater.cs b/VPUpdater/Updater.cs index d9c424d..b60ca09 100644 --- a/VPUpdater/Updater.cs +++ b/VPUpdater/Updater.cs @@ -19,10 +19,8 @@ namespace VPUpdater using System.Net; using System.Text.RegularExpressions; using System.Threading.Tasks; - using System.Windows.Forms; using AngleSharp; using AngleSharp.Dom; - using AngleSharp.Io; using Properties; using SemVer = SemVer.Version; @@ -35,11 +33,6 @@ public class Updater : IDisposable { #region Fields - /// - /// The instance. - /// - private readonly VirtualParadise virtualParadise; - /// /// The web client instance. /// @@ -52,19 +45,6 @@ public class Updater : IDisposable #endregion - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The instance. - public Updater(VirtualParadise virtualParadise) - { - this.virtualParadise = virtualParadise; - } - - #endregion - #region Events /// @@ -79,16 +59,12 @@ public Updater(VirtualParadise virtualParadise) /// /// Cancels any updates in progress. /// - public void Cancel() - { + public void Cancel() => this.webClient?.CancelAsync(); - } /// - public void Dispose() - { + public void Dispose() => this.webClient?.Dispose(); - } /// /// Downloads the link to the latest @@ -173,7 +149,8 @@ public async Task Launch() { if (!File.Exists(this.setupPath)) { - throw new FileNotFoundException(String.Format(Resources.FileNotFound, Path.GetFileName(this.setupPath))); + throw new FileNotFoundException( + String.Format(Resources.FileNotFound, Path.GetFileName(this.setupPath))); } await Task.Run(() => diff --git a/VPUpdater/VirtualParadise.cs b/VPUpdater/VirtualParadise.cs index ffbd0ca..c51c391 100644 --- a/VPUpdater/VirtualParadise.cs +++ b/VPUpdater/VirtualParadise.cs @@ -122,10 +122,8 @@ private static SemVer GetSemVerFromSystemVersion(SysVer version) => /// Launches Virtual Paradise. /// /// The command-line arguments. - public void Launch(params string[] args) - { + public void Launch(params string[] args) => Process.Start(this.FileInfo.FullName, String.Join(" ", args)); - } #endregion }