Esempio n. 1
0
        public void ImportCodeEnum <TEnum>(string enumName)
            where TEnum : struct, IComparable, IFormattable, IConvertible
        {
            Contract.Requires(!string.IsNullOrEmpty(enumName));
            Contract.Requires(Actions.Count == 0, "Why are you importing an Enum after the DB has been loaded?");

            var script_enum = MegaloScriptEnum.ForEnum <TEnum>(enumName);

            Enums.Add(script_enum);
        }
Esempio n. 2
0
        internal static MegaloScriptEnum ForEnum <TEnum>(string name)
            where TEnum : struct, IComparable, IFormattable, IConvertible
        {
            var result = new MegaloScriptEnum {
                Name       = name,
                IsCodeEnum = true
            };

            result.ForEnumPopulateMembers(Reflection.EnumUtil <TEnum> .Names, Reflection.EnumUtil <TEnum> .Values);

            return(result);
        }
Esempio n. 3
0
        static void ToFlagsNameValidateFlags(MegaloScriptEnum e, uint flags)
        {
            uint bitmask = Bits.GetBitmaskEnum((uint)e.Members.Count);

            Contract.Assert(Bitwise.Flags.Test(flags, ~bitmask) == false);
        }