12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Bsm.Core.Arcache;
- using Xunit;
- namespace Bsm.Core.Tests
- {
- public class ArcachePoc
- {
- [Fact]
- public void CreateArchivePoc()
- {
- var dir = @"Z:\BeatSaverAll";
- var arc = new Lz4ArchiveCreator(@"z:\bsa");
- IoUtil.LookupFilesRecursively(dir, (p, f) =>
- {
- if (Path.GetExtension(p.cFileName)?.ToLower() != ".dat") return;
- var archivePath = f.TrimStart('/') + "/" + p.cFileName;
- var fullPath = Path.Combine(dir, archivePath);
- //TODO: add to archive
- arc.AppendFile(fullPath, archivePath);
- });
- arc.Close();
- }
- [Fact]
- public void ReadArchivePocA()
- {
- var fileBase = @"Y:\BeatSaverAll\bsa";
- var arc = new Lz4ArchiveReader(fileBase, false);
- var find = arc.Entries.Where(p => p.Key.StartsWith("715f")).FirstOrDefault();
- var json = arc.ReadText(arc.Entries["10000 (Athaza - DirtSquirrel)/ExpertPlusStandard.dat"], Encoding.UTF8);
- var json2 = arc.ReadText(arc.Entries["1008 (Backbone - fafurion)/info.dat"], Encoding.UTF8);
- var json3 = arc.ReadText(arc.Entries["abe8 (pa pa ya!! - barry seggai)/info.dat"], Encoding.UTF8);
- var totalSize = arc.Entries.Values.Sum(p => p.OriginalSize);
- var kb = totalSize / 1024f;
- var mb = kb / 1024f;
- var gb = mb / 1024f;
- }
- [Fact]
- public void ReadArchivePocB()
- {
- var fileBase = @"Z:\SVA\bsa";
- var arc = new Lz4ArchiveReader(fileBase, true);
- var json = arc.ReadText(arc.Entries["10000 (Athaza - DirtSquirrel)/ExpertPlusStandard.dat"], Encoding.UTF8);
- var json2 = arc.ReadText(arc.Entries["1008 (Backbone - fafurion)/info.dat"], Encoding.UTF8);
- //10ms
- var totalSize = arc.Entries.Values.Sum(p => p.OriginalSize);
- var kb = totalSize / 1024f;
- var mb = kb / 1024f;
- var gb = mb / 1024f;
- }
- [Fact]
- public void ReadLenArchivePoc()
- {
- var arc = @"z:\bsl";
- var dic = LengthPack.Read(arc);
- }
- }
- }
|