Пример #1
0
        public async Task SmallFilesShouldntCrash()
        {
            await using var temp = await TempFolder.Create();

            await using var archive = new TempFile();
            for (int i = 0; i < 1; i++)
            {
                await WriteRandomData(temp.Dir.Combine($"{i}.bin"), _rng.Next(10, 10));
            }

            await ZipUpFolder(temp.Dir, archive.Path, false);

            var results = await FileExtractor2.GatheringExtract(new NativeFileStreamFactory(archive.Path),
                                                                _ => true,
                                                                async (path, sfn) =>
            {
                await using var s = await sfn.GetStream();
                return(await s.xxHashAsync());
            });

            Assert.Equal(1, results.Count);
            foreach (var(path, hash) in results)
            {
                Assert.Equal(await temp.Dir.Combine(path).FileHashAsync(), hash);
            }
        }
Пример #2
0
        public async Task ExtractModlist()
        {
            ExtractedModlistFolder = await TempFolder.Create();

            await FileExtractor2.GatheringExtract(new NativeFileStreamFactory(ModListArchive), _ => true,
                                                  async (path, sfn) =>
            {
                await using var s = await sfn.GetStream();
                var fp            = ExtractedModlistFolder.Dir.Combine(path);
                fp.Parent.CreateDirectory();
                await fp.WriteAllAsync(s);
                return(0);
            });
        }
Пример #3
0
        public async Task CanGatherDataFromOMODFiles()
        {
            var src = await DownloadMod(Game.Oblivion, 18498);

            await FileExtractor2.GatheringExtract(new NativeFileStreamFactory(src),
                                                  p => p.Extension == OMODExtension, async (path, sfn) =>
            {
                await FileExtractor2.GatheringExtract(sfn, _ => true, async(ipath, isfn) => {
                    // We shouldn't have any .crc files because this file should be recognized as a OMOD and extracted correctly
                    Assert.NotEqual(CRCExtension, ipath.Extension);
                    return(0);
                });
                return(0);
            });
        }