Ejemplo n.º 1
0
        public void Install()
        {
            var expectedSignature = AppOnlineSignature;
            var appDownloaded     = AppDir.Update.AddPath(expectedSignature.Path);

            BeginInstall?.Invoke();

            if (new SevenZip(silent: false).Extract(appDownloaded, AppDir.Root, _protectedFiles))
            {
                EndInstall?.Invoke();
                writeInstalledVersion(expectedSignature.Path);
                CreateApplicationShortcut(AppDir.Root);
                updateApplicationShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
                Console.WriteLine();

                Console.WriteLine("Upgrade complete!");
                Console.WriteLine("Restart Mtgdb.Gui to enjoy new version immediately :)");
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine($"Failed to extract new version files from {appDownloaded}.");
                Console.WriteLine("I apologize. I hoped it will never happen, but here we are :(");
                Console.WriteLine();
                Console.WriteLine("However you should be able to run the current version normally.");
                Console.WriteLine("If it's not the case you can");
                Console.WriteLine("\t* Re-download and manually install Mtgdb.Gui");
                Console.WriteLine("\t* Report the problem and get help at https://www.slightlymagic.net/forum/viewtopic.php?f=15&t=19298&sid=02dfce1282b368b1b8f40d452ac0af18");
                Console.WriteLine();
            }
        }
Ejemplo n.º 2
0
        public void Install(Action onComplete)
        {
            var expectedSignature = AppOnlineSignature;
            var appDownloaded     = AppDir.Update.Join(expectedSignature.Path);

            BeginInstall?.Invoke();

            if (new SevenZip(silent: false).Extract(appDownloaded, AppDir.Root, _protectedFiles))
            {
                EndInstall?.Invoke();
                writeInstalledVersion(expectedSignature.Path.Value);
                CreateApplicationShortcut(AppDir.Root);
                updateApplicationShortcut(new FsPath(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)));
                Console.WriteLine();

                onComplete?.Invoke();

                Console.WriteLine("Installed version will run next time you start Mtgdb.Gui");
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine($"Failed to extract new version files from {appDownloaded}.");
                Console.WriteLine("It should never happen, but here we are :(");
                Console.WriteLine();
                Console.WriteLine("However you should be able to run the current version normally.");
                Console.WriteLine("If you can't:");
                Console.WriteLine("\t* Re-download and manually install Mtgdb.Gui");
                Console.WriteLine("\t* Report the problem and get help at https://www.slightlymagic.net/forum/viewtopic.php?f=15&t=19298&sid=02dfce1282b368b1b8f40d452ac0af18");
                Console.WriteLine();
            }
        }