Exemplo n.º 1
0
        public async Task Mobi7ParserShouldExtractNavigationStream()
        {
            await using var stream      = AssetFactory.GetAsset("pg42324.mobi");
            await using var rawMlStream = new MobiMetadata(stream).GetRawMlStream();

            var parser        = new Mobi7Parser();
            var contentStream = await parser.GetNavigationStream(rawMlStream);

            Assert.IsNotNull(contentStream);
            Assert.AreEqual(4133, contentStream.Length);
        }
Exemplo n.º 2
0
        public Form()
        {
            InitializeComponent();
            int k = 0;

            this.Load    += delegate { factory = new AssetFactory(); };
            this.MouseUp += (s, e) =>
            {
                this.Controls.Add(
                    new Prefab(
                        sprite: factory.GetAsset((Texture2D)(k++)),
                        x: e.X - 50,
                        y: e.Y - 65
                        )
                    .SimpleImage
                    );
                k %= 3;
            };
        }
Exemplo n.º 3
0
        public async Task MobiReaderShouldParseAnnotationsAndTableOfContent()
        {
            await using var stream = AssetFactory.GetAsset("pg42324.mobi");
            var annotations = new List <Annotation>
            {
                new(
                    "Nothing is so painful to the human mind as a great and sudden change.",
                    new DocumentReference(),
                    AnnotationType.Highlight,
                    new AnnotationContext
                {
                    PageNumber = 380,
                    SerializedLocation = "line://925-994"
                },
                    DateTime.MinValue)
            };

            var document = await this.reader.Read(
                stream,
                new ReaderOptions(),
                _ => annotations);

            Assert.AreEqual(1, document.Annotations.Count());
        }