private bool TryGetDefaultValue(int typeIndex, int dataIndex, out object value) { var pointer = metadata.GetDefaultValueFromIndex(dataIndex); var defaultValueType = il2Cpp.types[typeIndex]; metadata.Position = pointer; switch (defaultValueType.type) { case Il2CppTypeEnum.IL2CPP_TYPE_BOOLEAN: value = metadata.ReadBoolean(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_U1: value = metadata.ReadByte(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_I1: value = metadata.ReadSByte(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_CHAR: value = BitConverter.ToChar(metadata.ReadBytes(2), 0); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_U2: value = metadata.ReadUInt16(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_I2: value = metadata.ReadInt16(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_U4: value = metadata.ReadUInt32(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_I4: value = metadata.ReadInt32(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_U8: value = metadata.ReadUInt64(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_I8: value = metadata.ReadInt64(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_R4: value = metadata.ReadSingle(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_R8: value = metadata.ReadDouble(); return(true); case Il2CppTypeEnum.IL2CPP_TYPE_STRING: var len = metadata.ReadInt32(); value = metadata.ReadString(len); return(true); default: value = pointer; return(false); } }