예제 #1
0
        private async Task DontCreateFileWhenReading()
        {
            await Create("@ace", "some_other_file").DisposeAsync();

            var storage = new DirectoryStorage(_tmpDir.FullName);
            var mods    = await storage.GetMods(CancellationToken.None);

            await mods.Values.Single().OpenRead("/mod.cpp", CancellationToken.None);

            Assert.False(File.Exists(Path.Join(_tmpDir.FullName, "@ace", "mod.cpp")));
        }
예제 #2
0
        private async Task GetMods()
        {
            await using var file = Create("@ace", "mod.cpp");
            await file.WriteLineAsync("Ey yo");

            var storage = new DirectoryStorage(_tmpDir.FullName);

            var mods = await storage.GetMods(CancellationToken.None);

            Assert.Single(mods);
            Assert.Contains("@ace", (IDictionary <string, IStorageMod>)mods);
        }
예제 #3
0
        private async Task CreateNestedFile()
        {
            await using var file = Create("@ace", "mod.cpp");
            await file.WriteLineAsync("Ey yo");

            var storage = new DirectoryStorage(_tmpDir.FullName);
            var mods    = await storage.GetMods(CancellationToken.None);

            await using var newFile = await(mods.Values.Single().OpenWrite("/addons/addon2.pbo", CancellationToken.None));
            await newFile.WriteAsync(new byte[] { 1, 2, 3 });

            newFile.Close();
            // TODO: check file contents, file still in use
        }