예제 #1
0
        public async Task ExportAsync(Stream outStream, PlatformExportManifest exportOptions, Action <ExportImportProgressInfo> progressCallback, ICancellationToken сancellationToken)
        {
            if (exportOptions == null)
            {
                throw new ArgumentNullException(nameof(exportOptions));
            }

            using (var zipArchive = new ZipArchive(outStream, ZipArchiveMode.Create, true))
            {
                //Export all selected platform entries
                await ExportPlatformEntriesInternalAsync(zipArchive, exportOptions, progressCallback, сancellationToken);

                //Export all selected  modules
                await ExportModulesInternalAsync(zipArchive, exportOptions, progressCallback, сancellationToken);

                //Write system information about exported modules
                var manifestZipEntry = zipArchive.CreateEntry(ManifestZipEntryName, CompressionLevel.Optimal);

                //After all modules exported need write export manifest part
                using (var stream = manifestZipEntry.Open())
                {
                    exportOptions.SerializeJson(stream, GetJsonSerializer());
                }
            }
        }
예제 #2
0
        public void Export(Stream outStream, PlatformExportManifest manifest, Action <ExportImportProgressInfo> progressCallback)
        {
            if (manifest == null)
            {
                throw new ArgumentNullException("manifest");
            }

            using (var package = Package.Open(outStream, FileMode.Create))
            {
                //Export all selected platform entries
                ExportPlatformEntriesInternal(package, manifest, progressCallback);
                //Export all selected  modules
                ExportModulesInternal(package, manifest, progressCallback);

                //Write system information about exported modules
                var manifestPart = package.CreatePart(_manifestPartUri, "application/javascript");

                //After all modules exported need write export manifest part
                using (var stream = manifestPart.GetStream())
                {
                    manifest.SerializeJson(stream, GetJsonSerializer());
                }
            }
        }
예제 #3
0
        public void Export(Stream outStream, PlatformExportManifest manifest, Action <ExportImportProgressInfo> progressCallback)
        {
            if (manifest == null)
            {
                throw new ArgumentNullException("manifest");
            }

            using (var zipArchive = new ZipArchive(outStream))
            {
                //Export all selected platform entries
                ExportPlatformEntriesInternal(zipArchive, manifest, progressCallback);
                //Export all selected  modules
                ExportModulesInternal(zipArchive, manifest, progressCallback);

                //Write system information about exported modules
                var manifestZipEntry = zipArchive.CreateEntry(_manifestZipEntryName, CompressionLevel.Optimal);

                //After all modules exported need write export manifest part
                using (var stream = manifestZipEntry.Open())
                {
                    manifest.SerializeJson(stream, GetJsonSerializer());
                }
            }
        }