本文整理汇总了C#中Mono.Addins.Description.AddinDescription.SaveToXml方法的典型用法代码示例。如果您正苦于以下问题:C# AddinDescription.SaveToXml方法的具体用法?C# AddinDescription.SaveToXml怎么用?C# AddinDescription.SaveToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Addins.Description.AddinDescription
的用法示例。
在下文中一共展示了AddinDescription.SaveToXml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveFormatted
public static void SaveFormatted (AddinDescription adesc)
{
XmlDocument doc = adesc.SaveToXml ();
XmlFormatter formatter = new XmlFormatter ();
TextStylePolicy textPolicy = new TextStylePolicy (80, 4, false, false, true, EolMarker.Unix);
XmlFormattingPolicy xmlPolicy = new XmlFormattingPolicy ();
XmlFormatingSettings f = new XmlFormatingSettings ();
f.ScopeXPath.Add ("*/*");
f.EmptyLinesBeforeStart = 1;
f.EmptyLinesAfterEnd = 1;
xmlPolicy.Formats.Add (f);
f = new XmlFormatingSettings ();
f.ScopeXPath.Add ("Addin");
f.AttributesInNewLine = true;
f.AlignAttributes = true;
f.AttributesInNewLine = false;
xmlPolicy.Formats.Add (f);
string xml = formatter.FormatXml (textPolicy, xmlPolicy, doc.OuterXml);
File.WriteAllText (adesc.FileName, xml);
}
示例2: SaveFormattedXml
public static string SaveFormattedXml (PolicyContainer policies, AddinDescription adesc)
{
XmlDocument doc = adesc.SaveToXml ();
TextStylePolicy textPolicy = policies.Get<TextStylePolicy> (DesktopService.GetMimeTypeInheritanceChain ("application/x-addin+xml"));
XmlFormattingPolicy xmlPolicy = policies.Get<XmlFormattingPolicy> (DesktopService.GetMimeTypeInheritanceChain ("application/x-addin+xml"));
return XmlFormatter.FormatXml (textPolicy, xmlPolicy, doc.OuterXml);
}