コード例 #1
0
        public void Init(IDumpContext dumpContext, Type type)
        {
            this.type = type;

            size = 0;

            var typeDataFactory = dumpContext.TypeDataFactory;

            instanceFields = GetInstanceFields(typeDataFactory);

            isPureValueType = IsPureValueType(typeDataFactory);
            if (isPureValueType)
            {
                if (type.IsEnum)
                {
                    Type uderlyingType = Enum.GetUnderlyingType(type);
                    size = Marshal.SizeOf(uderlyingType);
                }
                else
                {
                    size = Marshal.SizeOf(type);
                }
            }

            var fieldDataFactory = dumpContext.FieldDataFactory;

            staticFields = GetStaticFields(fieldDataFactory);
        }
コード例 #2
0
        void IInstanceData.Init(IDumpContext dumpContext, object obj, int id)
        {
            seenInstances = new HashSet <int>();

            this.obj = obj;
            this.id  = id;

            var type            = obj.GetType();
            var typeDataFactory = dumpContext.TypeDataFactory;

            typeData = typeDataFactory.Create(type);
            typeSize = typeData.Size;

            if (typeData.IsPureValueType)
            {
                fields = emptyFields;
                return;
            }

            var fieldDataFactory = dumpContext.FieldDataFactory;
            var instanceFields   = typeData.InstanceFields;

            fields = new List <IFieldData>(instanceFields.Count);
            foreach (var fieldInfo in instanceFields)
            {
                var fieldData = fieldDataFactory.Create(fieldInfo, obj);
                fields.Add(fieldData);
            }
        }
コード例 #3
0
        public ArrayFieldData(IDumpContext dumpContext, Array parent, int index)
        {
            this.index   = index;
            instanceData = nullInstanceData;

            var value = parent.GetValue(index);
            var instanceDataFactory = dumpContext.InstanceDataFactory;

            instanceData = instanceDataFactory.Create(value);
        }
コード例 #4
0
        void IInstanceData.Init(IDumpContext dumpContext, object obj, int id)
        {
            str     = (string)obj;
            this.id = id;

            var typeDataFactory = dumpContext.TypeDataFactory;

            typeData = typeDataFactory.Create(typeof(string));

            size = str.Length * sizeof(char);
        }
コード例 #5
0
        public FieldData(IDumpContext dumpContext, FieldInfo fieldInfo, object parent)
        {
            this.fieldInfo = fieldInfo;
            instanceData   = nullInstanceData;
            if (fieldInfo.FieldType.IsPointer)
            {
                return;
            }

            try
            {
                var value = fieldInfo.GetValue(parent);
                var instanceDataFactory = dumpContext.InstanceDataFactory;
                instanceData = instanceDataFactory.Create(value);
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogError(e.Message);
            }
        }
コード例 #6
0
        void IInstanceData.Init(IDumpContext dumpContext, object obj, int id)
        {
            seenInstances = new HashSet <int>();

            array   = (Array)obj;
            this.id = id;

            var typeDataFactory = dumpContext.TypeDataFactory;
            var type            = obj.GetType();

            typeData = typeDataFactory.Create(type);
            typeSize = typeData.Size;

            var fieldDataFactory = dumpContext.FieldDataFactory;
            var arrayLength      = array.Length;

            elements = new List <IFieldData>(arrayLength);
            for (int i = 0; i < arrayLength; ++i)
            {
                var fieldData = fieldDataFactory.CreateArrayField(array, i);
                elements.Add(fieldData);
            }
        }
コード例 #7
0
 void IInstanceData.Init(IDumpContext dumpContext, object obj, int id)
 {
 }
コード例 #8
0
 public InstanceDataFactory(IDumpContext dumpContext)
 {
     this.dumpContext = dumpContext;
 }
コード例 #9
0
 public FieldDataFactory(IDumpContext dumpContext)
 {
     this.dumpContext = dumpContext;
 }
コード例 #10
0
 public TypeDataFactory(IDumpContext dumpContext)
 {
     this.dumpContext = dumpContext;
 }