Beispiel #1
0
 /// <summary>
 /// Created a base oject then calls the GetGithubJson coroutine using the VCInterop,
 /// calls the LatestPluginInfoEvent once the data has been retrieved
 /// </summary>
 /// <param name="plugin"></param>
 /// <param name="interop"></param>
 /// <param name="vCheck"></param>
 public LatestPluginInfo(IGithubInfoPlugin plugin, VcInterop interop, LatestPluginInfoEvent vCheck)
 {
     Plugin            = plugin;
     IsLatestVersion   = false;
     HasVersionBeenSet = false;
     _ue           = vCheck;
     LatestVersion = string.Empty;
     ReleasePage   = null;
     interop.StartCoroutine(Util.GetGithubJson(interop, Plugin,
                                               SetLatestVersion)); //starts a coroutine to retrieve the latest plugin version
 }
Beispiel #2
0
 private void SetLatestVersion(GithubReleasePage o)
 {
     if (o != null)
     {
         var x = o.tag_name.StartsWith("v") ? o.tag_name.Substring(1) : o.tag_name;
         IsLatestVersion = x == Plugin.Version;
     }
     else
     {
         IsLatestVersion = true;
     }
 }
Beispiel #3
0
        /// <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
        }
Beispiel #4
0
 public GithubCoroutine(string author, string projName, GithubReleasePage page)
 {
     this.Author   = author;
     this.ProjName = projName;
     this.Page     = page;
 }