Example #1
0
        /// <summary>
        /// 解析插件
        /// </summary>
        /// <param name="configuration">配置项</param>
        private void ParseAddIn(IConfiguration configuration)
        {
            Guard.ArgumentNotNull(configuration, "configuration");
            foreach (IConfiguration config in configuration.Children)
            {
                switch (config.Name)
                {
                case "Path":      // 插件单元路径,此节点下定义具体的插件单元
                    if (config.Attributes["name"] == null)
                    {
                        throw new AddInException("必须为Path节点定义\"name\"属性。");
                    }

                    string        name   = config.Attributes["name"];
                    ExtensionPath exPath = GetExtensionPath(name);
                    if (config.Attributes["label"] != null)
                    {
                        exPath.Label = config.Attributes["label"];
                    }
                    if (config.Attributes["buildstartup"] != null)
                    {
                        exPath.BuildStartUp = bool.Parse(config.Attributes["buildstartup"]);
                    }
                    ExtensionPath.SetUp(exPath, config);
                    break;
                }
            }
        }