コード例 #1
0
 public RecordFileReader(SqlBytes data)
 {
     if (data.IsNull)
     {
         throw new InvalidDataException(SR.EmptyFile);
     }
     _reader = new SqlBytesReader(data);
 }
コード例 #2
0
ファイル: DBF.cs プロジェクト: zatuliveter/reportviewercore
 public void ReadFieldData(SqlBytesReader reader)
 {
     char[] value = reader.ReadChars(_fieldLength);
     _value = new string(value).Trim();
 }
コード例 #3
0
ファイル: DBF.cs プロジェクト: zatuliveter/reportviewercore
            public void ReadHeader(SqlBytesReader reader)
            {
                char[] array = reader.ReadChars(11);
                int    i;

                for (i = 0; i < array.Length && array[i] != 0; i++)
                {
                }
                _fieldName = new string(array, 0, i);
                _fieldType = reader.ReadChar();
                reader.ReadUInt32();
                _fieldLength  = reader.ReadByte();
                _decimalCount = reader.ReadByte();
                reader.ReadUInt16();
                reader.ReadByte();
                reader.ReadUInt16();
                reader.ReadByte();
                reader.ReadUInt32();
                reader.ReadUInt16();
                reader.ReadByte();
                reader.ReadByte();
                if (_fieldType == 'C')
                {
                    if (_fieldLength >= byte.MaxValue)
                    {
                        throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, _fieldType, _fieldLength));
                    }
                    return;
                }
                if (_fieldType == 'N')
                {
                    if (_fieldLength <= 20)
                    {
                        return;
                    }
                    throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, _fieldType, _fieldLength));
                }
                if (_fieldType == 'L')
                {
                    if (_fieldLength == 1)
                    {
                        return;
                    }
                    throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, _fieldType, _fieldLength));
                }
                if (_fieldType == 'D')
                {
                    if (_fieldLength == 8)
                    {
                        return;
                    }
                    throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, _fieldType, _fieldLength));
                }
                if (_fieldType == 'F')
                {
                    if (_fieldLength <= 20)
                    {
                        return;
                    }
                    throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfFieldLength, _fieldType, _fieldLength));
                }
                throw new InvalidDataException(string.Format(CultureInfo.CurrentCulture.NumberFormat, SR.UnsupportedDbfField, _fieldType));
            }