示例#1
0
            /// <summary>
            ///
            /// </summary>
            /// <returns></returns>
            public override int GetHashCode()
            {
#pragma warning disable RECS0025 // Non-readonly field referenced in 'GetHashCode()'
                return(unchecked (TargetType.GetHashCode() ^ BindingAttr.GetHashCode()));

#pragma warning restore RECS0025 // Non-readonly field referenced in 'GetHashCode()'
            }
        public override int GetHashCode()
        {
            int hashCode = 1298308050;

            hashCode = hashCode * -1521134295 + TargetType.GetHashCode();
            hashCode = hashCode * -1521134295 + BindingFlags.GetHashCode();
            hashCode = hashCode * -1521134295 + MemberName.GetHashCode();
            return(hashCode);
        }
            public override int GetHashCode()
            {
                int result = 0;

                result ^= StringComparer.Ordinal.GetHashCode(name);
                result ^= flags.GetHashCode();

                return(result);
            }
示例#4
0
 public override int GetHashCode()
 {
     unchecked
     {
         // FNV Hash
         var hash = (int)2166136261;
         hash = hash * 16777619 ^ Type.GetHashCode();
         hash = hash * 16777619 ^ MemberName.GetHashCode();
         hash = hash * 16777619 ^ BindingFlags.GetHashCode();
         return(hash);
     }
 }
示例#5
0
        public override int GetHashCode()
        {
            int hashCode = -25691114;

            hashCode = hashCode * -1521134295 + TargetType.GetHashCode();
            hashCode = hashCode * -1521134295 + BindingFlags.GetHashCode();
            for (int i = 0, count = ParameterTypes.Length; i < count; ++i)
            {
                hashCode = hashCode * -1521134295 + ParameterTypes[i].GetHashCode();
            }
            return(hashCode);
        }
示例#6
0
            public override int GetHashCode()
            {
                int result = 0;

                result ^= flags.GetHashCode();

                foreach (var type in types)
                {
                    result ^= type.GetHashCode();
                }

                return(result);
            }
            public override int GetHashCode()
            {
                int result = 0;

                result ^= StringComparer.Ordinal.GetHashCode(name);
                result ^= flags.GetHashCode();

                foreach (var type in types)
                {
                    result ^= type.GetHashCode();
                }

                return(result);
            }
