本文整理汇总了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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}