Exemple #1
0
 protected override void BuildHeader(IStream propertyStream)
 {
     // 1.1.1 Set 8 bytes reserve.
     propertyStream.WriteZero(8);
     // 1.1.2 Set Next Recipient Id
     Int32 recipientCount = RecipientProperties.Count;
     propertyStream.Write(recipientCount);
     // 1.1.3 Set Next Attachment Id
     propertyStream.Write(AttachmentProperties.Count);
     // 1.1.4 Set Recipient Count
     propertyStream.Write(recipientCount);
     // 1.1.5 Set Attachment Count
     propertyStream.Write(AttachmentProperties.Count);
     // 1.1.6 Set 8 bytes Reserve;
     propertyStream.WriteZero(8);
 }
 protected override void BuildHeader(IStream propertyStream)
 {
     // 1.1.1 Set 8 bytes reserve.
     propertyStream.WriteZero(8);
 }
Exemple #3
0
        protected virtual void WritePropertyInfoToPropertyStream(IStream propertyStream, IPropValue property)
        {
            if ((property is FixPropValue && !PropertyTag.IsGuidType(property.PropTag)) || (property is SpecialFixProperty))
            {
                // 1.2.1 Set fixed data
                // 1.2.1.1 Set Tag
                propertyStream.Write(property.PropTag.Bytes);
                // 1.2.1.2 Set Flag
                propertyStream.Write((Int32)0x06);
                // 1.2.1.3 Set Value
                var value = ModifyPropertyValue(property);
                propertyStream.Write(value);
                propertyStream.WriteZero(8 - value.Length);
            }
            else if((property is SpecialFixProperty) && property.PropTag.PropertyType == (short)PropertyType.PT_OBJECT)
            {
                // 1.2.1 Set fixed data
                // 1.2.1.1 Set Tag
                propertyStream.Write(property.PropTag.Bytes);
                // 1.2.1.2 Set Flag
                propertyStream.Write((Int32)0x06);
                // 1.2.1.3 Set Value
                var value = ModifyPropertyValue(property);
                propertyStream.Write(value);
                propertyStream.WriteZero(8 - value.Length);
            }
            else if (property is VarPropValue || PropertyTag.IsGuidType(property.PropTag) || property is SpecialVarBaseProperty)
            {
                // 1.2.2 Set variable data
                // 1.2.2.1 Set Tag
                var tag = GetPropertyTag(property.PropTag);
                propertyStream.Write(tag);
                // 1.2.2.2 Set Flag
                propertyStream.Write((Int32)0x06);
                // 1.2.2.3 Set Size
                var valueSize = ModifyPropertyLength(property);
                //var valueSize = property.PropValue.BytesCountForMsg;
                //if (property.PropValue is VarStringValue)
                //{

                //    if (valueSize == 0)
                //        propertyStream.Write((Int32)2);
                //    else
                //        propertyStream.Write(valueSize);
                //}
                //else
                //{
                propertyStream.Write(valueSize);
                //}
                // 1.2.2.4 Set Reserve , todo if contain embed message, it must set 0x01, if OLE, set 0x04;
                propertyStream.WriteZero(4);
            }
            else if (property is MvPropValue)
            {
                // 1.2.3 Set variable data
                // 1.2.3.1 Set Tag
                var tag = GetPropertyTag(property.PropTag);
                propertyStream.Write(tag);
                // 1.2.3.2 Set Flag
                propertyStream.Write((Int32)0x06);
                // 1.2.3.3 Set Size, todo must check the length is all value's bytes total length;
                if (PropertyTag.IsMultiVarType((ushort)property.PropTag.PropertyType))
                {
                    propertyStream.Write((Int32)(((ISizeValue)property.PropValue).ItemCount) * 4);
                }
                else
                {
                    propertyStream.Write((Int32)(((ISizeValue)property.PropValue).ItemCount) * PropertyTag.GetFixPropertyTypeLength((ushort)property.PropTag.PropertyType));
                }
                // 1.2.3.4 Set Reserve , todo if contain embed message, it must set 0x01, if OLE, set 0x04;
                propertyStream.WriteZero(4);
            }
        }