static AddonInfo()
 {
     actualKspVersion = new VersionInfo(Versioning.version_major, Versioning.version_minor, Versioning.Revision);
 }
            private void ParseGitHubJson(string json)
            {
                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(tag);

                    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;
                    }
                }
            }
        private void ParseKerbalStuffVersion(Dictionary<string, object> data)
        {
            foreach (var key in data.Keys)
            {
                switch (key.ToUpper())
                {
                    case "FRIENDLY_VERSION":
                        this.Version = GetVersion(data[key]);
                        break;

                    case "KSP_VERSION":
                        this.kspVersion = GetVersion(data[key]);
                        break;
                }
            }
        }
        private void ParseAvc(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 "KERBAL_STUFF_URL":
                        this.KerbalStuffUrl = (string)data[key];
                        break;

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

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

                    case "CHANGE_LOG":
                        this.ChangeLog = (string)data[key];
                        break;

                    case "CHANGE_LOG_URL":
                        this.ChangeLogUrl = (string)data[key];
                        break;

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

                    case "ASSEMBLY_NAME":
                        this.Assembly = AssemblyLoader.loadedAssemblies.FirstOrDefault(a => a.name == (string)data[key]);
                        if (this.Assembly != null)
                        {
                            this.Version = new VersionInfo(this.Assembly.assembly.GetName().Version);
                        }
                        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;
                }
            }
        }
        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;
        }
 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));
 }