void AssertInt(string fieldName, int value, RichManagedObject managedObject)
        {
            var memory = new MemoryReader(m_snapshot);

            var field = GetField(fieldName, managedObject);

            Assert.AreEqual(value, memory.ReadInt32((uint)field.offset + managedObject.address));
        }
        void AssertDecimal(string fieldName, System.Decimal value, RichManagedObject managedObject)
        {
            var memory = new MemoryReader(m_snapshot);

            var field = GetField(fieldName, managedObject);

            Assert.AreEqual(value, memory.ReadDecimal((uint)field.offset + managedObject.address));
        }
Example #3
0
 public void Clear()
 {
     m_ManagedObject = RichManagedObject.invalid;
     m_ManagedType   = RichManagedType.invalid;
     m_PropertyGrid.Clear();
     m_HexView.Clear();
     m_DataVisualizer = null;
 }
Example #4
0
        void AssertVector2(string fieldName, Vector2 value, RichManagedObject managedObject)
        {
            var memory = new MemoryReader(m_snapshot);

            var field = GetField(fieldName, managedObject);

            Assert.AreEqual(value.x, memory.ReadSingle(0 + (uint)field.offset + managedObject.address));
            Assert.AreEqual(value.y, memory.ReadSingle(4 + (uint)field.offset + managedObject.address));
        }
Example #5
0
        public void Inspect(RichManagedType managedType)
        {
            m_ManagedObject = RichManagedObject.invalid;
            m_ManagedType   = managedType;
            m_PropertyGrid.InspectStaticType(snapshot, m_ManagedType.packed);
            m_HexView.Inspect(snapshot, 0, new ArraySegment64 <byte>(managedType.packed.staticFieldBytes, 0, (ulong)managedType.packed.staticFieldBytes.LongLength));

            m_DataVisualizer = null;
        }
Example #6
0
            public void Initialize(RootPathControl owner, PackedMemorySnapshot snapshot, int arrayIndex)
            {
                m_Owner         = owner;
                m_ManagedObject = new RichManagedObject(snapshot, arrayIndex);

                displayName = m_ManagedObject.type.name;
                m_Address   = m_ManagedObject.address;
                m_Value     = m_ManagedObject.nativeObject.isValid ? m_ManagedObject.nativeObject.name : "";
            }
Example #7
0
        void AssertDateTime(string fieldName, DateTime value, RichManagedObject managedObject)
        {
            var memory = new MemoryReader(m_snapshot);

            var field = GetField(fieldName, managedObject);
            var ticks = memory.ReadInt64(0 + (uint)field.offset + managedObject.address);

            Assert.AreEqual(value, new DateTime(ticks));
        }
Example #8
0
        PackedManagedField GetField(string fieldName, RichManagedObject managedObject)
        {
            PackedManagedField field;
            var found = managedObject.type.FindField(fieldName, out field);

            Assert.IsTrue(found, $"Field '{fieldName}' not found.");

            return(field);
        }
Example #9
0
        PackedManagedField GetField(string fieldName, RichManagedObject managedObject)
        {
            PackedManagedField field;
            var index = managedObject.type.FindField(fieldName, out field);

            Assert.AreNotEqual(-1, index, "Field '{0}' not found.", fieldName);

            return(field);
        }
Example #10
0
            public void Initialize(ConnectionsControl owner, PackedMemorySnapshot snapshot, int arrayIndex)
            {
                m_Owner         = owner;
                m_ManagedObject = new RichManagedObject(snapshot, arrayIndex);

                displayName = m_ManagedObject.type.name;
                address     = m_ManagedObject.address;
                m_Value     = m_ManagedObject.nativeObject.isValid ? m_ManagedObject.nativeObject.name : "";
                m_Tooltip   = PackedManagedTypeUtility.GetInheritanceAsString(snapshot, m_ManagedObject.type.packed.managedTypesArrayIndex);
            }
