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); }
public object this[DbfField field] { get { int index = fields.IndexOf(field); if (index == -1) { return(null); } return(data[index]); } }
// 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++; } }
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); } }