Пример #1
0
        /// <summary>
        /// Retrieve an enumerable type
        /// </summary>
        /// <param name="enumerable"></param>
        /// <returns></returns>
        private JObject GetJSONEnumerableType(Type enumerable)
        {
            JObject values = new JObject();

            if (!enumerable.IsEnum)
            {
                return(values);
            }

            string[] valueString = enumerable.GetEnumNames();

            values["Name"] = enumerable.Name;
            string area = DSDatabase.GetArea(enumerable.Namespace);

            if (area != null)
            {
                values["Area"] = area;
            }

            int i = 0;

            foreach (int value in enumerable.GetEnumValues())
            {
                JObject enumValue = new JObject
                {
                    ["Label"] = Field + "_" + valueString[i].ToUpper(),
                    ["Name"]  = valueString[i]
                };
                values[value.ToString()] = enumValue;
                i++;
            }

            return(values);
        }
Пример #2
0
 /// <summary>
 /// Refer to the directory containing the picture of the enunmeration value
 /// </summary>
 /// <param name="enumeration"></param>
 /// <returns></returns>
 public static string GetDirectory(Type enumeration) => DSDatabase.GetArea(enumeration.Namespace) + "/" + enumeration.Name + "/";