Beispiel #1
0
        private void WriteRecords(BinaryWriter writer, List <DbfRecord> newrecords, DbfField fields, int rowIndex, int columnIndex)
        {
            DbfRecord record = newrecords[rowIndex];

            record.Write(writer, fields, rowIndex, columnIndex);
            writer.Write(" ");
            // Write EOF character.
            writer.Write((byte)0x1a);
        }
Beispiel #2
0
 public object this[DbfField field]
 {
     get
     {
         int index = fields.IndexOf(field);
         if (index == -1)
         {
             return(null);
         }
         return(data[index]);
     }
 }
Beispiel #3
0
        // Added On DT: 24/01/2019
        internal void Write(BinaryWriter writer, DbfField field1, int rowIndex, int columnIndex)
        {
            // Write marker (always "not deleted")
            //writer.Write((byte)0x20);

            int index = 0;

            foreach (DbfField field in fields)
            {
                IEncoder encoder = EncoderFactory.GetEncoder(field.Type);
                byte[]   buffer  = encoder.Encode(field, data[index]);
                writer.Write(buffer);
                index++;
            }
        }
Beispiel #4
0
        public string Write(String path, List <DbfRecord> newrecords, DbfField fields, int rowIndex, int columnIndex)
        {
            FileStream   stream = File.Open(path, FileMode.Open, FileAccess.Write);
            BinaryWriter writer = new BinaryWriter(stream);

            try
            {
                WriteRecords(writer, newrecords, fields, rowIndex, columnIndex);

                writer.Close();
                stream.Close();
                return("File Updated Successfully !!!");
            }
            catch (Exception ex)
            {
                writer.Close();
                stream.Close();
                return(ex.Message);
            }
        }