Exemplo n.º 1
0
        public static void Override(DependencyProperty dp, Type forType, PropertyMetadata metadata)
        {
            List <MetadataEntry> metadatas;
            WeakType             key = new WeakType(forType);

            if (!_typePropertyOverrides.TryGetValue(key, out metadatas))
            {
                metadatas = new List <MetadataEntry>();
                _typePropertyOverrides[key] = metadatas;
            }

            metadatas.Add(new MetadataEntry(dp, metadata));
        }
Exemplo n.º 2
0
        public static void Register(DependencyProperty dp, string name, Type propertyType, Type ownerType, PropertyMetadata metadata)
        {
            List <PropertyEntry> properties;
            WeakType             key = new WeakType(ownerType);

            if (!_typeProperties.TryGetValue(key, out properties))
            {
                properties           = new List <PropertyEntry>();
                _typeProperties[key] = properties;
            }

            properties.Add(new PropertyEntry(name, dp, propertyType, metadata));
        }
Exemplo n.º 3
0
        private static void RestoreDependencyProperties(Type ownerType)
        {
            List <PropertyEntry> properties;
            WeakType             key = new WeakType(ownerType);

            if (_typeProperties.TryGetValue(key, out properties))
            {
                foreach (PropertyEntry prop in properties)
                {
                    Type propertyType = prop.Type;
                    if (propertyType != null)
                    {
                        DependencyProperty.RegisterCommon(prop.Name, propertyType, ownerType, prop.Metadata.Create(), prop.Property);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private static void RestoreDependencyPropertyOverrides(Type forType)
        {
            List <MetadataEntry> metadatas;
            WeakType             key = new WeakType(forType);

            if (_typePropertyOverrides.TryGetValue(key, out metadatas))
            {
                // Remove the reference as new overrides will be created during the following OverrideMetadata calls
                _typePropertyOverrides.Remove(key);

                // Perform DependencyProperty overrides
                foreach (MetadataEntry metadata in metadatas)
                {
                    PropertyInfo pi = forType.GetProperty(metadata.PropertyName + "Property", BindingFlags.FlattenHierarchy | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                    if (pi == null)
                    {
                        Log.Error("DependencyProperty '" + forType.FullName + "." + metadata.PropertyName + "' not found.");
                        continue;
                    }

                    DependencyProperty dp = pi.GetValue(null) as DependencyProperty;
                    if (dp == null)
                    {
                        Log.Error("DependencyProperty '" + forType.FullName + "." + metadata.PropertyName + "' not found.");
                        continue;
                    }

                    if (dp.IsDisposed)
                    {
                        Log.Error("DependencyProperty '" + forType.FullName + "." + metadata.PropertyName + "' already disposed.");
                        continue;
                    }

                    dp.OverrideMetadata(forType, metadata.Create());
                }
            }
        }
Exemplo n.º 5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TrainerId != 0UL)
            {
                hash ^= TrainerId.GetHashCode();
            }
            if (U2 != 0)
            {
                hash ^= U2.GetHashCode();
            }
            if (ScoutMethod != 0)
            {
                hash ^= ScoutMethod.GetHashCode();
            }
            if (TrainerBaseId != 0)
            {
                hash ^= TrainerBaseId.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Rarity != 0)
            {
                hash ^= Rarity.GetHashCode();
            }
            if (Role != 0)
            {
                hash ^= Role.GetHashCode();
            }
            if (MonsterId != 0UL)
            {
                hash ^= MonsterId.GetHashCode();
            }
            if (Move1Id != 0)
            {
                hash ^= Move1Id.GetHashCode();
            }
            if (Move2Id != 0)
            {
                hash ^= Move2Id.GetHashCode();
            }
            if (Move3Id != 0)
            {
                hash ^= Move3Id.GetHashCode();
            }
            if (Move4Id != 0)
            {
                hash ^= Move4Id.GetHashCode();
            }
            if (WeakType != 0)
            {
                hash ^= WeakType.GetHashCode();
            }
            if (U14 != 0)
            {
                hash ^= U14.GetHashCode();
            }
            if (U15 != 0)
            {
                hash ^= U15.GetHashCode();
            }
            if (Passive1Id != 0)
            {
                hash ^= Passive1Id.GetHashCode();
            }
            if (Passive2Id != 0)
            {
                hash ^= Passive2Id.GetHashCode();
            }
            if (Passive3Id != 0)
            {
                hash ^= Passive3Id.GetHashCode();
            }
            if (Passive4Id != 0)
            {
                hash ^= Passive4Id.GetHashCode();
            }
            if (Passive5Id != 0)
            {
                hash ^= Passive5Id.GetHashCode();
            }
            if (U21.Length != 0)
            {
                hash ^= U21.GetHashCode();
            }
            if (ScheduleId.Length != 0)
            {
                hash ^= ScheduleId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }