/// <summary> /// Parses gitApi text and gets the latest release version of the program the gitApi text is for /// </summary> /// <param name="aquiredGitText">The text that was successfully read from github</param> /// <returns>an int of the latest release version, as a whole number without decimals</returns> public static string GetLatestVersion(string aquiredGitText) { var gitApi = GithubReleaseConfig.FromJson(aquiredGitText); string latestRelease = gitApi[0].TagName; return(latestRelease); }
private void GetCurrentAndLatestVersion(List <GithubReleaseConfig> githubReleaseConfigs, out string latestGitVersion, out string currentVersion) { LatestReleaseInfo = githubReleaseConfigs[0]; latestGitVersion = LatestReleaseInfo.TagName; currentVersion = GetCurrentVersion(); CleanVersionTexts(latestGitVersion, currentVersion, out latestGitVersion, out currentVersion); }
private bool IsUpdate(List <GithubReleaseConfig> githubReleaseConfigs) { LatestReleaseInfo = githubReleaseConfigs[0]; if (!File.Exists(MelonHandlerDllPath)) { return(true); } GetCurrentAndLatestVersion(out string latestGitVersion, out string currentVersion); var latest = VersionToInt(latestGitVersion); var current = VersionToInt(currentVersion); return(latest > current); }
/// <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() { int i = -1; List <string> downloads = new List <string>(); var gitApi = GithubReleaseConfig.FromJson(AquiredGitApiText); foreach (var a in gitApi[0].Assets) { i++; if (GitFileIndexsToDownload != null && !GitFileIndexsToDownload.Contains(i)) { continue; } Logger.Log("Downloading " + a.BrowserDownloadUrl.ToString()); downloads.Add(a.BrowserDownloadUrl.ToString()); } return(downloads); }
private List <GithubReleaseConfig> CreateReleaseConfigFromText(string unparsedGitText) { var releaseConfig = GithubReleaseConfig.FromJson(unparsedGitText); return(releaseConfig); }