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); }
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); } }
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); }
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); }
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); } }
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); } }
void IInstanceData.Init(IDumpContext dumpContext, object obj, int id) { }
public InstanceDataFactory(IDumpContext dumpContext) { this.dumpContext = dumpContext; }
public FieldDataFactory(IDumpContext dumpContext) { this.dumpContext = dumpContext; }
public TypeDataFactory(IDumpContext dumpContext) { this.dumpContext = dumpContext; }