ContentTypeIsValid() public static method

public static ContentTypeIsValid ( string contentType ) : void
contentType string
return void
示例#1
0
        protected internal PackagePart(Package package, Uri partUri, string contentType, CompressionOption compressionOption)
        {
            Check.Package(package);
            Check.PartUri(partUri);
            Check.ContentTypeIsValid(contentType);

            Package              = package;
            Uri                  = partUri;
            ContentType          = contentType;
            CompressionOption    = compressionOption;
            RelationshipsPartUri = PackUriHelper.GetRelationshipPartUri(Uri);
        }
示例#2
0
        public PackagePart CreatePart(Uri partUri, string contentType, CompressionOption compressionOption)
        {
            CheckIsReadOnly();
            Check.PartUri(partUri);
            Check.ContentTypeIsValid(contentType);

            if (PartExists(partUri))
            {
                throw new InvalidOperationException("This partUri is already contained in the package");
            }

            PackagePart part = CreatePartCore(partUri, contentType, compressionOption);

            PartsCollection.Parts.Add(part);
            return(part);
        }