private static void WriteDouble(MsgSubStorageWriter writer, TnefPropertyTag propertyTag, object value) { double?num = value as double?; if (num == null) { throw new InvalidOperationException(MsgStorageStrings.InvalidValueType(typeof(double), value.GetType())); } MsgStoragePropertyData.WriteProperty(writer.PropertiesWriter, propertyTag, num.Value); }
private static void WriteBoolean(MsgSubStorageWriter writer, TnefPropertyTag propertyTag, object value) { bool?flag = value as bool?; if (flag == null) { throw new InvalidOperationException(MsgStorageStrings.InvalidValueType(typeof(bool), value.GetType())); } short propertyValue = flag.Value ? 1 : 0; MsgStoragePropertyData.WriteProperty(writer.PropertiesWriter, propertyTag, propertyValue); }
private static void WriteSysTime(MsgSubStorageWriter writer, TnefPropertyTag propertyTag, object value) { DateTime?dateTime = value as DateTime?; if (dateTime == null) { throw new InvalidOperationException(MsgStorageStrings.InvalidValueType(typeof(DateTime), value.GetType())); } long propertyValue = 0L; try { propertyValue = dateTime.Value.ToFileTimeUtc(); } catch (ArgumentOutOfRangeException) { propertyValue = 0L; } MsgStoragePropertyData.WriteProperty(writer.PropertiesWriter, propertyTag, propertyValue); }