CreatePartUri() static private method

static private CreatePartUri ( string path ) : Uri
path string
return System.Uri
示例#1
0
        private void WriteManifest(Package package, int minimumManifestVersion)
        {
            Uri targetUri = UriUtility.CreatePartUri(this.Id + Constants.ManifestExtension);

            package.CreateRelationship(targetUri, TargetMode.Internal, "http://schemas.microsoft.com/packaging/2010/07/manifest");
            using (Stream stream = package.CreatePart(targetUri, "application/octet", CompressionOption.Maximum).GetStream())
            {
                Manifest.Create(this).Save(stream, minimumManifestVersion);
            }
        }
示例#2
0
 private static void CreatePart(Package package, string path, Stream sourceStream)
 {
     if (!PackageHelper.IsManifest(path))
     {
         Uri partUri = UriUtility.CreatePartUri(path);
         using (Stream stream = package.CreatePart(partUri, "application/octet", CompressionOption.Maximum).GetStream())
         {
             sourceStream.CopyTo(stream);
         }
     }
 }
示例#3
0
        private void WriteManifest(Package package)
        {
            Uri uri = UriUtility.CreatePartUri(Id + Constants.ManifestExtension);

            // Create the manifest relationship
            package.CreateRelationship(uri, TargetMode.Internal, Constants.SchemaNamespace + ManifestRelationType);

            // Create the part
            PackagePart packagePart = package.CreatePart(uri, DefaultContentType, CompressionOption.Maximum);

            using (Stream stream = packagePart.GetStream()) {
                Manifest manifest = Manifest.Create(this);
                manifest.Save(stream);
            }
        }
示例#4
0
        private void WriteManifest(System.IO.Packaging.Package package, int minimumManifestVersion)
        {
            Uri uri = UriUtility.CreatePartUri(Id + Constants.ManifestExtension);

            // Create the manifest relationship
            package.CreateRelationship(uri, System.IO.Packaging.TargetMode.Internal, Constants.PackageRelationshipNamespace + ManifestRelationType);

            // Create the part
            var packagePart = package.CreatePart(uri, DefaultContentType, System.IO.Packaging.CompressionOption.Maximum);

            using (Stream stream = packagePart.GetStream())
            {
                Manifest manifest = Manifest.Create(this);
                manifest.Save(stream, minimumManifestVersion);
            }
        }
示例#5
0
        private static void CreatePart(Package package, string path, Stream sourceStream)
        {
            if (PackageUtility.IsManifest(path))
            {
                return;
            }

            Uri uri = UriUtility.CreatePartUri(path);

            // Create the part
            PackagePart packagePart = package.CreatePart(uri, DefaultContentType, CompressionOption.Maximum);

            using (Stream stream = packagePart.GetStream()) {
                sourceStream.CopyTo(stream);
            }
        }
        private void WriteManifest(Package package, int minimumManifestVersion)
        {
            Uri uri = UriUtility.CreatePartUri(Id + Constants.ManifestExtension);

            // Create the manifest relationship
            package.CreateRelationship(uri, TargetMode.Internal,
                                       Constants.PackageRelationshipNamespace + ManifestRelationType);

            // Create the part
            PackagePart packagePart = package.CreatePart(uri, DefaultContentType, CompressionOption.Maximum);

            using (Stream stream = packagePart.GetStream())
            {
                Manifest manifest = Manifest.Create(this);
                //if (PackageAssemblyReferences.Any())
                //{
                //    manifest.Metadata.References = new List<ManifestReference>(
                //        PackageAssemblyReferences.Select(reference => new ManifestReference {File = reference.File}));
                //}
                manifest.Save(stream, minimumManifestVersion);
            }
        }