/// <summary>
        /// Reads gitApi text and gets the latest release version
        /// </summary>
        /// <returns>an int of the latest release version, as a whole number without decimals</returns>
        private string GetLatestVersion()
        {
            var    gitApi        = GitApi.FromJson(AquiredGitApiText);
            string latestRelease = gitApi[0].TagName;

            return(latestRelease);
        }
Example #2
0
        /// <summary>
        /// Download the latest NKHook from the github releases section
        /// </summary>
        public static void DownloadNKH()
        {
            Log.Output("Downloading latest NKHook5...");

            string git_Text = WebHandler.ReadText_FromURL(gitURL);

            if (!Guard.IsStringValid(git_Text))
            {
                Log.Output("Failed to read release info for NKHook5");
                return;
            }

            var gitApi = GitApi.FromJson(git_Text);

            foreach (var a in gitApi)
            {
                foreach (var b in a.Assets)
                {
                    string link = b.BrowserDownloadUrl.ToString();
                    if (!Guard.IsStringValid(link))
                    {
                        continue;
                    }

                    WebHandler.DownloadFile(link, nkhDir);
                }
            }
            Log.Output("NKHook5 successfully downloaded!");
        }
        /// <summary>
        /// Reads gitApi text and gets all of the download urls associated with the latest release
        /// </summary>
        /// <returns>a list of download url strings</returns>
        private List <string> GetDownloadURLs()
        {
            List <string> downloads = new List <string>();
            var           gitApi    = GitApi.FromJson(AquiredGitApiText);

            foreach (var a in gitApi[0].Assets)
            {
                downloads.Add(a.BrowserDownloadUrl.ToString());
            }

            return(downloads);
        }