public byte RetrieveByte() { SimpleDB.Entry entry = this.RetrieveEntry(); if (entry.Type != SimpleDB.EntryType.Byte) { throw new SimpleDB.IOException(entry.Type, this.m_Reader); } return(Conversions.ToByte(entry.Value)); }
private void WriteRecord() { if (this.m_currentRecord.Count >= 1) { this.RawWriteByte(0x4d); this.RawWriteInt16(this.m_currentRecord.Count); int num2 = this.m_currentRecord.Count - 1; for (int i = 0; i <= num2; i++) { SimpleDB.Entry entry = this.m_currentRecord[i]; SimpleDB.EntryType type = entry.Type; if (type == SimpleDB.EntryType.Boolean) { this.RawWriteByte(0x42); this.RawWriteByte(Conversions.ToByte(Conversions.ToBoolean(entry.Value) ? 1 : 0)); } else if (type == SimpleDB.EntryType.Byte) { this.RawWriteByte(0x62); this.RawWriteByte(Conversions.ToByte(entry.Value)); } else if (type == SimpleDB.EntryType.String) { this.RawWriteByte(0x53); SimpleDB.Entry entry2 = entry; string text = Conversions.ToString(entry2.Value); this.RawWriteCString(text); entry2.Value = text; } else if (type == SimpleDB.EntryType.UInt16) { this.RawWriteByte(0x49); this.RawWriteInt16(Conversions.ToInteger(entry.Value)); } else { this.RawWriteByte(0x45); } } this.m_currentRecord.Clear(); } }