Пример #1
0
        public void CreateDocuments(IThingGraph graph, IThing root, int count)
        {
            var digidoc = new DigidocSchema();

            for (int i = 0; i < count; i++)
            {
                var document = digidoc.CreateDocument(graph, null);
                digidoc.CreatePage(graph, document, null, 1);
                graph.Add(Factory.CreateEdge(root, document, DigidocSchema.Document));
            }
        }
Пример #2
0
        public void ReadPagesFromDir(IThingGraph graph, IThing document, string path)
        {
            var digidoc             = new DigidocSchema();
            var imageStreamProvider = new ImageStreamContentIo();
            var nr = 1;

            foreach (var file in Directory.GetFiles(path).OrderBy(f => f))
            {
                if (imageStreamProvider.Detector.Supports(Path.GetExtension(file)))
                {
                    var stream = imageStreamProvider.ReadContent(IoUtils.UriFromFileName(file));
                    if (stream != null && stream.Data != null)
                    {
                        digidoc.CreatePage(graph, document, stream, nr);
                        nr++;
                    }
                }
            }
        }