Пример #1
0
        // Token: 0x06000025 RID: 37 RVA: 0x000030E0 File Offset: 0x000012E0
        public static bool Has <T>(this Enum value, T check)
        {
            Type type = value.GetType();

            EnumerationExtensions._Value value2 = new EnumerationExtensions._Value(check, type);
            if (value2.Signed is long)
            {
                return((Convert.ToInt64(value) & value2.Signed.Value) == value2.Signed.Value);
            }
            return(value2.Unsigned is ulong && (Convert.ToUInt64(value) & value2.Unsigned.Value) == value2.Unsigned.Value);
        }
Пример #2
0
        public static bool Has <T>(this Enum value, T check)
        {
            Type type = value.GetType();

            EnumerationExtensions._Value obj = new EnumerationExtensions._Value((object)check, type);
            if ((ValueType)obj.Signed is long)
            {
                return((Convert.ToInt64((object)value) & obj.Signed.Value) == obj.Signed.Value);
            }
            return((ValueType)obj.Unsigned is ulong && ((long)Convert.ToUInt64((object)value) & (long)obj.Unsigned.Value) == (long)obj.Unsigned.Value);
        }
Пример #3
0
        public static bool Has <T>(this Enum value, T check)
        {
            Type type = value.GetType();

            EnumerationExtensions._Value obj = new EnumerationExtensions._Value(check, type);
            if (obj.Signed.HasValue)
            {
                return((Convert.ToInt64(value) & obj.Signed.Value) == obj.Signed.Value);
            }
            if (obj.Unsigned.HasValue)
            {
                return(((long)Convert.ToUInt64(value) & (long)obj.Unsigned.Value) == (long)obj.Unsigned.Value);
            }
            return(false);
        }
        public static bool Has <T>(this Enum value, T check)
        {
            Type type = value.GetType();

            EnumerationExtensions._Value __Value = new EnumerationExtensions._Value((object)check, type);
            if (__Value.Signed.HasValue)
            {
                return((Convert.ToInt64(value) & __Value.Signed.Value) == __Value.Signed.Value);
            }
            if (!__Value.Unsigned.HasValue)
            {
                return(false);
            }
            return((Convert.ToUInt64(value) & __Value.Unsigned.Value) == __Value.Unsigned.Value);
        }
Пример #5
0
        public static T Remove <T>(this Enum value, T remove)
        {
            Type   type = value.GetType();
            object obj1 = (object)value;

            EnumerationExtensions._Value obj2 = new EnumerationExtensions._Value((object)remove, type);
            if (obj2.Signed.HasValue)
            {
                obj1 = (object)(Convert.ToInt64((object)value) & ~obj2.Signed.Value);
            }
            else if (obj2.Unsigned.HasValue)
            {
                obj1 = (object)(ulong)((long)Convert.ToUInt64((object)value) & ~(long)obj2.Unsigned.Value);
            }
            return((T)Enum.Parse(type, obj1.ToString()));
        }
Пример #6
0
        public static T Include <T>(this Enum value, T append)
        {
            Type   type = value.GetType();
            object obj1 = (object)value;

            EnumerationExtensions._Value obj2 = new EnumerationExtensions._Value((object)append, type);
            if ((ValueType)obj2.Signed is long)
            {
                obj1 = (object)(Convert.ToInt64((object)value) | obj2.Signed.Value);
            }
            else if ((ValueType)obj2.Unsigned is ulong)
            {
                obj1 = (object)(ulong)((long)Convert.ToUInt64((object)value) | (long)obj2.Unsigned.Value);
            }
            return((T)Enum.Parse(type, obj1.ToString()));
        }
        public static T Remove <T>(this Enum value, T remove)
        {
            Type   type = value.GetType();
            object num  = value;

            EnumerationExtensions._Value __Value = new EnumerationExtensions._Value((object)remove, type);
            if (__Value.Signed.HasValue)
            {
                num = Convert.ToInt64(value) & ~__Value.Signed.Value;
            }
            else if (__Value.Unsigned.HasValue)
            {
                num = Convert.ToUInt64(value) & ~__Value.Unsigned.Value;
            }
            return((T)Enum.Parse(type, num.ToString()));
        }
Пример #8
0
        // Token: 0x06000023 RID: 35 RVA: 0x00002FC8 File Offset: 0x000011C8
        public static T Include <T>(this Enum value, T append)
        {
            Type   type = value.GetType();
            object obj  = value;

            EnumerationExtensions._Value value2 = new EnumerationExtensions._Value(append, type);
            if (value2.Signed is long)
            {
                obj = (Convert.ToInt64(value) | value2.Signed.Value);
            }
            else if (value2.Unsigned is ulong)
            {
                obj = (Convert.ToUInt64(value) | value2.Unsigned.Value);
            }
            return((T)((object)Enum.Parse(type, obj.ToString())));
        }