Example #11
0
        void RunTest()
        {
            // Find the test type
            RichManagedType classType = RichManagedType.invalid;

            foreach (var type in m_snapshot.managedTypes)
            {
                if (type.name != "HeapExplorer.Test_Editor")
                {
                    continue;
                }

                classType = new RichManagedType(m_snapshot, type.managedTypesArrayIndex);
                break;
            }
            Assert.IsTrue(classType.isValid);

            // Find the test object instance
            RichManagedObject managedObject = RichManagedObject.invalid;

            foreach (var obj in m_snapshot.managedObjects)
            {
                if (obj.managedTypesArrayIndex != classType.packed.managedTypesArrayIndex)
                {
                    continue;
                }

                managedObject = new RichManagedObject(m_snapshot, obj.managedObjectsArrayIndex);
            }
            Assert.IsTrue(managedObject.isValid);

            AssertInt("m_intOne", 1, managedObject);
            AssertInt("m_intTwo", 2, managedObject);
            AssertInt("m_intThree", 3, managedObject);
            AssertInt("m_intFour", 4, managedObject);

            AssertDecimal("m_decimal", new decimal(1234567.89), managedObject);
            AssertDecimal("m_decimalNegative", new decimal(-1234567.89), managedObject);

            AssertVector2("m_vector2", new Vector2(1, 2), managedObject);
            AssertVector3("m_vector3", new Vector3(1, 2, 3), managedObject);

            AssertQuaternion("m_quaternion", Quaternion.identity, managedObject);
            AssertQuaternion("m_quaternion1", Quaternion.AngleAxis(90, Vector3.up), managedObject);

            AssertMatrix4x4("m_matrix", Matrix4x4.identity, managedObject);

            AssertLong("m_long", -1234567890, managedObject);
            AssertULong("m_ulong", 0x11_22_33_44_55_66_77_88, managedObject);

            AssertDateTime("m_dateTime_1999_11_22", new DateTime(1999, 11, 22, 1, 2, 3), managedObject);
        }
Example #12
0
        public void Inspect(PackedManagedObject managedObject)
        {
            m_ManagedObject = new RichManagedObject(snapshot, managedObject.managedObjectsArrayIndex);
            m_ManagedType   = m_ManagedObject.type;
            m_PropertyGrid.Inspect(snapshot, m_ManagedObject.packed);

            m_DataVisualizer = null;
            if (AbstractDataVisualizer.HasVisualizer(m_ManagedObject.type.name))
            {
                m_DataVisualizer = AbstractDataVisualizer.CreateVisualizer(m_ManagedObject.type.name);
                m_DataVisualizer.Initialize(snapshot, new MemoryReader(snapshot), m_ManagedObject.address, m_ManagedObject.type.packed);
            }

            m_HexView.Inspect(snapshot, managedObject.address, (ulong)managedObject.size);
        }
Example #13
0
        void OnListViewSelectionChange(PackedManagedObject?item)
        {
            m_Selected = RichManagedObject.invalid;
            if (!item.HasValue)
            {
                m_RootPathView.Clear();
                m_ConnectionsView.Clear();
                m_PropertyGridView.Clear();
                return;
            }

            m_Selected = new RichManagedObject(snapshot, item.Value.managedObjectsArrayIndex);
            m_ConnectionsView.Inspect(m_Selected.packed);
            m_PropertyGridView.Inspect(m_Selected.packed);
            m_RootPathView.Inspect(m_Selected.packed);
        }
Example #14
0
        void AssertMatrix4x4(string fieldName, Matrix4x4 value, RichManagedObject managedObject)
        {
            var memory = new MemoryReader(m_snapshot);

            var field = GetField(fieldName, managedObject);

            Matrix4x4 matrix       = new Matrix4x4();
            int       sizeOfSingle = m_snapshot.managedTypes[m_snapshot.coreTypes.systemSingle].size;
            int       element      = 0;

            for (var y = 0; y < 4; ++y)
            {
                for (var x = 0; x < 4; ++x)
                {
                    matrix[y, x] = memory.ReadSingle((uint)field.offset + (uint)(sizeOfSingle * element) + managedObject.address);
                    element++;
                }
            }

            Assert.AreEqual(value, matrix);
        }
            public void Initialize(AbstractManagedObjectsControl owner, PackedMemorySnapshot snapshot, PackedManagedObject managedObject)
            {
                m_Owner = owner;

                m_Object = new RichManagedObject(snapshot, managedObject.managedObjectsArrayIndex);
            }
Example #16
0
 public GotoCommand(RichManagedObject value)
     : this()
 {
     toManagedObject = value;
 }
Example #17
0
 public ObjectProxy(PackedMemorySnapshot snp, PackedManagedObject packed)
 {
     snapshot = snp;
     managed  = new RichManagedObject(snp, packed.managedObjectsArrayIndex);
 }