Exemplo n.º 1
0
 private static GithubRelease.Asset GetAssetMatchingRunningVersion(List <GithubRelease.Asset> assets)
 {
     GithubRelease.Asset releaseAsset = null;
     if (DragonUtil.IsRunningPortable())
     {
         Console.WriteLine("Portable version");
         releaseAsset = assets.Find(asset => asset.name.Contains("Portable"));
     }
     else
     {
         if (DragonUtil.CurrentOperatingSystem.IsWindows())
         {
             releaseAsset = assets.Find(asset => asset.name.Contains("Windows"));
         }
         else if (DragonUtil.CurrentOperatingSystem.IsMacOS())
         {
             releaseAsset = assets.Find(asset => asset.name.Contains("macOS"));
         }
         else if (DragonUtil.CurrentOperatingSystem.IsLinux())
         {
             releaseAsset = assets.Find(asset => asset.name.Contains("linux"));
         }
     }
     return(releaseAsset);
 }
Exemplo n.º 2
0
        private static void RunCoreUpdater(string updaterFolder, string zipPath)
        {
            Console.WriteLine("Starting updater process...");

            ProcessStartInfo processInfo = new ProcessStartInfo()
            {
                ErrorDialog     = true,
                UseShellExecute = true
            };

            if (DragonUtil.IsRunningPortable())
            {
                processInfo.FileName = "dotnet";
                //processInfo.Arguments = "dotnet'";
                processInfo.Arguments += DragonUtil.SurroundWithQuotes(updaterFolder + "/CoreUpdater.dll");
            }
            else
            {
                if (DragonUtil.CurrentOperatingSystem.IsWindows())
                {
                    processInfo.FileName = DragonUtil.SurroundWithQuotes(updaterFolder + "/CoreUpdater.exe");
                }
                else if (DragonUtil.CurrentOperatingSystem.IsMacOS())
                {
                    processInfo.FileName = DragonUtil.SurroundWithQuotes(updaterFolder + "/CoreUpdater");
                }
                else if (DragonUtil.CurrentOperatingSystem.IsLinux())
                {
                    processInfo.FileName = DragonUtil.SurroundWithQuotes(updaterFolder + "/CoreUpdater");
                }
            }

            processInfo.Arguments += " " + DragonUtil.SurroundWithQuotes(DragonUtil.CurrentDirectory) + " " +
                                     DragonUtil.SurroundWithQuotes(zipPath);

            Console.WriteLine(processInfo.FileName + processInfo.Arguments);

            Process process = new Process {
                StartInfo = processInfo
            };

            process.Start();
        }