public override object SaveValue(SafeBinaryWriter writer) { BLOB value = _fields[_fieldIndex] as BLOB; writer.Write(value.ID); return(value); }
public override object SaveValue(SafeBinaryWriter writer) { object value = _fields[_fieldIndex]; if (value == null) { value = 0.0; } writer.Write((double)value); return(value); }
public override object SaveValue(SafeBinaryWriter writer) { object value = _fields[_fieldIndex]; if (value == null) { value = DateTime.MinValue; } writer.Write(((DateTime )value).Ticks); return(value); }
public override object SaveValue(SafeBinaryWriter writer) { object value = _fields[_fieldIndex]; int intValue = 0; if (value != null) { intValue = (int)value; } writer.Write(intValue); return(intValue); }
public override object SaveValue(SafeBinaryWriter writer) { string value = _fields[_fieldIndex] as string; if (value == null) { value = string.Empty; } writer.WriteStringSafeWithIntLength(value); writer.Write(END_MARKER); return(value); }
public void Save(Stream stream) { // Use BinaryWriter to write the bytes to the file using (var writer = new SafeBinaryWriter(stream)) { // Write the header writer.Write(header.sGroupID.ToCharArray()); writer.Write(header.dwFileLength); writer.Write(header.sRiffType.ToCharArray()); // Write the format chunk writer.Write(format.sChunkID.ToCharArray()); writer.Write(format.dwChunkSize); writer.Write(format.wFormatTag); writer.Write(format.wChannels); writer.Write(format.dwSamplesPerSec); writer.Write(format.dwAvgBytesPerSec); writer.Write(format.wBlockAlign); writer.Write(format.wBitsPerSample); // Write the data chunk writer.Write(data.sChunkID.ToCharArray()); writer.Write(data.dwChunkSize); foreach (short dataPoint in data.shortArray) { writer.Write(dataPoint); } writer.Seek(4, SeekOrigin.Begin); uint filesize = (uint)writer.BaseStream.Length; writer.Write(filesize - 8); } }