示例#1
0
        public ReadResult(Type searchType, Type minType)
        {
            bool flag;
            bool flag1;
            bool flag2;
            bool flag3;
            bool flag4;
            bool flag5;
            bool flag6;

            this.minType                  = minType ?? typeof(UnityEngine.Object);
            this.searchType               = searchType ?? typeof(UnityEngine.Object);
            this.sumComponent.name        = "Components";
            this.sumBehaviour.name        = "Behaviours";
            this.sumRenderer.name         = "Renderers";
            this.sumCollider.name         = "Colliders";
            this.sumCloth.name            = "Cloths";
            this.sumGameObject.name       = "Game Objects";
            this.sumScriptableObject.name = "Scriptable Objects";
            this.sumMaterial.name         = "Materials";
            this.sumTexture.name          = "Textures";
            this.sumAnimation.name        = "Animations";
            this.sumMesh.name             = "Meshes";
            this.sumAudioClip.name        = "Audio Clips";
            this.sumAnimationClip.name    = "Animation Clips";
            this.sumParticleEmitter.name  = "Particle Emitters (Legacy)";
            this.sumParticleSystem.name   = "Particle Systems";
            this.sumComponent.check       = ManagedLeakDetector.CheckRelation(searchType, typeof(Component));
            flag = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(Behaviour), searchType));
            this.sumBehaviour.check = flag;
            flag1 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(Renderer), searchType));
            this.sumRenderer.check = flag1;
            flag2 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(Collider), searchType));
            this.sumCollider.check = flag2;
            flag3 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(Cloth), searchType));
            this.sumCloth.check = flag3;
            flag4 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(ParticleSystem), searchType));
            this.sumParticleSystem.check = flag4;
            flag5 = (!this.sumBehaviour.check ? false : ManagedLeakDetector.CheckRelation(typeof(Animation), searchType));
            this.sumAnimation.check = flag5;
            flag6 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(ParticleEmitter), searchType));
            this.sumParticleEmitter.check  = flag6;
            this.sumGameObject.check       = ManagedLeakDetector.CheckRelation(typeof(GameObject), searchType);
            this.sumScriptableObject.check = ManagedLeakDetector.CheckRelation(typeof(ScriptableObject), searchType);
            this.sumMaterial.check         = ManagedLeakDetector.CheckRelation(typeof(Material), searchType);
            this.sumTexture.check          = ManagedLeakDetector.CheckRelation(typeof(Texture), searchType);
            this.sumMesh.check             = ManagedLeakDetector.CheckRelation(typeof(Mesh), searchType);
            this.sumAudioClip.check        = ManagedLeakDetector.CheckRelation(typeof(AudioClip), searchType);
            this.sumAnimationClip.check    = ManagedLeakDetector.CheckRelation(typeof(AnimationClip), searchType);
        }
示例#2
0
 public static string Poll(Type searchType)
 {
     return(ManagedLeakDetector.Poll(searchType, typeof(UnityEngine.Object)));
 }
示例#3
0
 public static string Poll()
 {
     return(ManagedLeakDetector.Poll(typeof(UnityEngine.Object)));
 }
