private IBeatmap decode(string filename, out IBeatmap encoded) { using (var stream = TestResources.GetStore().GetStream(filename)) using (var sr = new LineBufferedReader(stream)) { var legacyDecoded = convert(new LegacyBeatmapDecoder { ApplyOffsets = false }.Decode(sr)); using (var ms = new MemoryStream()) using (var sw = new StreamWriter(ms)) using (var sr2 = new LineBufferedReader(ms, true)) { new LegacyBeatmapEncoder(legacyDecoded).Encode(sw); sw.Flush(); ms.Position = 0; encoded = convert(new LegacyBeatmapDecoder { ApplyOffsets = false }.Decode(sr2)); return(legacyDecoded); } } }
public void TestEncodeDecodeStability(string name) { var decoded = decodeFromLegacy(TestResources.GetStore().GetStream(name)); var decodedAfterEncode = decodeFromLegacy(encodeToLegacy(decoded)); sort(decoded); sort(decodedAfterEncode); Assert.That(decodedAfterEncode.Serialize(), Is.EqualTo(decoded.Serialize())); }
public byte[] Get(string name) => name == resourceName?TestResources.GetStore().Get("Resources/Samples/test-sample.mp3") : null;
public Task <byte[]> GetAsync(string name, CancellationToken cancellationToken = default) => name == resourceName?TestResources.GetStore().GetAsync("Resources/Samples/test-sample.mp3", cancellationToken) : null;
public override IResourceStore <byte[]> CreateResourceStore() => new NamespacedResourceStore <byte[]>(TestResources.GetStore(), @"Resources");