Exemplo n.º 1
0
        /// <summary>
        /// 通过 key 查找 BlockConfig。
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public BlockConfig GetBlockConfig(BlockConfigKey key)
        {
            if (key.Type == BlockConfigType.Config || XmlConfigFileSystem.IsCustomizing)
            {
                var path = key.GetFilePath();

                if (File.Exists(path))
                {
                    var xDoc = XDocument.Load(path);

                    var blockCfg = new BlockConfig
                    {
                        Key = key,
                        Xml = xDoc.Root
                    };

                    return(blockCfg);
                }
            }

            return(null);
        }