Beispiel #1
0
        internal MsgStorageWriter OpenAttachedMessageWriter()
        {
            if (this.attachMethod != 5)
            {
                throw new InvalidOperationException(MsgStorageStrings.NotAMessageAttachment);
            }
            ComStorage       comStorage       = null;
            MsgStorageWriter msgStorageWriter = null;

            try
            {
                TnefPropertyTag attachDataObj = TnefPropertyTag.AttachDataObj;
                string          storageName   = Util.PropertyStreamName(attachDataObj);
                MsgStoragePropertyData.WriteObject(this.propertiesWriter, attachDataObj, MsgStoragePropertyData.ObjectType.Message);
                comStorage = this.subStorage.CreateStorage(storageName, ComStorage.OpenMode.CreateWrite);
                comStorage.StorageClass = Util.ClassIdMessageAttachment;
                msgStorageWriter        = new MsgStorageWriter(this.owner, comStorage);
            }
            finally
            {
                if (msgStorageWriter == null && comStorage != null)
                {
                    comStorage.Dispose();
                }
            }
            return(msgStorageWriter);
        }
 internal MsgStorageWriter(MsgStorageWriter parent, ComStorage storage)
 {
     this.parent            = parent;
     this.messageStorage    = storage;
     this.namedPropertyList = parent.NamedPropertyList;
     this.isTopLevelMessage = false;
     this.Initialize(MsgSubStorageType.AttachedMessage);
 }
Beispiel #3
0
 internal MsgSubStorageWriter(MsgStorageWriter owner, MsgSubStorageType type, ComStorage subStorage)
 {
     this.owner            = owner;
     this.subStorage       = subStorage;
     this.subStorageType   = type;
     this.attachMethod     = -1;
     this.propertiesCache  = new MemoryStream();
     this.propertiesWriter = new BinaryWriter(this.propertiesCache);
     this.prefix           = new MsgStoragePropertyPrefix(type);
     this.prefix.Write(this.propertiesWriter);
 }