using System; using System.Collections.Generic; using Assets.Scripts; using Swan; namespace RemoteControl.Utils { internal static class Extensions { internal static Dictionary AsLookupDict(this EnumCollection collection, bool lowercase) where TEnum : Enum, IConvertible, new() where TValue : IConvertible, IEquatable { var result = new Dictionary(); for (var i = 0; i < collection.Length; i++) { var name = collection.Names[i]; if (lowercase) { name = name.ToLowerInvariant(); } var value = collection.Values[i]; result.Add(name, value); result.Add(collection.ValuesAsInts[i].ToStringInvariant(), value); } return result; } } }