Exemple #1
0
        public bool Compatible(KspVersion gameVersion, CkanModule module)
        {
            // If it's strictly compatible, then it's compatible.
            if (strict.Compatible(gameVersion, module))
            {
                return(true);
            }

            // If we're in strict mode, and it's not strictly compatible, then it's
            // not compatible.
            if (module.ksp_version_strict)
            {
                return(false);
            }

            // Otherwise, check if it's "generally recognise as safe".

            // If we're running KSP 1.0.4, then allow the mod to run if we would have
            // considered it compatible under 1.0.3 (as 1.0.4 was "just a hotfix").
            if (gameVersion.Equals(KspVersion.Parse("1.0.4")))
            {
                return(strict.Compatible(v103, module));
            }

            return(false);
        }
Exemple #2
0
        public void EqualityWorksCorrectly(KspVersion a, KspVersion b, bool areEqual)
        {
            // Act
            var genericEquality            = a.Equals(b);
            var nonGenericEquality         = a.Equals((object)b);
            var operatorEquality           = a == b;
            var operatorInequality         = a != b;
            var genericReferenceEquality   = a.Equals(a);
            var nonGenericRefereneEquality = a.Equals((object)a);

            // Assert
            Assert.AreEqual(areEqual, genericEquality);
            Assert.AreEqual(areEqual, nonGenericEquality);
            Assert.AreEqual(areEqual, operatorEquality);
            Assert.AreNotEqual(areEqual, operatorInequality);
            Assert.IsTrue(genericReferenceEquality);
            Assert.IsTrue(nonGenericRefereneEquality);
        }
Exemple #3
0
        public override bool SingleVersionsCompatible(KspVersion gameVersion, CkanModule module)
        {
            // Otherwise, check if it's "generally recognise as safe".

            // If we're running KSP 1.0.4, then allow the mod to run if we would have
            // considered it compatible under 1.0.3 (as 1.0.4 was "just a hotfix").
            if (gameVersion.Equals(KspVersion.Parse("1.0.4")))
            {
                return(strict.SingleVersionsCompatible(v103, module));
            }

            return(false);
        }