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); }
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); }
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); }
public static EnumInfo ParseString(this EnumParams enumParams, string name) { return(enumParams.Keys.ContainsKey(name) ? enumParams.Keys[name] : null); }
public static EnumInfo NewEnum(this EnumParams enumParams, string name) { return(NewEnum(enumParams, name, ++enumParams.Counter)); }
public static EnumInfo ParseInt(this EnumParams enumParams, int value) { return(enumParams.Values.ContainsKey(value) ? enumParams.Values[value] : null); }