本文整理汇总了C#中Mono.Addins.Description.AddinDescription.TransferCoreProperties方法的典型用法代码示例。如果您正苦于以下问题:C# AddinDescription.TransferCoreProperties方法的具体用法?C# AddinDescription.TransferCoreProperties怎么用?C# AddinDescription.TransferCoreProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Addins.Description.AddinDescription
的用法示例。
在下文中一共展示了AddinDescription.TransferCoreProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
/// <summary>
/// Load an add-in description from a text reader
/// </summary>
/// <param name='reader'>
/// The text reader
/// </param>
/// <param name='basePath'>
/// The path to be used to resolve relative file paths.
/// </param>
public static AddinDescription Read(TextReader reader, string basePath)
{
AddinDescription config = new AddinDescription ();
try {
config.configDoc = new XmlDocument ();
config.configDoc.Load (reader);
} catch (Exception ex) {
throw new InvalidOperationException ("The add-in configuration file is invalid: " + ex.Message, ex);
}
XmlElement elem = config.configDoc.DocumentElement;
if (elem.LocalName == "ExtensionModel")
return config;
XmlElement varsElem = (XmlElement) elem.SelectSingleNode ("Variables");
if (varsElem != null) {
foreach (XmlNode node in varsElem.ChildNodes) {
XmlElement prop = node as XmlElement;
if (prop == null)
continue;
if (config.variables == null)
config.variables = new Dictionary<string, string> ();
config.variables [prop.LocalName] = prop.InnerText;
}
}
config.id = elem.GetAttribute ("id");
config.ns = elem.GetAttribute ("namespace");
config.name = elem.GetAttribute ("name");
config.version = elem.GetAttribute ("version");
config.compatVersion = elem.GetAttribute ("compatVersion");
config.author = elem.GetAttribute ("author");
config.url = elem.GetAttribute ("url");
config.copyright = elem.GetAttribute ("copyright");
config.description = elem.GetAttribute ("description");
config.category = elem.GetAttribute ("category");
config.basePath = elem.GetAttribute ("basePath");
config.domain = "global";
string s = elem.GetAttribute ("isRoot");
if (s.Length == 0) s = elem.GetAttribute ("isroot");
config.isroot = GetBool (s, false);
config.defaultEnabled = GetBool (elem.GetAttribute ("defaultEnabled"), true);
string prot = elem.GetAttribute ("flags");
if (prot.Length == 0)
config.flags = AddinFlags.None;
else
config.flags = (AddinFlags) Enum.Parse (typeof(AddinFlags), prot);
XmlElement localizerElem = (XmlElement) elem.SelectSingleNode ("Localizer");
if (localizerElem != null)
config.localizer = new ExtensionNodeDescription (localizerElem);
XmlElement headerElem = (XmlElement) elem.SelectSingleNode ("Header");
if (headerElem != null) {
foreach (XmlNode node in headerElem.ChildNodes) {
XmlElement prop = node as XmlElement;
if (prop == null)
continue;
config.Properties.SetPropertyValue (prop.LocalName, prop.InnerText, prop.GetAttribute ("locale"));
}
}
config.TransferCoreProperties (false);
if (config.id.Length > 0)
config.hasUserId = true;
return config;
}