static private object ReadList(LitEngine.IO.AESReader pReader, object pTarget) { bool thave = pReader.ReadBoolean(); if (!thave) { return(null); } string tfullname = pReader.ReadString(); int tcount = pReader.ReadInt32(); System.Type tselftype = pTarget.GetType(); MethodInfo tclear = tselftype.GetMethod("Clear"); tclear.Invoke(pTarget, null); MethodInfo tmethod = tselftype.GetMethod("Add"); for (int i = 0; i < tcount; i++) { object titem = null; System.Type[] genericArgTypes = tselftype.GetGenericArguments(); if (genericArgTypes != null && genericArgTypes.Length > 0) { titem = GetObjectByType(genericArgTypes[0], true); } object tobj = ReadField(pReader, titem, null); tmethod.Invoke(pTarget, new object[] { tobj }); } return(pTarget); }
static private object ReadDataObject(LitEngine.IO.AESReader pReader, object pTarget) { bool thave = pReader.ReadBoolean(); if (!thave) { return(null); } string tfullname = pReader.ReadString(); int tFieldCount = pReader.ReadInt32(); for (int i = 0; i < tFieldCount; i++) { ReadField(pReader, null, pTarget); } return(pTarget); }
private void LoadByType(LitEngine.IO.AESReader _loader) { switch (ValueType) { case FieldType.Boolean: dvalue = _loader.ReadBoolean(); break; case FieldType.Byte: dvalue = _loader.ReadByte(); break; case FieldType.SByte: dvalue = _loader.ReadSByte(); break; case FieldType.Int16: dvalue = _loader.ReadInt16(); break; case FieldType.UInt16: dvalue = _loader.ReadUInt16(); break; case FieldType.Int32: dvalue = _loader.ReadInt32(); break; case FieldType.UInt32: dvalue = _loader.ReadUInt32(); break; case FieldType.Int64: dvalue = _loader.ReadInt64(); break; case FieldType.UInt64: dvalue = _loader.ReadUInt64(); break; case FieldType.Single: dvalue = _loader.ReadSingle(); break; case FieldType.Double: dvalue = _loader.ReadDouble(); break; case FieldType.Decimal: dvalue = _loader.ReadDecimal(); break; case FieldType.String: dvalue = _loader.ReadString(); break; case FieldType.Char: dvalue = _loader.ReadChar(); break; case FieldType.BigInteger: { int tlen = _loader.ReadInt32(); byte[] tbytes = _loader.ReadBytes(tlen); dvalue = new System.Numerics.BigInteger(tbytes); } break; case FieldType.Bytes: { int tlen = _loader.ReadInt32(); dvalue = _loader.ReadBytes(tlen); } break; default: break; } }
static public object LoadByType(LitEngine.IO.AESReader pLoader) { FieldType ttype = GetValueTypeByString(pLoader.ReadString()); object ret = null; switch (ttype) { case FieldType.Boolean: ret = pLoader.ReadBoolean(); break; case FieldType.Byte: ret = pLoader.ReadByte(); break; case FieldType.SByte: ret = pLoader.ReadSByte(); break; case FieldType.Int16: ret = pLoader.ReadInt16(); break; case FieldType.UInt16: ret = pLoader.ReadUInt16(); break; case FieldType.Int32: ret = pLoader.ReadInt32(); break; case FieldType.UInt32: ret = pLoader.ReadUInt32(); break; case FieldType.Int64: ret = pLoader.ReadInt64(); break; case FieldType.UInt64: ret = pLoader.ReadUInt64(); break; case FieldType.Single: ret = pLoader.ReadSingle(); break; case FieldType.Double: ret = pLoader.ReadDouble(); break; case FieldType.Decimal: ret = pLoader.ReadDecimal(); break; case FieldType.String: ret = pLoader.ReadString(); break; case FieldType.Char: ret = pLoader.ReadChar(); break; case FieldType.BigInteger: { int tlen = pLoader.ReadInt32(); byte[] tbytes = pLoader.ReadBytes(tlen); ret = new System.Numerics.BigInteger(tbytes); } break; case FieldType.Bytes: { int tlen = pLoader.ReadInt32(); ret = pLoader.ReadBytes(tlen); } break; default: break; } return(ret); }