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


C# AddinDescription.TransferCoreProperties方法代码示例

本文整理汇总了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;
        }
开发者ID:tritao,项目名称:flood,代码行数:82,代码来源:AddinDescription.cs


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