/// <summary> /// Gets the latest version of the plugin from github /// </summary> /// <param name="o">the data returned by the github api</param> private void SetLatestVersion(GithubReleasePage o) { if (o.TagName != null) { //if the page exists ReleasePage = o; //sets the local page to the page returned incase the data needs to be used elsewhere LatestVersion = ReleasePage.TagName.StartsWith("v") ? ReleasePage.TagName.Substring(1) : ReleasePage.TagName; //sets the latest version = the string retrieved from github IsLatestVersion = LatestVersion == Plugin.Version; //checks the latest version against the local version } else { //if there is no github page IsLatestVersion = true; } HasVersionBeenSet = true; _ue.Invoke(this); //invokes the event referencing the current object }
/// <summary> /// Called when a plugin's version info has been set /// </summary> /// <param name="info">the latest version info</param> private void OnSet(LatestPluginInfo info) { ModMenuPlugin.debugLogger.Log($"{info.Plugin.Name} is {(info.IsLatestVersion ? " " : " not ")} up to date"); PluginInfos.Add(info); //adds it to the local array of Plugins OnPluginInfoAdded?.Invoke(info); }