예제 #1
0
        public static List <EnumInfo> ParseString(this EnumParams enumParams, string[] nameArray)
        {
            List <EnumInfo> result = new List <EnumInfo>();

            foreach (string name in nameArray)
            {
                EnumInfo enumInfo = enumParams.ParseString(name);
                if (enumInfo == null)
                {
                    continue;
                }

                result.Add(enumInfo);
            }

            return(result);
        }
예제 #2
0
        public static List <EnumInfo> ParseInt(this EnumParams enumParams, int[] valueArray)
        {
            List <EnumInfo> result = new List <EnumInfo>();

            foreach (int value in valueArray)
            {
                EnumInfo enumInfo = enumParams.ParseInt(value);
                if (enumInfo == null)
                {
                    continue;
                }

                result.Add(enumInfo);
            }

            return(result);
        }
예제 #3
0
        public static EnumInfo NewEnum(this EnumParams enumParams, string name, int value)
        {
            enumParams.Counter = value;

            EnumInfo cusEnum = new EnumInfo();

            cusEnum.Name  = name;
            cusEnum.Value = value;

            enumParams.Members.Add(cusEnum);

            if (!enumParams.Keys.ContainsKey(cusEnum.Name))
            {
                enumParams.Keys.Add(cusEnum.Name, cusEnum);
            }

            if (!enumParams.Values.ContainsKey(cusEnum.Value))
            {
                enumParams.Values.Add(cusEnum.Value, cusEnum);
            }

            return(cusEnum);
        }
예제 #4
0
 public static EnumInfo ParseString(this EnumParams enumParams, string name)
 {
     return(enumParams.Keys.ContainsKey(name) ? enumParams.Keys[name] : null);
 }
예제 #5
0
 public static EnumInfo NewEnum(this EnumParams enumParams, string name)
 {
     return(NewEnum(enumParams, name, ++enumParams.Counter));
 }
예제 #6
0
 public static EnumInfo ParseInt(this EnumParams enumParams, int value)
 {
     return(enumParams.Values.ContainsKey(value) ? enumParams.Values[value] : null);
 }