Esempio n. 1
0
        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);
                            }
                }
        }
Esempio n. 2
0
        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()));
        }
Esempio n. 3
0
 public byte[] Get(string name) => name == resourceName?TestResources.GetStore().Get("Resources/Samples/test-sample.mp3") : null;
Esempio n. 4
0
 public Task <byte[]> GetAsync(string name, CancellationToken cancellationToken = default)
 => name == resourceName?TestResources.GetStore().GetAsync("Resources/Samples/test-sample.mp3", cancellationToken) : null;
Esempio n. 5
0
 public override IResourceStore <byte[]> CreateResourceStore() => new NamespacedResourceStore <byte[]>(TestResources.GetStore(), @"Resources");