public static void UpdateApp(GitReleaseInfo releaseInfo)
        {
            var tempFolderName = DownloadNewVersionApp(releaseInfo);
            var psScriptPath   = GetPsScriptPath();

            ReplaceAppFiles(releaseInfo, tempFolderName, psScriptPath);
        }
        internal static string GetPsArguments(GitReleaseInfo releaseInfo, string tempFolderPath, string tempScriptPath)
        {
            var currentDirectory = Directory.GetCurrentDirectory();
            var currentProcess   = Process.GetCurrentProcess();

            return
                ($"-ExecutionPolicy bypass -File {tempScriptPath} -ProcessName \"{currentProcess.ProcessName}\" -AppFolder \"{currentDirectory}\" -TempAppFolder \"{tempFolderPath}\" -NewVersionId {releaseInfo.Id}");
        }
        public static void ReplaceAppFiles(GitReleaseInfo releaseInfo, string tempFolderName, string tempScriptPath)
        {
            var psi = new ProcessStartInfo {
                FileName  = "powershell.exe",
                Arguments = GetPsArguments(releaseInfo, tempFolderName, tempScriptPath)
            };

            Process.Start(psi);
        }
        public static string DownloadNewVersionApp(GitReleaseInfo releaseInfo)
        {
            var fileInfo = releaseInfo.Assets.FirstOrDefault();

            if (fileInfo == null)
            {
                throw new NullReferenceException(nameof(releaseInfo.Assets));
            }
            var file           = NetworkUtilities.DownloadFileFromUrl(fileInfo.DownloadUrl);
            var tempFolderName = $"{Path.GetTempPath()}\\{Path.GetRandomFileName()}";

            FileUtilities.UnZip(file, tempFolderName);
            return(tempFolderName);
        }