diff --git a/Artemis/Artemis/App.xaml.cs b/Artemis/Artemis/App.xaml.cs index 7b5f4dc88..31558776a 100644 --- a/Artemis/Artemis/App.xaml.cs +++ b/Artemis/Artemis/App.xaml.cs @@ -1,8 +1,6 @@ using System; -using System.Security.Principal; using System.Windows; using System.Windows.Threading; -using Artemis.Utilities; using NLog; using WpfExceptionViewer; @@ -13,28 +11,25 @@ namespace Artemis /// public partial class App : Application { - protected override void OnExit(ExitEventArgs e) - { - base.OnExit(e); - Environment.Exit(0); - } - public App() { - if (!IsRunAsAdministrator()) - GeneralHelpers.RunAsAdministrator(); - + //using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/SpoinkyNL/Artemis")) + //using (var mgr = new UpdateManager("C:\\Users\\Robert\\Desktop\\Artemis builds\\squirrel_test")) + //{ + // SquirrelAwareApp.HandleEvents( + // onInitialInstall: v => mgr.CreateShortcutForThisExe(), + // onAppUpdate: v => Updater.AppUpdate(mgr), + // onAppUninstall: v => Updater.AppUninstall(mgr)); + //} InitializeComponent(); } public bool DoHandle { get; set; } - private static bool IsRunAsAdministrator() + protected override void OnExit(ExitEventArgs e) { - var wi = WindowsIdentity.GetCurrent(); - var wp = new WindowsPrincipal(wi); - - return wp.IsInRole(WindowsBuiltInRole.Administrator); + base.OnExit(e); + Environment.Exit(0); } private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) diff --git a/Artemis/Artemis/Artemis base layout.png b/Artemis/Artemis/Artemis base layout.png deleted file mode 100644 index 62a7a4972..000000000 Binary files a/Artemis/Artemis/Artemis base layout.png and /dev/null differ diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj index 65678f065..7294ccc2d 100644 --- a/Artemis/Artemis/Artemis.csproj +++ b/Artemis/Artemis/Artemis.csproj @@ -39,8 +39,8 @@ https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-%28FAQ%29 Artemis Artemis - 1 - 1.2.3.1 + 0 + 1.3.0.0 false true true @@ -73,7 +73,7 @@ Artemis_TemporaryKey.pfx - true + false false @@ -120,6 +120,12 @@ true + + app.manifest + + + LocalIntranet + ..\packages\Caliburn.Micro.Core.3.0.1\lib\net45\Caliburn.Micro.dll @@ -628,6 +634,9 @@ + + Designer + Designer diff --git a/Artemis/Artemis/ArtemisBootstrapper.cs b/Artemis/Artemis/ArtemisBootstrapper.cs index 2a67236ec..26b781a71 100644 --- a/Artemis/Artemis/ArtemisBootstrapper.cs +++ b/Artemis/Artemis/ArtemisBootstrapper.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Security.Principal; using System.Windows; using System.Windows.Controls; using System.Windows.Input; @@ -12,6 +13,7 @@ using Artemis.ViewModels; using Caliburn.Micro; using Newtonsoft.Json; using Ninject; +using LogManager = NLog.LogManager; namespace Artemis { diff --git a/Artemis/Artemis/DeviceProviders/Logitech/LogitechKeyboard.cs b/Artemis/Artemis/DeviceProviders/Logitech/LogitechKeyboard.cs index 8ad21c937..7f1d13af4 100644 --- a/Artemis/Artemis/DeviceProviders/Logitech/LogitechKeyboard.cs +++ b/Artemis/Artemis/DeviceProviders/Logitech/LogitechKeyboard.cs @@ -49,10 +49,7 @@ namespace Artemis.DeviceProviders.Logitech "Artemis couldn't enable your Logitech keyboard, because the required files are not in place.\n\n" + "This happens when you run The Division and shut down Artemis before shutting down The Division\n" + "It can be fixed automatically by clicking OK, but to avoid this message in the future please\n" + - "shut down The Division before shutting down Artemis.\n\n" + - "Click OK to fix the issue and restart Artemis"); - - GeneralHelpers.RunAsAdministrator(); + "shut down The Division before shutting down Artemis."); } public override void Enable() diff --git a/Artemis/Artemis/MainWindow.xaml b/Artemis/Artemis/MainWindow.xaml deleted file mode 100644 index 57671ae01..000000000 --- a/Artemis/Artemis/MainWindow.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/Artemis/Artemis/MainWindow.xaml.cs b/Artemis/Artemis/MainWindow.xaml.cs deleted file mode 100644 index 2598c1727..000000000 --- a/Artemis/Artemis/MainWindow.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Artemis -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - } -} diff --git a/Artemis/Artemis/Properties/AssemblyInfo.cs b/Artemis/Artemis/Properties/AssemblyInfo.cs index 07562953c..44852e01a 100644 --- a/Artemis/Artemis/Properties/AssemblyInfo.cs +++ b/Artemis/Artemis/Properties/AssemblyInfo.cs @@ -52,6 +52,6 @@ using System.Windows; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.0.1")] -[assembly: AssemblyFileVersion("1.3.0.1")] -[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] \ No newline at end of file +[assembly: AssemblyVersion("1.3.0.2")] +[assembly: AssemblyFileVersion("1.3.0.2")] +//[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] \ No newline at end of file diff --git a/Artemis/Artemis/Properties/Settings.Designer.cs b/Artemis/Artemis/Properties/Settings.Designer.cs deleted file mode 100644 index d3025f88a..000000000 --- a/Artemis/Artemis/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Artemis.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/Artemis/Artemis/Properties/Settings.settings b/Artemis/Artemis/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9..000000000 --- a/Artemis/Artemis/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Artemis/Artemis/Utilities/GeneralHelpers.cs b/Artemis/Artemis/Utilities/GeneralHelpers.cs index 10f8e65e2..7abdbe71f 100644 --- a/Artemis/Artemis/Utilities/GeneralHelpers.cs +++ b/Artemis/Artemis/Utilities/GeneralHelpers.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Reflection; using System.Text.RegularExpressions; -using System.Windows; using Microsoft.Win32; using Newtonsoft.Json; using static System.String; @@ -13,31 +11,6 @@ namespace Artemis.Utilities { public static class GeneralHelpers { - public static void RunAsAdministrator() - { - var processInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase) - { - UseShellExecute = true, - Verb = "runas" - }; - - // The following properties run the new process as administrator - - // Start the new process - try - { - System.Diagnostics.Process.Start(processInfo); - } - catch (Exception) - { - // The user did not allow the application to run as administrator - MessageBox.Show("Sorry, this application must be run as Administrator."); - } - - // Shut down the current process - Environment.Exit(0); - } - /// /// Perform a deep Copy of the object, using Json as a serialisation method. /// @@ -61,7 +34,7 @@ namespace Artemis.Utilities return null; var value = prop.GetValue(o, null); - if (propertyNames.Length == 1 || value == null) + if ((propertyNames.Length == 1) || (value == null)) return value; return GetPropertyValue(value, path.Replace(propertyNames[0] + ".", "")); } diff --git a/Artemis/Artemis/Utilities/Updater.cs b/Artemis/Artemis/Utilities/Updater.cs index ff71ee0c8..974560de5 100644 --- a/Artemis/Artemis/Utilities/Updater.cs +++ b/Artemis/Artemis/Utilities/Updater.cs @@ -6,46 +6,45 @@ using Artemis.DAL; using Artemis.Settings; using Artemis.Utilities.Memory; using Newtonsoft.Json; +using NLog; using Squirrel; namespace Artemis.Utilities { public static class Updater { + private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); + public static async void UpdateApp() { // Only update if the user allows it if (!SettingsProvider.Load().AutoUpdate) return; + _logger.Info("Checking for updates..."); // TODO: Remove prerelease before releasing - // using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/SpoinkyNL/Artemis", null, null, null,true)) - // { - // // Replace / remove the autorun shortcut - // SquirrelAwareApp.HandleEvents(onAppUpdate: v => AppUpdate(mgr.Result), - // onAppUninstall: v => AppUninstall(mgr.Result)); - // - // await mgr.Result.UpdateApp(); - // } + //using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/SpoinkyNL/Artemis", null, null, null, true)) + //{ + // await mgr.Result.UpdateApp(); + //} using (var mgr = new UpdateManager("C:\\Users\\Robert\\Desktop\\Artemis builds\\squirrel_test")) { - // Replace / remove the autorun shortcut - SquirrelAwareApp.HandleEvents(onAppUpdate: v => AppUpdate(mgr), onAppUninstall: v => AppUninstall(mgr)); - await mgr.UpdateApp(); } } - private static void AppUpdate(IUpdateManager mgr) + public static void AppUpdate(IUpdateManager mgr) { + _logger.Info("Running AppUpdate"); var settings = new GeneralSettings(); settings.ApplyAutorun(); mgr.CreateShortcutForThisExe(); } - private static void AppUninstall(IUpdateManager mgr) + public static void AppUninstall(IUpdateManager mgr) { + _logger.Info("Running AppUninstall"); // Use GeneralSettings to get rid of the autorun shortcut var fakeSettings = new GeneralSettings {Autorun = false}; fakeSettings.ApplyAutorun(); diff --git a/Artemis/Artemis/app.manifest b/Artemis/Artemis/app.manifest new file mode 100644 index 000000000..6749486d1 --- /dev/null +++ b/Artemis/Artemis/app.manifest @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Artemis/Artemis/logo-disabled.ico b/Artemis/Artemis/logo-disabled.ico deleted file mode 100644 index da8f0f275..000000000 Binary files a/Artemis/Artemis/logo-disabled.ico and /dev/null differ