Exemplo n.º 1
0
        static void SetValue(object obj, DBClientHelper helper, DB6BinaryReader reader, int field)
        {
            switch (Type.GetTypeCode(helper.RealType))
            {
            case TypeCode.SByte:
                helper.SetValue(obj, reader.ReadSByte());
                break;

            case TypeCode.Byte:
                helper.SetValue(obj, reader.ReadByte());
                break;

            case TypeCode.Int16:
                helper.SetValue(obj, reader.ReadInt16());
                break;

            case TypeCode.UInt16:
                helper.SetValue(obj, reader.ReadUInt16());
                break;

            case TypeCode.Int32:
                helper.SetValue(obj, reader.GetInt32(_header.GetFieldBytes(field)));
                break;

            case TypeCode.UInt32:
                helper.SetValue(obj, reader.GetUInt32(_header.GetFieldBytes(field)));
                break;

            case TypeCode.Single:
                helper.SetValue(obj, reader.ReadSingle());
                break;

            case TypeCode.String:
                string str = GetString(reader, field);
                helper.SetValue(obj, str);
                break;
            }
        }
Exemplo n.º 2
0
        static void SetArrayValue(Array array, int arrayIndex, DBClientHelper helper, DB6BinaryReader reader, int field)
        {
            switch (Type.GetTypeCode(helper.RealType))
            {
            case TypeCode.SByte:
                helper.SetValue(array, reader.ReadSByte(), arrayIndex);
                break;

            case TypeCode.Byte:
                helper.SetValue(array, reader.ReadByte(), arrayIndex);
                break;

            case TypeCode.Int16:
                helper.SetValue(array, reader.ReadInt16(), arrayIndex);
                break;

            case TypeCode.UInt16:
                helper.SetValue(array, reader.ReadUInt16(), arrayIndex);
                break;

            case TypeCode.Int32:
                helper.SetValue(array, reader.GetInt32(_header.GetFieldBytes(field)), arrayIndex);
                break;

            case TypeCode.UInt32:
                helper.SetValue(array, reader.GetUInt32(_header.GetFieldBytes(field)), arrayIndex);
                break;

            case TypeCode.Single:
                helper.SetValue(array, reader.ReadSingle(), arrayIndex);
                break;

            case TypeCode.String:
                helper.SetValue(array, GetString(reader, field), arrayIndex);
                break;
            }
        }