Beispiel #1
0
        public void CreateManifestTest()
        {
            var target = new OasisManifest();

            target.Add("file.doc", "application/msword");
            target.Add("datne.pdf", "application/pdf");
            target.Add("file2.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");

            var actual = target.Generate();

            Assert.Equal(@"<manifest:manifest xmlns:manifest=""urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"" manifest:version=""1.2"">" +
                         @"<manifest:file-entry manifest:full-path=""/"" manifest:media-type=""application/vnd.etsi.asic-e+zip"" />" +
                         @"<manifest:file-entry manifest:full-path=""file.doc"" manifest:media-type=""application/msword"" />" +
                         @"<manifest:file-entry manifest:full-path=""datne.pdf"" manifest:media-type=""application/pdf"" />" +
                         @"<manifest:file-entry manifest:full-path=""file2.docx"" manifest:media-type=""application/vnd.openxmlformats-officedocument.wordprocessingml.document"" />" +
                         @"</manifest:manifest>",
                         actual.ToString(SaveOptions.DisableFormatting));
        }
Beispiel #2
0
        public void WriteManifest(IEnumerable <DataFile> dataFiles)
        {
            var manifest = new OasisManifest();

            foreach (var dataFile in dataFiles)
            {
                manifest.Add(dataFile.Name, dataFile.MimeType);
            }

            var entry = new ZipEntry($"{AsicContainer.MetaFolderName}/{AsicContainer.ManifestFileName}");

            _zipOutputStream.PutNextEntry(entry);

            manifest
            .Generate()
            .Save(_zipOutputStream);

            _zipOutputStream.CloseEntry();
        }