Пример #1
0
        public void TestWithSimplePathWithExtension()
        {
            var assetPath = new UFile("/a/b/c.txt");

            Assert.Equal("/a/b", assetPath.GetDirectory());
            Assert.Equal("c", assetPath.GetFileNameWithoutExtension());
            Assert.Equal(".txt", assetPath.GetFileExtension());
            Assert.Equal("/a/b/c", assetPath.GetDirectoryAndFileNameWithoutExtension());
            Assert.Equal("/a/b/c.txt", assetPath.FullPath);
        }
Пример #2
0
        public void TestEquals()
        {
            var assetPath1 = new UFile(null);
            var assetPath2 = new UFile(null);

            Assert.Equal(assetPath1, assetPath2);

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

            // Test is not done on Extensions
            assetPath1 = new UFile("/a/b/c.txt");
            assetPath2 = new UFile("/a/b/d/../c.png");
            Assert.NotEqual(assetPath1, assetPath2);
            Assert.Equal(assetPath1.GetDirectoryAndFileNameWithoutExtension(), assetPath2.GetDirectoryAndFileNameWithoutExtension());
        }
Пример #3
0
        public void TestWithNormalization()
        {
            var assetPath = new UFile("/a/b/.././././//c.txt");

            Assert.Equal("/a", assetPath.GetDirectory());
            Assert.Equal("c", assetPath.GetFileNameWithoutExtension());
            Assert.Equal(".txt", assetPath.GetFileExtension());
            Assert.Equal("/a/c", assetPath.GetDirectoryAndFileNameWithoutExtension());
            Assert.Equal("/a/c.txt", assetPath.FullPath);

            assetPath = new UFile("../.././././//c.txt");
            Assert.Equal("../..", assetPath.GetDirectory());
            Assert.Equal("c", assetPath.GetFileNameWithoutExtension());
            Assert.Equal(".txt", assetPath.GetFileExtension());
            Assert.Equal("../../c", assetPath.GetDirectoryAndFileNameWithoutExtension());
            Assert.Equal("../../c.txt", assetPath.FullPath);

            assetPath = new UFile("a/../../../c.txt");
            Assert.Equal("../../c.txt", assetPath.FullPath);
        }
Пример #4
0
 /// <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.GetDirectoryAndFileNameWithoutExtension(); // Make sure we are using the location withint the package without the extension
 }
Пример #5
0
 protected virtual string BuildThumbnailStoreName(UFile assetUrl)
 {
     return(assetUrl.GetDirectoryAndFileNameWithoutExtension().Insert(0, ThumbnailStorageNamePrefix));
 }