Beispiel #1
0
        public void TestWithSimplePathWithExtension()
        {
            var assetPath = new UFile("/a/b/c.txt");

            Assert.AreEqual("/a/b", assetPath.GetDirectory());
            Assert.AreEqual("c", assetPath.GetFileName());
            Assert.AreEqual(".txt", assetPath.GetFileExtension());
            Assert.AreEqual("/a/b/c", assetPath.GetDirectoryAndFileName());
            Assert.AreEqual("/a/b/c.txt", assetPath.FullPath);
        }
Beispiel #2
0
        public void TestEquals()
        {
            var assetPath1 = new UFile(null);
            var assetPath2 = new UFile(null);

            Assert.AreEqual(assetPath1, assetPath2);

            assetPath1 = new UFile("/a/b/c.txt");
            assetPath2 = new UFile("/a/b/d/../c.txt");
            Assert.AreEqual(assetPath1, assetPath2);

            // Test is not done on Extensions
            assetPath1 = new UFile("/a/b/c.txt");
            assetPath2 = new UFile("/a/b/d/../c.png");
            Assert.AreNotEqual(assetPath1, assetPath2);
            Assert.AreEqual(assetPath1.GetDirectoryAndFileName(), assetPath2.GetDirectoryAndFileName());
        }
Beispiel #3
0
        public void TestWithNormalization()
        {
            var assetPath = new UFile("/a/b/.././././//c.txt");

            Assert.AreEqual("/a", assetPath.GetDirectory());
            Assert.AreEqual("c", assetPath.GetFileName());
            Assert.AreEqual(".txt", assetPath.GetFileExtension());
            Assert.AreEqual("/a/c", assetPath.GetDirectoryAndFileName());
            Assert.AreEqual("/a/c.txt", assetPath.FullPath);

            assetPath = new UFile("../.././././//c.txt");
            Assert.AreEqual("../..", assetPath.GetDirectory());
            Assert.AreEqual("c", assetPath.GetFileName());
            Assert.AreEqual(".txt", assetPath.GetFileExtension());
            Assert.AreEqual("../../c", assetPath.GetDirectoryAndFileName());
            Assert.AreEqual("../../c.txt", assetPath.FullPath);

            assetPath = new UFile("a/../../../c.txt");
            Assert.AreEqual("../../c.txt", assetPath.FullPath);
        }
Beispiel #4
0
        public void TestEquals()
        {
            var assetPath1 = new UFile(null);
            var assetPath2 = new UFile(null);
            Assert.AreEqual(assetPath1, assetPath2);

            assetPath1 = new UFile("/a/b/c.txt");
            assetPath2 = new UFile("/a/b/d/../c.txt");
            Assert.AreEqual(assetPath1, assetPath2);

            // Test is not done on Extensions
            assetPath1 = new UFile("/a/b/c.txt");
            assetPath2 = new UFile("/a/b/d/../c.png");
            Assert.AreNotEqual(assetPath1, assetPath2);
            Assert.AreEqual(assetPath1.GetDirectoryAndFileName(), assetPath2.GetDirectoryAndFileName());
        }
Beispiel #5
0
        public void TestWithNormalization()
        {
            var assetPath = new UFile("/a/b/.././././//c.txt");
            Assert.AreEqual("/a", assetPath.GetDirectory());
            Assert.AreEqual("c", assetPath.GetFileName());
            Assert.AreEqual(".txt", assetPath.GetFileExtension());
            Assert.AreEqual("/a/c", assetPath.GetDirectoryAndFileName());
            Assert.AreEqual("/a/c.txt", assetPath.FullPath);

            assetPath = new UFile("../.././././//c.txt");
            Assert.AreEqual("../..", assetPath.GetDirectory());
            Assert.AreEqual("c", assetPath.GetFileName());
            Assert.AreEqual(".txt", assetPath.GetFileExtension());
            Assert.AreEqual("../../c", assetPath.GetDirectoryAndFileName());
            Assert.AreEqual("../../c.txt", assetPath.FullPath);

            assetPath = new UFile("a/../../../c.txt");
            Assert.AreEqual("../../c.txt", assetPath.FullPath);
        }
Beispiel #6
0
 public void TestWithSimplePathWithExtension()
 {
     var assetPath = new UFile("/a/b/c.txt");
     Assert.AreEqual("/a/b", assetPath.GetDirectory());
     Assert.AreEqual("c", assetPath.GetFileName());
     Assert.AreEqual(".txt", assetPath.GetFileExtension());
     Assert.AreEqual("/a/b/c", assetPath.GetDirectoryAndFileName());
     Assert.AreEqual("/a/b/c.txt", assetPath.FullPath);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AssetFileChangedEvent"/> class.
 /// </summary>
 /// <param name="package">The package.</param>
 /// <param name="changeType">Type of the change.</param>
 /// <param name="assetLocation">The asset URL.</param>
 public AssetFileChangedEvent(Package package, AssetFileChangedType changeType, UFile assetLocation)
 {
     Package       = package;
     ChangeType    = changeType;
     AssetLocation = assetLocation.GetDirectoryAndFileName(); // Make sure we are using the location withint the package without the extension
 }