protected override void Logic(ValidationTarget target)
        {
            //var dependenciesFolderPath = AssetDatabase.GUIDToAssetPath(VRCSDKDependenciesFolderGUID);
            //var rootFolderPath = Path.GetDirectoryName(dependenciesFolderPath);
            //var versionFilePath = Path.Combine(rootFolderPath, "version.txt");

            /*if (string.IsNullOrEmpty(rootFolderPath) ||
             *  string.IsNullOrEmpty(versionFilePath) ||
             *  !File.Exists(versionFilePath))*/
            if (!File.Exists(versionFilePath))
            {
                AddIssue(new Issue(null,
                                   IssueLevel.Error,
                                   LocalizedMessage.Get("VRCSDKVersionRule.NotInstalled"),
                                   LocalizedMessage.Get("VRCSDKVersionRule.NotInstalled.Solution"),
                                   solutionURL: downloadURL
                                   ));
                return;
            }

            var currentVersion = new VRCSDKVersion(File.ReadAllText(versionFilePath));

            if (currentVersion < targetVersion)
            {
                AddIssue(new Issue(null,
                                   IssueLevel.Error,
                                   LocalizedMessage.Get("VRCSDKVersionRule.PreviousVersion"),
                                   LocalizedMessage.Get("VRCSDKVersionRule.PreviousVersion.Solution"),
                                   solutionURL: downloadURL
                                   ));
            }
        }
Пример #2
0
        public void OperatorTest()
        {
            var version     = new VRCSDKVersion("2019.09.18.12.05");
            var sameVersion = new VRCSDKVersion("2019.09.18.12.05");
            var prevVersion = new VRCSDKVersion("2019.09.18.12.04");
            var nextVersion = new VRCSDKVersion("2019.09.18.12.06");

            Assert.IsTrue(version > prevVersion);
            Assert.IsFalse(version > sameVersion);
            Assert.IsFalse(version > nextVersion);

            Assert.IsFalse(version < prevVersion);
            Assert.IsFalse(version < sameVersion);
            Assert.IsTrue(version < nextVersion);

            Assert.IsTrue(version >= prevVersion);
            Assert.IsTrue(version >= sameVersion);
            Assert.IsFalse(version >= nextVersion);

            Assert.IsFalse(version <= prevVersion);
            Assert.IsTrue(version <= sameVersion);
            Assert.IsTrue(version <= nextVersion);

            Assert.IsFalse(version == prevVersion);
            Assert.IsTrue(version == sameVersion);
            Assert.IsFalse(version == nextVersion);

            Assert.IsTrue(version != prevVersion);
            Assert.IsFalse(version != sameVersion);
            Assert.IsTrue(version != nextVersion);
        }
Пример #3
0
        public void InterconvertibleTest()
        {
            var version = new VRCSDKVersion("2019.09.18.12.05");

            var regeneratedVersion = new VRCSDKVersion(version.ToInterconvertibleString());

            Assert.AreEqual(version, regeneratedVersion);
        }
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="name">ルール名</param>
 /// <param name="version">VRCSDKのバージョン</param>
 public VRCSDKVersionRule(string name, VRCSDKVersion version, string downloadURL) : base(name)
 {
     targetVersion    = version;
     this.downloadURL = downloadURL;
 }