示例#4
0
        public void Read(bool forceUpdate)
        {
            ManagedLeakDetector.Counter counter;
            ManagedLeakDetector.Counter counter1;
            bool flag;
            bool flag1;
            bool flag2;
            bool flag3;
            bool flag4;
            bool flag5;
            bool flag6;

            if (this.complete && !forceUpdate)
            {
                return;
            }
            Dictionary <Type, ManagedLeakDetector.Counter> types = new Dictionary <Type, ManagedLeakDetector.Counter>();

            ManagedLeakDetector.Counter counter2 = new ManagedLeakDetector.Counter()
            {
                type = this.minType
            };
            types.Add(this.minType, counter2);
            this.sumComponent.Reset();
            this.sumBehaviour.Reset();
            this.sumRenderer.Reset();
            this.sumCollider.Reset();
            this.sumCloth.Reset();
            this.sumGameObject.Reset();
            this.sumScriptableObject.Reset();
            this.sumMaterial.Reset();
            this.sumTexture.Reset();
            this.sumAnimation.Reset();
            this.sumMesh.Reset();
            this.sumAudioClip.Reset();
            this.sumAnimationClip.Reset();
            this.sumParticleSystem.Reset();
            this.sumParticleEmitter.Reset();
            this.sumComponent.check = ManagedLeakDetector.CheckRelation(this.searchType, typeof(Component));
            flag = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(Behaviour), this.searchType));
            this.sumBehaviour.check = flag;
            flag1 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(Renderer), this.searchType));
            this.sumRenderer.check = flag1;
            flag2 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(Collider), this.searchType));
            this.sumCollider.check = flag2;
            flag3 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(Cloth), this.searchType));
            this.sumCloth.check = flag3;
            flag4 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(ParticleSystem), this.searchType));
            this.sumParticleSystem.check = flag4;
            flag5 = (!this.sumBehaviour.check ? false : ManagedLeakDetector.CheckRelation(typeof(Animation), this.searchType));
            this.sumAnimation.check = flag5;
            flag6 = (!this.sumComponent.check ? false : ManagedLeakDetector.CheckRelation(typeof(ParticleEmitter), this.searchType));
            this.sumParticleEmitter.check  = flag6;
            this.sumGameObject.check       = ManagedLeakDetector.CheckRelation(typeof(GameObject), this.searchType);
            this.sumScriptableObject.check = ManagedLeakDetector.CheckRelation(typeof(ScriptableObject), this.searchType);
            this.sumMaterial.check         = ManagedLeakDetector.CheckRelation(typeof(Material), this.searchType);
            this.sumTexture.check          = ManagedLeakDetector.CheckRelation(typeof(Texture), this.searchType);
            this.sumMesh.check             = ManagedLeakDetector.CheckRelation(typeof(Mesh), this.searchType);
            this.sumAudioClip.check        = ManagedLeakDetector.CheckRelation(typeof(AudioClip), this.searchType);
            this.sumAnimationClip.check    = ManagedLeakDetector.CheckRelation(typeof(AnimationClip), this.searchType);
            UnityEngine.Object[] objArray = UnityEngine.Object.FindObjectsOfType(this.searchType);
            for (int i = 0; i < (int)objArray.Length; i++)
            {
                UnityEngine.Object obj = objArray[i];
                Type type = obj.GetType();
                if (!types.TryGetValue(type, out counter))
                {
                    counter1 = new ManagedLeakDetector.Counter()
                    {
                        type = type,
                        actualInstanceCount = 1
                    };
                    ManagedLeakDetector.Counter counter3 = counter1;
                    counter = counter3;
                    types.Add(type, counter3);
                }
                else
                {
                    ManagedLeakDetector.Counter counter4 = counter;
                    counter4.actualInstanceCount = counter4.actualInstanceCount + 1;
                }
                if (this.sumComponent.check && typeof(Component).IsAssignableFrom(type))
                {
                    this.sumComponent.total = this.sumComponent.total + 1;
                    if (this.sumBehaviour.check && typeof(Behaviour).IsAssignableFrom(type))
                    {
                        if (((Behaviour)obj).enabled)
                        {
                            this.sumComponent.enabled = this.sumComponent.enabled + 1;
                            ManagedLeakDetector.Counter counter5 = counter;
                            counter5.enabledCount     = counter5.enabledCount + 1;
                            this.sumBehaviour.enabled = this.sumBehaviour.enabled + 1;
                            this.sumBehaviour.total   = this.sumBehaviour.total + 1;
                            if (this.sumAnimation.check && typeof(Animation).IsAssignableFrom(type))
                            {
                                this.sumAnimation.enabled = this.sumAnimation.enabled + 1;
                                this.sumAnimation.total   = this.sumAnimation.total + 1;
                            }
                        }
                        else if (this.sumAnimation.check && typeof(Animation).IsAssignableFrom(type))
                        {
                            this.sumAnimation.total = this.sumAnimation.total + 1;
                        }
                    }
                    else if (this.sumRenderer.check && typeof(Renderer).IsAssignableFrom(type))
                    {
                        this.sumRenderer.total = this.sumRenderer.total + 1;
                        if (((Renderer)obj).enabled)
                        {
                            this.sumComponent.enabled = this.sumComponent.enabled + 1;
                            this.sumRenderer.enabled  = this.sumRenderer.enabled + 1;
                            ManagedLeakDetector.Counter counter6 = counter;
                            counter6.enabledCount = counter6.enabledCount + 1;
                        }
                    }
                    else if (this.sumCollider.check && typeof(Collider).IsAssignableFrom(type))
                    {
                        this.sumCollider.total = this.sumCollider.total + 1;
                        if (((Collider)obj).enabled)
                        {
                            this.sumComponent.enabled = this.sumComponent.enabled + 1;
                            this.sumCollider.enabled  = this.sumCollider.enabled + 1;
                            ManagedLeakDetector.Counter counter7 = counter;
                            counter7.enabledCount = counter7.enabledCount + 1;
                        }
                    }
                    else if (this.sumParticleSystem.check && typeof(ParticleSystem).IsAssignableFrom(type))
                    {
                        this.sumParticleSystem.total = this.sumParticleSystem.total + 1;
                        if (((ParticleSystem)obj).IsAlive())
                        {
                            ManagedLeakDetector.Counter counter8 = counter;
                            counter8.enabledCount          = counter8.enabledCount + 1;
                            this.sumParticleSystem.enabled = this.sumParticleSystem.enabled + 1;
                            this.sumComponent.enabled      = this.sumComponent.enabled + 1;
                        }
                    }
                    else if (this.sumCloth.check && typeof(Cloth).IsAssignableFrom(type))
                    {
                        this.sumCloth.total = this.sumCloth.total + 1;
                        if (((Cloth)obj).enabled)
                        {
                            ManagedLeakDetector.Counter counter9 = counter;
                            counter9.enabledCount     = counter9.enabledCount + 1;
                            this.sumComponent.enabled = this.sumComponent.enabled + 1;
                            this.sumCloth.enabled     = this.sumCloth.enabled + 1;
                        }
                    }
                    else if (this.sumParticleEmitter.check && typeof(ParticleEmitter).IsAssignableFrom(type))
                    {
                        this.sumParticleEmitter.total = this.sumParticleEmitter.total + 1;
                        if (((ParticleEmitter)obj).enabled)
                        {
                            ManagedLeakDetector.Counter counter10 = counter;
                            counter10.enabledCount          = counter10.enabledCount + 1;
                            this.sumParticleEmitter.enabled = this.sumParticleEmitter.enabled + 1;
                            this.sumComponent.enabled       = this.sumComponent.enabled + 1;
                        }
                    }
                }
                else if (this.sumGameObject.check && typeof(GameObject).IsAssignableFrom(type))
                {
                    this.sumGameObject.total = this.sumGameObject.total + 1;
                    if (((GameObject)obj).activeInHierarchy)
                    {
                        this.sumGameObject.enabled = this.sumGameObject.enabled + 1;
                        ManagedLeakDetector.Counter counter11 = counter;
                        counter11.enabledCount = counter11.enabledCount + 1;
                    }
                }
                else if (this.sumMaterial.check && typeof(Material).IsAssignableFrom(type))
                {
                    this.sumMaterial.total = this.sumMaterial.total + 1;
                }
                else if (this.sumTexture.check && typeof(Texture).IsAssignableFrom(type))
                {
                    this.sumTexture.total = this.sumTexture.total + 1;
                }
                else if (this.sumAudioClip.check && typeof(AudioClip).IsAssignableFrom(type))
                {
                    this.sumAudioClip.total = this.sumAudioClip.total + 1;
                }
                else if (this.sumAnimationClip.check && typeof(AnimationClip).IsAssignableFrom(type))
                {
                    this.sumAnimationClip.total = this.sumAnimationClip.total + 1;
                }
                else if (this.sumMesh.check && typeof(Mesh).IsAssignableFrom(type))
                {
                    this.sumMesh.total = this.sumMesh.total + 1;
                }
                else if (this.sumScriptableObject.check && typeof(ScriptableObject).IsAssignableFrom(type))
                {
                    this.sumScriptableObject.total = this.sumScriptableObject.total + 1;
                }
                if (type != this.minType)
                {
                    for (type = type.BaseType; type != typeof(UnityEngine.Object); type = type.BaseType)
                    {
                        if (!types.TryGetValue(type, out counter))
                        {
                            counter1 = new ManagedLeakDetector.Counter()
                            {
                                type = type,
                                derivedInstanceCount = 1
                            };
                            types.Add(type, counter1);
                        }
                        else
                        {
                            ManagedLeakDetector.Counter counter12 = counter;
                            counter12.derivedInstanceCount = counter12.derivedInstanceCount + 1;
                        }
                    }
                    ManagedLeakDetector.Counter counter13 = counter2;
                    counter13.derivedInstanceCount = counter13.derivedInstanceCount + 1;
                }
            }
            List <ManagedLeakDetector.Counter> counters = new List <ManagedLeakDetector.Counter>(types.Values);

            counters.Sort((ManagedLeakDetector.Counter firstPair, ManagedLeakDetector.Counter nextPair) => {
                int num = nextPair.actualInstanceCount.CompareTo(firstPair.actualInstanceCount);
                if (num != 0)
                {
                    return(num);
                }
                return(nextPair.derivedInstanceCount.CompareTo(firstPair.derivedInstanceCount));
            });
            this.counters = counters.ToArray();
            this.complete = true;
        }
示例#5
0
 private static void Print(StringBuilder sb, ref ManagedLeakDetector.SumEnable en)
 {
     if (en.check)
     {
         if (en.enabled != 0)
         {
             sb.AppendFormat("{0} {1} ({2})\r\n", en.name, en.total, en.enabled);
         }
         else if (en.total != 0)
         {
             sb.AppendFormat("{0} {1}\r\n", en.name, en.total);
         }
     }
 }