Exemplo n.º 1
0
        private void CreateContainerXML(RuntimeSettings settings, ILog log)
        {
            log.Info("Creating META-INF/container.xml");

            var container = new Container
            {
                Rootfiles = new Rootfiles
                {
                    Rootfile = new Rootfile
                    {
                        Mediatype = "application/oebps-package+xml",
                        Fullpath  = "OPS/package.opf"
                    }
                },
                Version = "1.0",
                Xmlns   = "urn:oasis:names:tc:opendocument:xmlns:container"
            };

            FsPath path = settings.OutputDirectory.Combine("epubtemp\\META-INF\\container.xml");

            var namespaces = new List <(string prefix, string namespac)>
            {
                ("", "urn:oasis:names:tc:opendocument:xmlns:container")
            };

            path.SerializeXml(container, log, namespaces);
        }
Exemplo n.º 2
0
        public static void CreateScriptProject(ILog log, FsPath workdir, string ApiReferencePath)
        {
            log.Info("Creating scripts project...");
            Project p = new Project
            {
                Sdk           = "Microsoft.NET.Sdk",
                PropertyGroup = new PropertyGroup
                {
                    Nullable        = "enable",
                    TargetFramework = "netstandard2.1"
                },
                ItemGroup = new ItemGroup
                {
                    Reference = new Reference
                    {
                        Include  = "BookGen.Api",
                        HintPath = Path.Combine(ApiReferencePath, "BookGen.Api.dll")
                    }
                }
            };
            FsPath csProj = workdir.Combine(ScriptProject);

            csProj.SerializeXml(p, log);

            ResourceHandler.ExtractKnownFile(KnownFile.ScriptTemplateCs, workdir.Combine("Scripts").ToString(), log);
        }
Exemplo n.º 3
0
        public void RunStep(RuntimeSettings settings, ILog log)
        {
            log.Info("Creating OPS/package.opf...");

            var package = new Package
            {
                Version          = "3.0",
                Uniqueidentifier = "q",
                Metadata         = new Metadata
                {
                    Meta = new List <Meta>
                    {
                        new Meta
                        {
                            Property = "dcterms:modified",
                            Text     = DateTime.Now.ToW3CZTimeFormat(),
                        },
                    },
                    Title = new List <Title>
                    {
                        new Title
                        {
                            Id   = "title",
                            Text = settings.Configuration.Metadata.Title
                        },
                    },
                    Creator = new List <Creator>
                    {
                        new Creator
                        {
                            Id   = "creator",
                            Text = settings.Configuration.Metadata.Author
                        },
                    },
                    Language   = "en",
                    Identifier = new Identifier
                    {
                        Id   = "q",
                        Text = "book",
                    },
                    Date = DateTime.Now.ToW3CTimeFormat(),
                },
                Manifest = CreateManifest(),
                Spine    = CreateSpine()
            };

            FsPath path = settings.OutputDirectory.Combine("epubtemp\\OPS\\package.opf");

            var namespaces = new List <(string prefix, string namespac)>
            {
                ("", "http://www.idpf.org/2007/opf"),
                ("dc", "http://purl.org/dc/elements/1.1/")
            };

            path.SerializeXml(package, log, namespaces);
        }
Exemplo n.º 4
0
        public void RunStep(RuntimeSettings settings, ILog log)
        {
            log.Info("Writing wordpressExport.xml file...");
            FsPath outFile = settings.OutputDirectory.Combine("wordpressExport.xml");

            var namespaces = new List <(string, string)>
            {
                ("excerpt", "http://wordpress.org/export/1.2/excerpt/"),
                ("content", "http://purl.org/rss/1.0/modules/content/"),
                ("wfw", "http://wellformedweb.org/CommentAPI/"),
                ("dc", "http://purl.org/dc/elements/1.1/"),
                ("wp", "http://wordpress.org/export/1.2/")
            };

            Rss output = new Rss()
            {
                Version = "2.0",
                Channel = _session.CurrentChannel
            };

            outFile.SerializeXml <Rss>(output, log, namespaces);
        }