Exemplo n.º 1
0
        public async Task TestMethod1()
        {
            EbmlElementFactory.RegisterFactory(MatroskaIds.SegmentId.Size, new SegmentFactory());
            var dataAccessor =
                new FileDataAccessor(
                    @"C:\Users\jorge\source\repos\Otchi.Core\Otchi.Core.Console\bin\Debug\netcoreapp3.0\Downloads\[HorribleSubs] Radiant S2 - 06 [1080p].mkv");
            var parser   = new EbmlParser(dataAccessor);
            var document = await parser.ParseDocument();

            Console.WriteLine(document);
        }
Exemplo n.º 2
0
        static async Task yeet()
        {
            var factoryList = new List <Dictionary <long, EbmlElementFactory> >
            {
                MatroskaFactories.MatroskaSegmentFactories, MatroskaFactories.AttachmentFactories, MatroskaFactories.ChapterFactories,
                MatroskaFactories.CueingDataFactories, MatroskaFactories.MetaSeekInformationFactories,
                MatroskaFactories.TaggingFactories, MatroskaFactories.TrackFactories, EbmlFactories.AllEbmlHeadFactories
            };
            var factories = EbmlFactories.Merge(factoryList);
            var sw        = new Stopwatch();

            sw.Restart();
            var          dataAccessor = new FileDataAccessor(@"C:\Users\paravicinij\source\repos\Otchi.Core\Otchi.Core.Console\bin\Debug\netcoreapp3.0\Downloads\[HorribleSubs] Radiant S2 - 06 [1080p].mkv");
            var          parser       = new EbmlParser(dataAccessor, factories);
            EbmlDocument?document     = null;

            try
            {
                document = await parser.ParseDocument(false);

                await document.Head.Decode(parser);

                await foreach (var child in document.Body.GetAsyncEnumerable(parser))
                {
                    try
                    {
                        await(child?.Decode(parser) ?? Task.CompletedTask);
                    }
                    catch (DecodeException exception)
                    {
                        System.Console.WriteLine(exception.Message);
                    }
                }
            }
            catch (DecodeException exception)
            {
                System.Console.WriteLine(exception.Message);
            }

            var seekHead = await document.Body.TryGetChild <SeekHead>(parser);

            foreach (var(key, value) in seekHead)
            {
                var seek = (Seek)value;
                System.Console.WriteLine($"Pos: {seek.SeekPosition} Id: {seek.SeekId:X}");
            }
        }
Exemplo n.º 3
0
        static async Task Meh()
        {
            var parser = new EbmlParser(new FileDataAccessor(
                                            @"F:\repos\Otchi.Core\Otchi.Core.Console\bin\Debug\netcoreapp3.0\Downloads\[HorribleSubs] Radiant S2 - 06 [1080p].mkv"),
                                        EbmlFactories.Merge(new[] { EbmlFactories.AllEbmlHeadFactories, MatroskaFactories.AllMatroskaFactories }));
            EbmlDocument?document = null;

            try
            {
                document = parser.ParseDocument(false).Result;
                document.Head.Decode(parser, true, true).Wait();
                var seekHead = await document.Body.TryGetChild <SeekHead>(parser);

                await seekHead.Decode(parser);
            }
            catch (DecodeException)
            {
                System.Console.WriteLine($"Failed at: {parser.DataAccessor.Position}");
            }

            System.Console.WriteLine(document);
        }