Beispiel #1
0
        private void DeSerialisationFixes(StreamingContext like_i_could_care)
        {
            // Make sure our version fields are populated.
            // TODO: There's got to be a better way of doing this, right?

            if (ksp_version_min == null)
            {
                ksp_version_min = new KSPVersion(null);
            }
            else
            {
                ksp_version_min = ksp_version_min.ToLongMin();
            }

            if (ksp_version_max == null)
            {
                ksp_version_max = new KSPVersion(null);
            }
            else
            {
                ksp_version_max = ksp_version_max.ToLongMax();
            }

            if (ksp_version == null)
            {
                ksp_version = new KSPVersion(null);
            }

            // Now see if we've got version with version min/max.
            if (ksp_version.IsNotAny() && (ksp_version_max.IsNotAny() || ksp_version_min.IsNotAny()))
            {
                // KSP version mixed with min/max.
                throw new InvalidModuleAttributesException("ksp_version mixed with ksp_version_(min|max)", this);
            }

            if (license == null)
            {
                license = new List <License> {
                    new License("unknown")
                };
            }

            if (@abstract == null)
            {
                @abstract = "";
            }

            if (name == null)
            {
                name = "";
            }
        }
Beispiel #2
0
        /// <summary>
        /// Returns a human readable string indicating the highest compatible
        /// version of KSP this module will run with. (Eg: 1.0.2, 1.0.2+,
        /// "All version", etc).
        ///
        /// This is for *human consumption only*, as the strings may change in the
        /// future as we support additional locales.
        /// </summary>
        public string HighestCompatibleKSP()
        {
            // Find the highest compatible KSP version
            if (!String.IsNullOrEmpty(ksp_version_max.ToString()))
            {
                return(ksp_version_max.ToLongMax().ToString());
            }
            else if (!String.IsNullOrEmpty(ksp_version.ToString()))
            {
                return(ksp_version.ToLongMax().ToString());
            }
            else if (!String.IsNullOrEmpty(ksp_version_min.ToString()))
            {
                return(ksp_version_min.ToLongMin().ToString() + "+");
            }

            return("All versions");
        }