当前位置: 首页>>代码示例>>C#>>正文


C# ContentType.AreTypeAndSubTypeEqual方法代码示例

本文整理汇总了C#中ContentType.AreTypeAndSubTypeEqual方法的典型用法代码示例。如果您正苦于以下问题:C# ContentType.AreTypeAndSubTypeEqual方法的具体用法?C# ContentType.AreTypeAndSubTypeEqual怎么用?C# ContentType.AreTypeAndSubTypeEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentType的用法示例。


在下文中一共展示了ContentType.AreTypeAndSubTypeEqual方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateUniqueUri

 private Uri GenerateUniqueUri(ContentType contentType)
 {
     string str3;
     string contentCounterKey = this.GetContentCounterKey(contentType);
     string key = this.GetContentCounterKey(XpsS0Markup.FixedDocumentContentType);
     int num = this._contentTypes[contentCounterKey];
     int num2 = 0;
     Guid guid = Guid.NewGuid();
     if (this._contentTypes.ContainsKey(key))
     {
         num2 = this._contentTypes[key] - 1;
     }
     if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.DocumentSequenceContentType))
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "{0}.fdseq", new object[] { contentCounterKey });
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.FixedDocumentContentType))
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "/Documents/{0}/FixedDocument.fdoc", new object[] { num });
         string str4 = this.GetContentCounterKey(XpsS0Markup.FixedPageContentType);
         this._contentTypes[str4] = 1;
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.FixedPageContentType))
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "/Documents/{0}/Pages/{1}.fpage", new object[] { num2, num });
     }
     else if (contentCounterKey.Equals("Dictionary", StringComparison.OrdinalIgnoreCase))
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "/Resources/{0}.dict", new object[] { guid });
     }
     else if (contentCounterKey.Equals("Font", StringComparison.OrdinalIgnoreCase))
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "/Resources/{0}.ttf", new object[] { guid });
     }
     else if (contentCounterKey.Equals("ColorContext", StringComparison.OrdinalIgnoreCase))
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "/Resources/{0}.icc", new object[] { guid });
     }
     else if (contentCounterKey.Equals("ResourceDictionary", StringComparison.OrdinalIgnoreCase))
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "/Resources/{0}.dict", new object[] { guid });
     }
     else if (contentCounterKey.Equals("Image", StringComparison.OrdinalIgnoreCase))
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "/Resources/{0}.{1}", new object[] { guid, LookupImageExtension(contentType) });
     }
     else
     {
         str3 = string.Format(CultureInfo.InvariantCulture, "/{0}s/{0}_{1}.xaml", new object[] { contentCounterKey, num });
     }
     num++;
     this._contentTypes.Remove(contentCounterKey);
     this._contentTypes[contentCounterKey] = num;
     return PackUriHelper.CreatePartUri(new Uri(str3, UriKind.Relative));
 }
开发者ID:,项目名称:,代码行数:55,代码来源:

示例2: GeneratePart

 public PackagePart GeneratePart(ContentType contentType, Uri partUri)
 {
     if (this._metroPackage == null)
     {
         throw new ObjectDisposedException("XpsManager");
     }
     if (!this.IsWriter)
     {
         throw new XpsPackagingException(SR.Get("ReachPackaging_OnlyWriters"));
     }
     if (contentType == null)
     {
         throw new ArgumentNullException("contentType");
     }
     if (contentType.ToString().Length == 0)
     {
         throw new ArgumentException("contentType");
     }
     CompressionOption compressionOption = this._compressionOption;
     if ((contentType.AreTypeAndSubTypeEqual(XpsS0Markup.JpgContentType) || contentType.AreTypeAndSubTypeEqual(XpsS0Markup.PngContentType)) || (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.TifContentType) || contentType.AreTypeAndSubTypeEqual(XpsS0Markup.WdpContentType)))
     {
         compressionOption = CompressionOption.NotCompressed;
     }
     PackagePart part = this._metroPackage.CreatePart(partUri, contentType.ToString(), compressionOption);
     this._cachedParts[partUri] = part;
     return part;
 }
开发者ID:,项目名称:,代码行数:27,代码来源:

示例3: LookupImageExtension

 private static string LookupImageExtension(ContentType contentType)
 {
     string pngExtension = XpsS0Markup.PngExtension;
     if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.JpgContentType))
     {
         return XpsS0Markup.JpgExtension;
     }
     if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.PngContentType))
     {
         return XpsS0Markup.PngExtension;
     }
     if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.TifContentType))
     {
         return XpsS0Markup.TifExtension;
     }
     if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.WdpContentType))
     {
         pngExtension = XpsS0Markup.WdpExtension;
     }
     return pngExtension;
 }
开发者ID:,项目名称:,代码行数:21,代码来源:

示例4: SupportedImageType

 public static bool SupportedImageType(ContentType imageContentType)
 {
     bool flag = false;
     if ((!imageContentType.AreTypeAndSubTypeEqual(XpsS0Markup.JpgContentType) && !imageContentType.AreTypeAndSubTypeEqual(XpsS0Markup.PngContentType)) && (!imageContentType.AreTypeAndSubTypeEqual(XpsS0Markup.TifContentType) && !imageContentType.AreTypeAndSubTypeEqual(XpsS0Markup.WdpContentType)))
     {
         return flag;
     }
     return true;
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例5: GetContentCounterKey

 private string GetContentCounterKey(ContentType contentType)
 {
     string subTypeComponent;
     if (ContentType.Empty.AreTypeAndSubTypeEqual(contentType))
     {
         throw new ArgumentException("contentType");
     }
     if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.DocumentSequenceContentType))
     {
         subTypeComponent = "FixedDocumentSequence";
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.FixedDocumentContentType))
     {
         subTypeComponent = "FixedDocument";
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.FixedPageContentType))
     {
         subTypeComponent = "FixedPage";
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.DocumentStructureContentType))
     {
         subTypeComponent = "DocumentStructure";
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.PrintTicketContentType))
     {
         subTypeComponent = "PrintTicket";
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.FontContentType))
     {
         subTypeComponent = "Font";
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.ColorContextContentType))
     {
         subTypeComponent = "ColorContext";
     }
     else if (contentType.AreTypeAndSubTypeEqual(XpsS0Markup.ResourceDictionaryContentType))
     {
         subTypeComponent = "ResourceDictionary";
     }
     else if (string.CompareOrdinal(contentType.TypeComponent.ToUpper(CultureInfo.InvariantCulture), "Image".ToUpper(CultureInfo.InvariantCulture)) == 0)
     {
         subTypeComponent = "Image";
     }
     else
     {
         subTypeComponent = contentType.SubTypeComponent;
     }
     if (!this._contentTypes.ContainsKey(subTypeComponent))
     {
         this._contentTypes[subTypeComponent] = 1;
     }
     return subTypeComponent;
 }
开发者ID:,项目名称:,代码行数:53,代码来源:


注:本文中的ContentType.AreTypeAndSubTypeEqual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。