diff --git a/NAPS2.Console/NAPS2.Console.csproj b/NAPS2.Console/NAPS2.Console.csproj index e8904d8138..b9bdf045b5 100644 --- a/NAPS2.Console/NAPS2.Console.csproj +++ b/NAPS2.Console/NAPS2.Console.csproj @@ -27,7 +27,7 @@ bin\InstallerEXE\ TRACE;INSTALLER INSTALLER_EXE - true + false pdbonly x86 prompt diff --git a/NAPS2.Console/Program.cs b/NAPS2.Console/Program.cs index 4140e259b5..40309ddde1 100644 --- a/NAPS2.Console/Program.cs +++ b/NAPS2.Console/Program.cs @@ -30,7 +30,7 @@ static class Program [STAThread] static void Main(string[] args) { - ConsoleEntryPoint.Run(args); + typeof(ConsoleEntryPoint).GetMethod("Run").Invoke(null, new object[] { args }); } } } diff --git a/NAPS2.Core/Config/AppConfig.cs b/NAPS2.Core/Config/AppConfig.cs index f90afd7c0f..382b325ed1 100644 --- a/NAPS2.Core/Config/AppConfig.cs +++ b/NAPS2.Core/Config/AppConfig.cs @@ -23,7 +23,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the using System.Linq; using System.Windows.Forms; using NAPS2.Scan; -using NAPS2.Update; namespace NAPS2.Config { @@ -43,8 +42,6 @@ public class AppConfig public ScanProfile DefaultProfileSettings { get; set; } - public AutoUpdateStatus AutoUpdate { get; set; } - public SaveButtonDefaultAction SaveButtonDefaultAction { get; set; } public bool HideEmailButton { get; set; } diff --git a/NAPS2.Core/Config/UserConfig.cs b/NAPS2.Core/Config/UserConfig.cs index ccabe0bf08..d471035f69 100644 --- a/NAPS2.Core/Config/UserConfig.cs +++ b/NAPS2.Core/Config/UserConfig.cs @@ -28,7 +28,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the using NAPS2.Scan; using NAPS2.Scan.Batch; using NAPS2.Scan.Images; -using NAPS2.Update; namespace NAPS2.Config { @@ -49,8 +48,6 @@ public UserConfig() public List FormStates { get; set; } - public AutoUpdateStatus AutoUpdate { get; set; } - public DateTime? LastUpdateCheckDate { get; set; } public bool EnableOcr { get; set; } diff --git a/NAPS2.Core/NAPS2.Core.csproj b/NAPS2.Core/NAPS2.Core.csproj index 68372e4d84..f392f5f81d 100644 --- a/NAPS2.Core/NAPS2.Core.csproj +++ b/NAPS2.Core/NAPS2.Core.csproj @@ -287,24 +287,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/NAPS2.Core/Update/AutoUpdateStatus.cs b/NAPS2.Core/Update/AutoUpdateStatus.cs deleted file mode 100644 index 5d3209e6e5..0000000000 --- a/NAPS2.Core/Update/AutoUpdateStatus.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace NAPS2.Update -{ - public enum AutoUpdateStatus - { - Unspecified, - Enabled, - Disabled - } -} diff --git a/NAPS2.Core/Update/AutoUpdater.cs b/NAPS2.Core/Update/AutoUpdater.cs deleted file mode 100644 index b5b0501191..0000000000 --- a/NAPS2.Core/Update/AutoUpdater.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading.Tasks; - -namespace NAPS2.Update -{ - public class AutoUpdater : IAutoUpdater - { - private readonly ILatestVersionSource latestVersionSource; - private readonly ICurrentVersionSource currentVersionSource; - private readonly IUrlFileDownloader urlFileDownloader; - private readonly Edition edition; - - public AutoUpdater(ILatestVersionSource latestVersionSource, ICurrentVersionSource currentVersionSource, IUrlFileDownloader urlFileDownloader, Edition edition) - { - this.latestVersionSource = latestVersionSource; - this.currentVersionSource = currentVersionSource; - this.urlFileDownloader = urlFileDownloader; - this.edition = edition; - } - - public Task CheckForUpdate() - { - return Task.Factory.StartNew(() => - { - var versionInfos = latestVersionSource.GetLatestVersionInfo().Result; - var currentEditionVersionInfo = versionInfos.Single(x => x.Edition == edition); - return new UpdateInfo - { - HasUpdate = true,//new Version(currentEditionVersionInfo.LatestVersion) > currentVersionSource.GetCurrentVersion(), - VersionInfo = currentEditionVersionInfo - }; - }); - } - - public Task DownloadUpdate(VersionInfo versionInfo, string savePath) - { - return Task.Factory.StartNew(() => - { - // Store to a temp file while downloading - string tempPath = Path.Combine(Paths.Temp, Path.GetRandomFileName()); - - urlFileDownloader.DownloadFile(versionInfo.DownloadUrl, tempPath); - - // Handle the somewhat tricky situation where the file to save to already exists - if (File.Exists(savePath)) - { - // Try overwriting the file, which should work if it isn't locked by another process - try - { - File.Delete(savePath); - } - catch (IOException) - { - File.Delete(tempPath); - return false; - } - } - - // Now that the download is complete, rename/move the temp file - File.Move(tempPath, savePath); - - return true; - }); - } - - public Task InstallUpdate(string installerPath, string arguments = null) - { - return Task.Factory.StartNew(() => - { - if (installerPath == null) - { - throw new ArgumentNullException("installerPath"); - } - var extension = Path.GetExtension(installerPath).ToLowerInvariant(); - if (extension != ".exe" && extension != ".msi") - { - throw new ArgumentException("The installer could not be started because it is not an executable."); - } - var process = new Process - { - StartInfo = - { - FileName = installerPath, - Arguments = arguments ?? "" - } - }; - if (!process.Start()) - { - return false; - } - process.WaitForExit(); - return process.ExitCode == 0; - }); - } - - public Task DownloadAndInstallUpdate(VersionInfo versionInfo) - { - return Task.Factory.StartNew(() => - { - var saveFolder = Path.Combine(Paths.Temp, Path.GetRandomFileName()); - var savePath = Path.Combine(saveFolder, versionInfo.FileName); - Directory.CreateDirectory(saveFolder); - try - { - if (!DownloadUpdate(versionInfo, savePath).Result) - { - return false; - } - if (!InstallUpdate(savePath, versionInfo.InstallArguments).Result) - { - return false; - } - return true; - } - finally - { - Directory.Delete(saveFolder, true); - } - }); - } - } -} diff --git a/NAPS2.Core/Update/AutoUpdaterUI.cs b/NAPS2.Core/Update/AutoUpdaterUI.cs deleted file mode 100644 index f2f3763336..0000000000 --- a/NAPS2.Core/Update/AutoUpdaterUI.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; -using NAPS2.Config; -using NAPS2.Lang.Resources; -using NAPS2.WinForms; - -namespace NAPS2.Update -{ - public class AutoUpdaterUI - { - private static readonly TimeSpan UpdateCheckInterval = TimeSpan.FromDays(0); - - private readonly IUserConfigManager userConfigManager; - private readonly AppConfigManager appConfigManager; - private readonly IAutoUpdater autoUpdater; - private readonly IFormFactory formFactory; - - public AutoUpdaterUI(IUserConfigManager userConfigManager, AppConfigManager appConfigManager, IAutoUpdater autoUpdater, IFormFactory formFactory) - { - this.userConfigManager = userConfigManager; - this.appConfigManager = appConfigManager; - this.autoUpdater = autoUpdater; - this.formFactory = formFactory; - } - - public void OnApplicationStart(IAutoUpdaterClient client) - { - if (userConfigManager.Config.LastUpdateCheckDate == null) - { - userConfigManager.Config.LastUpdateCheckDate = DateTime.Now; - userConfigManager.Save(); - } - if (DateTime.Now - userConfigManager.Config.LastUpdateCheckDate > UpdateCheckInterval) - { - PromptToEnableAutomaticUpdates(); - CheckForUpdate(client); - } - } - - private void PromptToEnableAutomaticUpdates() - { - if (GetAutoUpdateStatus() == AutoUpdateStatus.Unspecified) - { - switch (MessageBox.Show(MiscResources.EnableAutoUpdates, MiscResources.AutoUpdates, MessageBoxButtons.YesNo, MessageBoxIcon.Question)) - { - case DialogResult.Yes: - userConfigManager.Config.AutoUpdate = AutoUpdateStatus.Enabled; - break; - case DialogResult.No: - userConfigManager.Config.AutoUpdate = AutoUpdateStatus.Disabled; - break; - } - userConfigManager.Save(); - } - } - - private void CheckForUpdate(IAutoUpdaterClient client) - { - if (GetAutoUpdateStatus() == AutoUpdateStatus.Enabled) - { - autoUpdater.CheckForUpdate().ContinueWith(updateInfo => - { - if (updateInfo.Result.HasUpdate) - { - client.UpdateAvailable(updateInfo.Result.VersionInfo); - } - }); - } - } - - public void PerformUpdate(IAutoUpdaterClient client, VersionInfo versionInfo) - { - switch (formFactory.Create().ShowDialog()) - { - case DialogResult.Yes: // Install - // TODO: The app process might need to be killed/restarted before/after installing - autoUpdater.DownloadAndInstallUpdate(versionInfo).ContinueWith(result => - { - if (result.Result) - { - client.InstallComplete(); - } - else - { - MessageBox.Show(MiscResources.InstallFailed, MiscResources.InstallFailedTitle, - MessageBoxButtons.OK, MessageBoxIcon.Error); - } - }); - break; - case DialogResult.OK: // Download - var saveDialog = new SaveFileDialog - { - FileName = versionInfo.FileName - }; - if (saveDialog.ShowDialog() == DialogResult.OK) - { - // TODO: Display progress while downloading - autoUpdater.DownloadUpdate(versionInfo, saveDialog.FileName); - } - break; - } - } - - private AutoUpdateStatus GetAutoUpdateStatus() - { - return userConfigManager.Config.AutoUpdate == AutoUpdateStatus.Unspecified - ? appConfigManager.Config.AutoUpdate - : userConfigManager.Config.AutoUpdate; - } - } -} diff --git a/NAPS2.Core/Update/CurrentVersionSource.cs b/NAPS2.Core/Update/CurrentVersionSource.cs deleted file mode 100644 index ec17e927a9..0000000000 --- a/NAPS2.Core/Update/CurrentVersionSource.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace NAPS2.Update -{ - public class CurrentVersionSource : ICurrentVersionSource - { - public Version GetCurrentVersion() - { - return Assembly.GetAssembly(typeof(CurrentVersionSource)).GetName().Version; - } - } -} \ No newline at end of file diff --git a/NAPS2.Core/Update/Edition.cs b/NAPS2.Core/Update/Edition.cs deleted file mode 100644 index 69c000c499..0000000000 --- a/NAPS2.Core/Update/Edition.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace NAPS2.Update -{ - public enum Edition - { - InstallerEXE, - InstallerMSI, - StandaloneZIP, - Standalone7Z - } -} diff --git a/NAPS2.Core/Update/IAutoUpdater.cs b/NAPS2.Core/Update/IAutoUpdater.cs deleted file mode 100644 index 2dfa0218b6..0000000000 --- a/NAPS2.Core/Update/IAutoUpdater.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace NAPS2.Update -{ - public interface IAutoUpdater - { - Task CheckForUpdate(); - Task DownloadUpdate(VersionInfo versionInfo, string savePath); - Task InstallUpdate(string installerPath, string arguments = null); - Task DownloadAndInstallUpdate(VersionInfo versionInfo); - } -} diff --git a/NAPS2.Core/Update/IAutoUpdaterClient.cs b/NAPS2.Core/Update/IAutoUpdaterClient.cs deleted file mode 100644 index fe3b0fdae0..0000000000 --- a/NAPS2.Core/Update/IAutoUpdaterClient.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace NAPS2.Update -{ - public interface IAutoUpdaterClient - { - void UpdateAvailable(VersionInfo versionInfo); - void InstallComplete(); - } -} diff --git a/NAPS2.Core/Update/ICurrentVersionSource.cs b/NAPS2.Core/Update/ICurrentVersionSource.cs deleted file mode 100644 index a1f71e1183..0000000000 --- a/NAPS2.Core/Update/ICurrentVersionSource.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace NAPS2.Update -{ - public interface ICurrentVersionSource - { - Version GetCurrentVersion(); - } -} diff --git a/NAPS2.Core/Update/ILatestVersionSource.cs b/NAPS2.Core/Update/ILatestVersionSource.cs deleted file mode 100644 index fd3bde98d1..0000000000 --- a/NAPS2.Core/Update/ILatestVersionSource.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace NAPS2.Update -{ - public interface ILatestVersionSource - { - Task> GetLatestVersionInfo(); - } -} diff --git a/NAPS2.Core/Update/IUrlFileDownloader.cs b/NAPS2.Core/Update/IUrlFileDownloader.cs deleted file mode 100644 index 1984e6d525..0000000000 --- a/NAPS2.Core/Update/IUrlFileDownloader.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace NAPS2.Update -{ - public interface IUrlFileDownloader - { - void DownloadFile(string url, string targetPath); - } -} diff --git a/NAPS2.Core/Update/IUrlStreamReader.cs b/NAPS2.Core/Update/IUrlStreamReader.cs deleted file mode 100644 index da5c6d29f0..0000000000 --- a/NAPS2.Core/Update/IUrlStreamReader.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace NAPS2.Update -{ - public interface IUrlStreamReader - { - Stream OpenStream(string url); - } -} diff --git a/NAPS2.Core/Update/IUrlTextReader.cs b/NAPS2.Core/Update/IUrlTextReader.cs deleted file mode 100644 index ff1f7e63e8..0000000000 --- a/NAPS2.Core/Update/IUrlTextReader.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace NAPS2.Update -{ - public interface IUrlTextReader - { - string DownloadText(string url); - } -} diff --git a/NAPS2.Core/Update/LatestVersionSource.cs b/NAPS2.Core/Update/LatestVersionSource.cs deleted file mode 100644 index 388b804a72..0000000000 --- a/NAPS2.Core/Update/LatestVersionSource.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Xml.Serialization; - -namespace NAPS2.Update -{ - public class LatestVersionSource : ILatestVersionSource - { - private static readonly Lazy VersionInfoSerializer = - new Lazy(() => new XmlSerializer(typeof(List))); - - private readonly IUrlStreamReader urlStreamReader; - private readonly string versionFileUrl; - - public LatestVersionSource(string versionFileUrl, IUrlStreamReader urlStreamReader) - { - this.versionFileUrl = versionFileUrl; - this.urlStreamReader = urlStreamReader; - } - - public Task> GetLatestVersionInfo() - { - return Task.Factory.StartNew(() => - { - var stream = urlStreamReader.OpenStream(versionFileUrl); - var versionInfos = (List)VersionInfoSerializer.Value.Deserialize(stream); - // Do some post-processing by replacing string arguments ("{0}", "{1}") with the appropriate content - // This is supported so that maintaining version.xml is easier, - // i.e. the version number needs to be changed in fewer places - foreach (var versionInfo in versionInfos) - { - versionInfo.FileName = string.Format(versionInfo.FileName, versionInfo.LatestVersion); - versionInfo.DownloadUrl = string.Format(versionInfo.DownloadUrl, - versionInfo.LatestVersion, versionInfo.FileName); - } - return versionInfos; - }); - } - } -} diff --git a/NAPS2.Core/Update/UpdateInfo.cs b/NAPS2.Core/Update/UpdateInfo.cs deleted file mode 100644 index 0ccecc65c0..0000000000 --- a/NAPS2.Core/Update/UpdateInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace NAPS2.Update -{ - public class UpdateInfo - { - public bool HasUpdate { get; set; } - - public VersionInfo VersionInfo { get; set; } - } -} \ No newline at end of file diff --git a/NAPS2.Core/Update/UrlFileDownloader.cs b/NAPS2.Core/Update/UrlFileDownloader.cs deleted file mode 100644 index 0cd7f6178a..0000000000 --- a/NAPS2.Core/Update/UrlFileDownloader.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace NAPS2.Update -{ - public class UrlFileDownloader : IUrlFileDownloader - { - private readonly IUrlStreamReader urlStreamReader; - - public UrlFileDownloader(IUrlStreamReader urlStreamReader) - { - this.urlStreamReader = urlStreamReader; - } - - public void DownloadFile(string url, string targetPath) - { - using (Stream sourceStream = urlStreamReader.OpenStream(url)) - using (Stream targetStream = new FileStream(targetPath, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None)) - { - sourceStream.CopyTo(targetStream); - } - } - } -} \ No newline at end of file diff --git a/NAPS2.Core/Update/UrlStreamReader.cs b/NAPS2.Core/Update/UrlStreamReader.cs deleted file mode 100644 index d949bf1465..0000000000 --- a/NAPS2.Core/Update/UrlStreamReader.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; - -namespace NAPS2.Update -{ - public class UrlStreamReader : IUrlStreamReader - { - public Stream OpenStream(string url) - { - var req = WebRequest.Create(url); - return req.GetResponse().GetResponseStream(); - } - } -} diff --git a/NAPS2.Core/Update/UrlTextReader.cs b/NAPS2.Core/Update/UrlTextReader.cs deleted file mode 100644 index d9d716f9b3..0000000000 --- a/NAPS2.Core/Update/UrlTextReader.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace NAPS2.Update -{ - public class UrlTextReader : IUrlTextReader - { - private readonly IUrlStreamReader urlStreamReader; - - public UrlTextReader(IUrlStreamReader urlStreamReader) - { - this.urlStreamReader = urlStreamReader; - } - - public string DownloadText(string url) - { - using (var streamReader = new StreamReader(urlStreamReader.OpenStream(url))) - { - return streamReader.ReadToEnd(); - } - } - } -} diff --git a/NAPS2.Core/Update/VersionInfo.cs b/NAPS2.Core/Update/VersionInfo.cs deleted file mode 100644 index f9b5b6f7f0..0000000000 --- a/NAPS2.Core/Update/VersionInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace NAPS2.Update -{ - public class VersionInfo - { - public Edition Edition { get; set; } - - public string LatestVersion { get; set; } - - public string FileName { get; set; } - - public string DownloadUrl { get; set; } - - public string InstallArguments { get; set; } - } -} diff --git a/NAPS2.Core/WinForms/FDesktop.cs b/NAPS2.Core/WinForms/FDesktop.cs index e2fb3c151b..693b991855 100644 --- a/NAPS2.Core/WinForms/FDesktop.cs +++ b/NAPS2.Core/WinForms/FDesktop.cs @@ -48,14 +48,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the using NAPS2.Scan.Exceptions; using NAPS2.Scan.Images; using NAPS2.Scan.Wia; -using NAPS2.Update; using NAPS2.Util; #endregion namespace NAPS2.WinForms { - public partial class FDesktop : FormBase, IAutoUpdaterClient + public partial class FDesktop : FormBase { #region Dependencies @@ -64,7 +63,6 @@ public partial class FDesktop : FormBase, IAutoUpdaterClient private readonly StringWrapper stringWrapper; private readonly AppConfigManager appConfigManager; private readonly RecoveryManager recoveryManager; - private readonly AutoUpdaterUI autoUpdaterUI; private readonly OcrDependencyManager ocrDependencyManager; private readonly IProfileManager profileManager; private readonly IScanPerformer scanPerformer; @@ -95,14 +93,13 @@ public partial class FDesktop : FormBase, IAutoUpdaterClient #region Initialization and Culture - public FDesktop(IEmailer emailer, StringWrapper stringWrapper, AppConfigManager appConfigManager, RecoveryManager recoveryManager, IScannedImageImporter scannedImageImporter, AutoUpdaterUI autoUpdaterUI, OcrDependencyManager ocrDependencyManager, IProfileManager profileManager, IScanPerformer scanPerformer, IScannedImagePrinter scannedImagePrinter, ChangeTracker changeTracker, EmailSettingsContainer emailSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, PdfSettingsContainer pdfSettingsContainer, StillImage stillImage, IOperationFactory operationFactory, IUserConfigManager userConfigManager, KeyboardShortcutManager ksm, ThumbnailRenderer thumbnailRenderer, DialogHelper dialogHelper) + public FDesktop(IEmailer emailer, StringWrapper stringWrapper, AppConfigManager appConfigManager, RecoveryManager recoveryManager, IScannedImageImporter scannedImageImporter, OcrDependencyManager ocrDependencyManager, IProfileManager profileManager, IScanPerformer scanPerformer, IScannedImagePrinter scannedImagePrinter, ChangeTracker changeTracker, EmailSettingsContainer emailSettingsContainer, FileNamePlaceholders fileNamePlaceholders, ImageSettingsContainer imageSettingsContainer, PdfSettingsContainer pdfSettingsContainer, StillImage stillImage, IOperationFactory operationFactory, IUserConfigManager userConfigManager, KeyboardShortcutManager ksm, ThumbnailRenderer thumbnailRenderer, DialogHelper dialogHelper) { this.emailer = emailer; this.stringWrapper = stringWrapper; this.appConfigManager = appConfigManager; this.recoveryManager = recoveryManager; this.scannedImageImporter = scannedImageImporter; - this.autoUpdaterUI = autoUpdaterUI; this.ocrDependencyManager = ocrDependencyManager; this.profileManager = profileManager; this.scanPerformer = scanPerformer; @@ -323,10 +320,6 @@ private void FDesktop_Shown(object sender, EventArgs e) // If NAPS2 was started by the scanner button, do the appropriate actions automatically RunStillImageEvents(); - - // Automatic updates - // Not yet enabled - // autoUpdaterUI.OnApplicationStart(this); } #endregion @@ -1488,29 +1481,6 @@ private void tsReverseSelected_Click(object sender, EventArgs e) #endregion - #region Auto Update - - public void UpdateAvailable(VersionInfo versionInfo) - { - Invoke(() => autoUpdaterUI.PerformUpdate(this, versionInfo)); - } - - public void InstallComplete() - { - Invoke(() => - { - switch (MessageBox.Show(MiscResources.InstallCompletePromptRestart, MiscResources.InstallComplete, MessageBoxButtons.YesNo, MessageBoxIcon.Question)) - { - case DialogResult.Yes: - Close(); // TODO: This close might be canceled. Handle that. - Process.Start(Application.ExecutablePath); - break; - } - }); - } - - #endregion - #region Context Menu private void contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) diff --git a/NAPS2.DI/Modules/CommonModule.cs b/NAPS2.DI/Modules/CommonModule.cs index 61bd12b58b..a70e601bcf 100644 --- a/NAPS2.DI/Modules/CommonModule.cs +++ b/NAPS2.DI/Modules/CommonModule.cs @@ -16,7 +16,6 @@ using NAPS2.Scan.Images; using NAPS2.Scan.Twain; using NAPS2.Scan.Wia; -using NAPS2.Update; using NAPS2.Util; using NAPS2.WinForms; using Ninject.Modules; @@ -58,16 +57,6 @@ public override void Load() Bind().ToSelf().InSingletonScope(); Bind().ToSelf().InSingletonScope(); - // Update - Bind().To(); - Bind().To(); - // TODO: Link to web - Bind().To().WithConstructorArgument("versionFileUrl", "file://" + Path.Combine(Environment.CurrentDirectory, "../../../version.xml")); - Bind().To(); - Bind().To(); - Bind().To(); - Bind().ToConstant(GetEdition()); - // Host Bind().To(); Bind().ToMethod(ctx => X86HostManager.Connect()); @@ -84,21 +73,6 @@ public override void Load() Log.Logger = new NLogLogger(); #if DEBUG Debug.Listeners.Add(new NLogTraceListener()); -#endif - } - - private Edition GetEdition() - { -#if STANDALONE_ZIP - return Edition.StandaloneZIP; -#elif STANDALONE_7Z - return Edition.Standalone7Z; -#elif INSTALLER_EXE - return Edition.InstallerEXE; -#elif INSTALLER_MSI - return Edition.InstallerMSI; -#else // Debug - return Edition.InstallerEXE; #endif } } diff --git a/NAPS2.Portable/NAPS2.Portable.csproj b/NAPS2.Portable/NAPS2.Portable.csproj index 4e7b134a1f..c0570c7c84 100644 --- a/NAPS2.Portable/NAPS2.Portable.csproj +++ b/NAPS2.Portable/NAPS2.Portable.csproj @@ -26,7 +26,7 @@ x86 pdbonly - true + false bin\Release\ TRACE prompt diff --git a/NAPS2.Portable/Program.cs b/NAPS2.Portable/Program.cs index 5441adf872..4a019ed242 100644 --- a/NAPS2.Portable/Program.cs +++ b/NAPS2.Portable/Program.cs @@ -14,7 +14,8 @@ static void Main(string[] args) var portableExeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (portableExeDir != null) { - Process.Start(Path.Combine(portableExeDir, @"App\NAPS2.exe")); + var portableExePath = Path.Combine(portableExeDir, @"App\NAPS2.exe"); + typeof(Process).GetMethod("Start").Invoke(null, new object[] { portableExePath }); } } } diff --git a/NAPS2/NAPS2.csproj b/NAPS2/NAPS2.csproj index c2618f6eba..a6b4bccf47 100644 --- a/NAPS2/NAPS2.csproj +++ b/NAPS2/NAPS2.csproj @@ -67,7 +67,7 @@ bin\InstallerEXE\ TRACE;INSTALLER INSTALLER_EXE - true + false pdbonly x86 prompt @@ -77,7 +77,7 @@ bin\StandaloneZIP\ TRACE;STANDALONE STANDALONE_ZIP - true + false pdbonly x86 prompt diff --git a/NAPS2/Program.cs b/NAPS2/Program.cs index 4708a580e1..954b7ba8c0 100644 --- a/NAPS2/Program.cs +++ b/NAPS2/Program.cs @@ -36,11 +36,11 @@ static void Main(string[] args) { if (args.Contains(X86HostManager.HOST_ARG)) { - X86HostEntryPoint.Run(args); + typeof(X86HostEntryPoint).GetMethod("Run").Invoke(null, new object[] {args}); } else { - WinFormsEntryPoint.Run(args); + typeof(WinFormsEntryPoint).GetMethod("Run").Invoke(null, new object[] { args }); } } } diff --git a/NAPS2_64.Console/NAPS2_64.Console.csproj b/NAPS2_64.Console/NAPS2_64.Console.csproj index 50feb6de6e..69e2b299d5 100644 --- a/NAPS2_64.Console/NAPS2_64.Console.csproj +++ b/NAPS2_64.Console/NAPS2_64.Console.csproj @@ -26,7 +26,7 @@ x64 pdbonly - true + false bin\Release\ TRACE prompt diff --git a/NAPS2_64.Console/Program.cs b/NAPS2_64.Console/Program.cs index d6c393bb46..d616426a0b 100644 --- a/NAPS2_64.Console/Program.cs +++ b/NAPS2_64.Console/Program.cs @@ -30,7 +30,7 @@ static class Program [STAThread] static void Main(string[] args) { - ConsoleEntryPoint.Run(args); + typeof(ConsoleEntryPoint).GetMethod("Run").Invoke(null, new object[] { args }); } } } diff --git a/NAPS2_64/NAPS2_64.csproj b/NAPS2_64/NAPS2_64.csproj index 862cc2258d..a9ac096391 100644 --- a/NAPS2_64/NAPS2_64.csproj +++ b/NAPS2_64/NAPS2_64.csproj @@ -26,7 +26,7 @@ x64 pdbonly - true + false bin\Release\ TRACE prompt diff --git a/NAPS2_64/Program.cs b/NAPS2_64/Program.cs index 69fe10348d..5ee9fa7218 100644 --- a/NAPS2_64/Program.cs +++ b/NAPS2_64/Program.cs @@ -33,7 +33,7 @@ static class Program [STAThread] static void Main(string[] args) { - WinFormsEntryPoint.Run(args); + typeof(WinFormsEntryPoint).GetMethod("Run").Invoke(null, new object[] { args }); } } }