public static void WriteCompressedNullableUInt(this IWriteBytes stream, uint?value) { if (value.HasValue) { stream.WriteCompressedBool(true); stream.WriteCompressedUInt(value.Value); } else { stream.WriteCompressedBool(false); } }
public static void WriteCompressedByteArray(this IWriteBytes stream, byte[] bytes) { if (bytes is null) { stream.WriteCompressedBool(false); } else { stream.WriteCompressedBool(true); stream.WriteCompressedUInt((uint)bytes.Length); stream.WriteBytes(bytes); } }
public static void WriteCompressedMonthStamp(this IWriteBytes stream, MonthStamp value) { stream.WriteCompressedUInt((uint)(value.Year * 12 + value.Month - 1)); }
public static void WriteCompressedInt(this IWriteBytes stream, int value) { stream.WriteCompressedUInt((uint)((value << 1) ^ (value >> 31))); }
public static void WriteCompressedDateStamp(this IWriteBytes stream, DateStamp value) { stream.WriteCompressedUInt((uint)((value.Year * 12 + value.Month - 1) * 100 + value.Day)); }