示例#8
0
 public override int ComputeKey()
 {
     unchecked {
         var hashCode = BindingFlags.GetHashCode();
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsField.GetHashCode();
         hashCode = (hashCode * 397) ^ (FallbackAction != null ? FallbackAction.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (GetterFallbackAction != null ? GetterFallbackAction.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SetterFallbackAction != null ? SetterFallbackAction.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (InterfaceName != null ? InterfaceName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FallbackMode != null ? FallbackMode.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#9
0
        public override int GetHashCode()
        {
            int hashCode = -937504810;

            hashCode = hashCode * -1521134295 + TargetType.GetHashCode();
            hashCode = hashCode * -1521134295 + BindingFlags.GetHashCode();
            hashCode = hashCode * -1521134295 + Name.GetHashCode();
            for (int i = 0, count = ParameterTypes.Length; i < count; ++i)
            {
                hashCode = hashCode * -1521134295 + ParameterTypes[i].GetHashCode();
            }
            for (int i = 0, count = GenericTypes.Length; i < count; ++i)
            {
                hashCode = hashCode * -1521134295 + GenericTypes[i].GetHashCode();
            }
            return(hashCode);
        }
示例#10
0
            public override int GetHashCode()
            {
                int hashCode = 0;

                unchecked {
                    if (MemberType != null)
                    {
                        hashCode += 1000000007 * MemberType.GetHashCode();
                    }
                    hashCode += 1000000009 * BindingFlags.GetHashCode();
                    if (Name != null)
                    {
                        hashCode += 1000000021 * Name.GetHashCode();
                    }
                    hashCode += 1000000033 * Token.GetHashCode();
                }
                return(hashCode);
            }
示例#11
0
        public override int GetHashCode()
        {
            int hash = TargetType.GetHashCode() + (int)MemberTypes * Name.GetHashCode() + BindingFlags.GetHashCode();

            if (MemberInfo != null)
            {
                hash += MemberInfo.GetHashCode();
            }
            for (int i = 0; i < ParamTypes.Length; i++)
            {
                hash += ParamTypes[i].GetHashCode();
            }
            return(hash);
        }
示例#12
0
    public static void      Snapshot(object o, BindingFlags bindingFlags, Object context, string prefix, string suffix)
    {
        StringBuilder buffer = Utility.GetBuffer();

        buffer.Length = 0;
        buffer.Append(InternalNGDebug.DataStartChar);

        if (o != null)
        {
            System.Type type = o.GetType();

            if (prefix != null)
            {
                buffer.Append(prefix);
            }
            buffer.Append(type.Name);
            if (suffix != null)
            {
                buffer.Append(suffix);
            }

            if (type.IsPrimitive() == true || type == typeof(string) || type == typeof(decimal))
            {
                buffer.Append("=");
                buffer.Append(o);
            }
            else
            {
                FieldInfo[] fields;
                int         hash = type.GetHashCode() + bindingFlags.GetHashCode();

                if (NGDebug.cachedFieldInfos.TryGetValue(hash, out fields) == false)
                {
                    fields = type.GetFields(bindingFlags);
                    NGDebug.cachedFieldInfos.Add(hash, fields);
                }

                for (int i = 0; i < fields.Length; i++)
                {
                    NGDebug.SubSnap(buffer, fields[i].FieldType, fields[i].Name, fields[i].GetValue(o));
                }

                PropertyInfo[] properties;

                if (NGDebug.cachedPropertiesInfos.TryGetValue(hash, out properties) == false)
                {
                    properties = type.GetProperties(bindingFlags);

                    List <PropertyInfo> filteredProperties = new List <PropertyInfo>(properties.Length);

                    for (int i = 0; i < properties.Length; i++)
                    {
                        if (properties[i].CanRead == false ||
                            properties[i].GetGetMethod(false) == null ||
                            properties[i].GetIndexParameters().Length != 0)
                        {
                            continue;
                        }

                        filteredProperties.Add(properties[i]);
                    }

                    properties = filteredProperties.ToArray();
                    NGDebug.cachedPropertiesInfos.Add(hash, properties);
                }

                for (int i = 0; i < properties.Length; i++)
                {
                    try
                    {
                        NGDebug.SubSnap(buffer, properties[i].PropertyType, properties[i].Name, properties[i].GetValue(o));
                    }
                    catch (System.Exception ex)
                    {
                        InternalNGDebug.VerboseLogException(ex);
                    }
                }
            }
        }
        else
        {
            buffer.Append("NULL");
        }

        buffer.Append(InternalNGDebug.DataEndChar);
        Debug.Log(Utility.ReturnBuffer(buffer), context);
    }
示例#13
0
    public static void      StaticSnapshot(System.Type type)
    {
        BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;

        FieldInfo[]   fields;
        int           hash   = type.GetHashCode() + bindingFlags.GetHashCode();
        StringBuilder buffer = Utility.GetBuffer();

        buffer.Length = 0;
        buffer.Append(InternalNGDebug.DataStartChar);
        buffer.Append(type.Name);

        if (NGDebug.cachedFieldInfos.TryGetValue(hash, out fields) == false)
        {
            fields = type.GetFields(bindingFlags);
            NGDebug.cachedFieldInfos.Add(hash, fields);
        }

        for (int i = 0; i < fields.Length; i++)
        {
            NGDebug.SubSnap(buffer, fields[i].FieldType, fields[i].Name, fields[i].GetValue(null));
        }

        PropertyInfo[] properties;

        if (NGDebug.cachedPropertiesInfos.TryGetValue(hash, out properties) == false)
        {
            properties = type.GetProperties(bindingFlags);

            List <PropertyInfo> filteredProperties = new List <PropertyInfo>(properties.Length);

            for (int i = 0; i < properties.Length; i++)
            {
                if (properties[i].CanRead == false ||
                    properties[i].GetGetMethod(false) == null ||
                    properties[i].GetIndexParameters().Length != 0)
                {
                    continue;
                }

                filteredProperties.Add(properties[i]);
            }

            properties = filteredProperties.ToArray();
            NGDebug.cachedPropertiesInfos.Add(hash, properties);
        }

        for (int i = 0; i < properties.Length; i++)
        {
            try
            {
                NGDebug.SubSnap(buffer, properties[i].PropertyType, properties[i].Name, properties[i].GetValue(null));
            }
            catch (System.Exception ex)
            {
                InternalNGDebug.VerboseLogException(ex);
            }
        }

        buffer.Append(InternalNGDebug.DataEndChar);
        Debug.Log(Utility.ReturnBuffer(buffer));
    }
示例#14
0
        public override int GetHashCode()
        {
            int hash = TargetType.GetHashCode() + (int)MemberTypes * Name.GetHashCode() + BindingFlags.GetHashCode() + IsReadOperation.GetHashCode();

            for (int i = 0; i < ParamTypes.Length; i++)
            {
                hash += ParamTypes[i].GetHashCode() * (i + 1);
            }
            for (int i = 0; i < GenericTypes.Length; i++)
            {
                hash += GenericTypes[i].GetHashCode() * (i + 1);
            }
            return(hash);
        }