/* ==============================================================================
 * 功能描述：ParameterUtil  
 * 创 建 者：Garrett
 * 创建日期：2019/6/25 16:15:58
 * ==============================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JBIM.Component;

namespace RevitToJBim.Common
{
    /// <summary>
    /// ParameterUtil
    /// </summary>
    public class ParameterUtil
    {
        private static Dictionary<string, ParameterDefinition> ParameterDefinitionDic { get; set; }
        /// <summary>
        /// 跟据参数名称查找参数定义
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ParameterDefinition FindParameterDefine(string name)
        {
            if(ParameterDefinitionDic == null)
                ParameterDefinitionDic = new Dictionary<string, ParameterDefinition>();
            ParameterDefinition definition = null;
            if (!ParameterDefinitionDic.TryGetValue(name, out definition))
            {
                definition=new ParameterDefinition();
                definition.Name = name;
                definition.ParameterType = ParameterType.Text;
                definition.Visible = true;
            }

            return definition;
        }

    }
}
