static AddonInfo()
 {
     actualKspVersion = new VersionInfo(Versioning.version_major, Versioning.version_minor, Versioning.Revision);
 }
            private void ParseGitHubJson(string json)
            {
                try
                {
                    var obj = Json.Deserialize(json) as List<object>;
                    if (obj == null || obj.Count == 0)
                    {
                        this.ParseError = true;
                        return;
                    }

                    foreach (Dictionary<string, object> data in obj)
                    {
                        if (!this.AllowPreRelease && (bool)data["prerelease"])
                        {
                            continue;
                        }

                        var tag = (string)data["tag_name"];
                        var version = GetVersion(data["tag_name"]);

                        if (version == null || version <= this.Version)
                        {
                            continue;
                        }

                        this.Version = version;
                        this.Tag = tag;

                        if (String.IsNullOrEmpty(this.addonInfo.Download))
                        {
                            this.addonInfo.Download = "https://github.com/" + this.Username + "/" + this.Repository + "/releases/tag/" + this.Tag;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Exception(ex);
                }
            }
        private static VersionInfo ParseVersion(Dictionary<string, object> data)
        {
            var version = new VersionInfo();

            foreach (var key in data.Keys)
            {
                switch (key.ToUpper())
                {
                    case "MAJOR":
                        version.Major = (long)data[key];
                        break;

                    case "MINOR":
                        version.Minor = (long)data[key];
                        break;

                    case "PATCH":
                        version.Patch = (long)data[key];
                        break;

                    case "BUILD":
                        version.Build = (long)data[key];
                        break;
                }
            }

            return version;
        }
        private void Parse(string json)
        {
            var data = Json.Deserialize(json) as Dictionary<string, object>;
            if (data == null)
            {
                this.ParseError = true;
                return;
            }
            foreach (var key in data.Keys)
            {
                switch (key.ToUpper())
                {
                    case "NAME":
                        this.Name = (string)data[key];
                        break;

                    case "URL":
                        this.Url = FormatCompatibleUrl((string)data[key]);
                        break;

                    case "DOWNLOAD":
                        this.Download = (string)data[key];
                        break;

                    case "GITHUB":
                        this.GitHub = new GitHubInfo(data[key], this);
                        break;

                    case "VERSION":
                        this.Version = GetVersion(data[key]);
                        break;

                    case "KSP_VERSION":
                        this.kspVersion = GetVersion(data[key]);
                        break;

                    case "KSP_VERSION_MIN":
                        this.kspVersionMin = GetVersion(data[key]);
                        break;

                    case "KSP_VERSION_MAX":
                        this.kspVersionMax = GetVersion(data[key]);
                        break;
                }
            }
        }
 protected bool Equals(VersionInfo other)
 {
     return (this.Major == -1 || other.Major == -1 || this.Major.Equals(other.Major)) &&
            (this.Minor == -1 || other.Minor == -1 || this.Minor.Equals(other.Minor)) &&
            (this.Patch == -1 || other.Patch == -1 || this.Patch.Equals(other.Patch)) &&
            (this.Build == -1 || other.Build == -1 || this.Build.Equals(other.Build));
 }