Ejemplo n.º 1
0
        private static void InternalWriteString(MsgSubStorageWriter writer, TnefPropertyTag propertyTag, string value)
        {
            MsgSubStorageWriter.WriterBuffer valueBuffer = writer.ValueBuffer;
            int unicodeByteCount = Util.GetUnicodeByteCount(value);

            byte[] array = valueBuffer.PreallocateBuffer(unicodeByteCount);
            int    num   = Util.StringToUnicodeBytes(value, array);

            writer.Storage.WriteBytesToStream(Util.PropertyStreamName(propertyTag), array, num);
            MsgStoragePropertyData.WriteStream(writer.PropertiesWriter, propertyTag, num);
        }
Ejemplo n.º 2
0
        private static void WriteArray(MsgSubStorageWriter writer, TnefPropertyTag propertyTag, int arrayLength, MsgStorageRulesTable.WriteValueDelegate writeValue)
        {
            MsgSubStorageWriter.WriterBuffer valueBuffer = writer.ValueBuffer;
            for (int num = 0; num != arrayLength; num++)
            {
                writeValue(valueBuffer.Writer, num);
            }
            int length = valueBuffer.GetLength();

            byte[] buffer = valueBuffer.GetBuffer();
            writer.Storage.WriteBytesToStream(Util.PropertyStreamName(propertyTag), buffer, length);
            MsgStoragePropertyData.WriteStream(writer.PropertiesWriter, propertyTag, length);
        }
Ejemplo n.º 3
0
        private static void InternalWriteStringArray(MsgSubStorageWriter writer, TnefPropertyTag propertyTag, string[] arrayValue)
        {
            MsgSubStorageWriter.WriterBuffer lengthsBuffer = writer.LengthsBuffer;
            for (int num = 0; num != arrayValue.Length; num++)
            {
                MsgSubStorageWriter.WriterBuffer valueBuffer = writer.ValueBuffer;
                int    unicodeByteCount = Util.GetUnicodeByteCount(arrayValue[num]);
                byte[] array            = valueBuffer.PreallocateBuffer(unicodeByteCount);
                int    num2             = Util.StringToUnicodeBytes(arrayValue[num], array);
                lengthsBuffer.Writer.Write(num2);
                writer.Storage.WriteBytesToStream(Util.PropertyStreamName(propertyTag, num), array, num2);
            }
            int length = lengthsBuffer.GetLength();

            byte[] buffer = lengthsBuffer.GetBuffer();
            writer.Storage.WriteBytesToStream(Util.PropertyStreamName(propertyTag), buffer, length);
            MsgStoragePropertyData.WriteStream(writer.PropertiesWriter, propertyTag, length);
        }
Ejemplo n.º 4
0
        private static void WriteArrayOfBinary(MsgSubStorageWriter writer, TnefPropertyTag propertyTag, object value)
        {
            byte[][] array = value as byte[][];
            if (array == null)
            {
                throw new InvalidOperationException(MsgStorageStrings.InvalidValueType(typeof(byte[][]), value.GetType()));
            }
            MsgSubStorageWriter.WriterBuffer lengthsBuffer = writer.LengthsBuffer;
            for (int num = 0; num != array.Length; num++)
            {
                lengthsBuffer.Writer.Write(array[num].Length);
                lengthsBuffer.Writer.Write(0);
                writer.Storage.WriteBytesToStream(Util.PropertyStreamName(propertyTag, num), array[num]);
            }
            int length = lengthsBuffer.GetLength();

            byte[] buffer = lengthsBuffer.GetBuffer();
            writer.Storage.WriteBytesToStream(Util.PropertyStreamName(propertyTag), buffer, length);
            MsgStoragePropertyData.WriteStream(writer.PropertiesWriter, propertyTag, length);
        }