private static async Task <PathTransformer> CreatePathTransformer()
        {
            var originalManifest = await GameFilesInfoFromGameManifest();

            var originalPaths      = originalManifest.GameFileInfo.Values.Select(t => t.FileName).ToArray();
            var transformerBuilder = new PathTransformerBuilder();

            return(new PathTransformer(transformerBuilder.Build(originalPaths)));
        }
Beispiel #2
0
        public void RegistersFileToRootDirectory()
        {
            var dirs = new string[]
            {
                "Spartan.exe"
            };

            var builder = new PathTransformerBuilder();
            var tree    = builder.Build(dirs);

            tree.Files.Should().ContainSingle(t => t == "Spartan.exe");
            tree.Subdirectories.Should().BeEmpty();
        }
Beispiel #3
0
        public void RegistersFileUnderRightRootDirectory()
        {
            var dirs = new string[]
            {
                "art\\Art.bar"
            };

            var builder = new PathTransformerBuilder();
            var tree    = builder.Build(dirs);

            tree.Files.Should().BeEmpty();
            tree.Subdirectories.Should().ContainKey("art");
            tree.Subdirectories["art"].Files.Should().Contain("Art.bar");
        }
Beispiel #4
0
        public string TransformsToExpectedResult(string pathToTransform)
        {
            var originalPathsFromManifest = new string[]
            {
                "Spartan.exe",
                "art\\Art.bar",
                "sound\\SoundSets\\Amb.xml"
            };

            var builder     = new PathTransformerBuilder();
            var transformer = new PathTransformer(builder.Build(originalPathsFromManifest));

            return(transformer.TransformPath(pathToTransform));
        }
Beispiel #5
0
        public void RegistersSubdirectories()
        {
            var dirs = new string[]
            {
                "sound\\amb\\Amb_Map_Ce_Day_1.mp3",
                "sound\\amb\\Amb_Map_Ce_Day_2.mp3"
            };

            var builder = new PathTransformerBuilder();
            var tree    = builder.Build(dirs);

            tree.Files.Should().BeEmpty();
            tree.Subdirectories.Should().ContainKey("sound");
            tree.Subdirectories["sound"].Subdirectories.Should().ContainKey("amb");
            tree.Subdirectories["sound"].Subdirectories["amb"].Files.Should().HaveCount(2);
        }