Used for Parsing a fast transfer stream.
Inheritance: System.IO.MemoryStream
コード例 #1
0
        /// <summary>
        /// Parse fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Parse(FastTransferStream stream)
        {
            List<ProgressPerMessageChange> InterProgressPerMessageChanges = new List<ProgressPerMessageChange>();
            if (ProgressTotal.Verify(stream))
            {
                this.ProgressTotal = new ProgressTotal(stream);
            }

            while (ProgressPerMessageChange.Verify(stream))
            {
                InterProgressPerMessageChanges.Add(new ProgressPerMessageChange(stream));
            }
            this.ProgressPerMessageChanges = InterProgressPerMessageChanges.ToArray();

            if (Deletions.Verify(stream))
            {
                this.Deletions = new Deletions(stream);
            }

            if (ReadStateChanges.Verify(stream))
            {
                this.ReadStateChanges = new ReadStateChanges(stream);
            }

            this.State = new State(stream);
            if (stream.ReadMarker() == Markers.IncrSyncEnd)
            {
                this.EndMarker = Markers.IncrSyncEnd;
            }
            else
            {
                throw new Exception("The ContentsSync cannot be parsed successfully. The IncrSyncEnd Marker is missed.");
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the EmbeddedMessage class.
 /// </summary>
 /// <param name="stream">The stream.</param>
 public EmbeddedMessage(FastTransferStream stream)
     : base(stream)
 {
 }
コード例 #3
0
 /// <summary>
 /// Parse fields from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void Parse(FastTransferStream stream)
 {
     if (stream.ReadMarker() == Markers.StartEmbed)
     {
         this.StartMarker = Markers.NewAttach;
         this.MessageContent = new MessageContent(stream);
         if (stream.ReadMarker() == Markers.EndEmbed)
         {
             this.EndMarker = Markers.EndEmbed;
         }
         else
         {
             throw new Exception("The EmbeddedMessage cannot be parsed successfully. The EndEmbed Marker is missed.");
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// Parse a DispidNamedPropInfo instance from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 /// <returns>A DispidNamedPropInfo instance.</returns>
 public static new LexicalBase ParseFrom(FastTransferStream stream)
 {
     return new DispidNamedPropInfo(stream);
 }
コード例 #5
0
 /// <summary>
 /// Verify that a stream's current position contains a serialized DispidNamedPropInfo.
 /// </summary>
 /// <param name="stream">A FastTransferStream</param>
 /// <returns>If the stream's current position contains a serialized DispidNamedPropInfo, return true, else false</returns>
 public static bool Verify(FastTransferStream stream)
 {
     return stream.Verify(0x00, Guid.Empty.ToByteArray().Length);
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the VarPropTypePropValue class.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public VarPropTypePropValue(FastTransferStream stream)
     : base(stream)
 {
 }
コード例 #7
0
 /// <summary>
 /// Verify that a stream's current position contains a serialized VarPropTypePropValue.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 /// <returns>If the stream's current position contains a serialized VarPropTypePropValue, return true, else false</returns>
 public static new bool Verify(FastTransferStream stream)
 {
     ushort tmp = stream.VerifyUInt16();
     return LexicalTypeHelper.IsVarType((PropertyDataType)tmp)
         || PropValue.IsMetaTagIdsetGiven(stream)
         || LexicalTypeHelper.IsCodePageType(tmp);
 }
コード例 #8
0
 /// <summary>
 /// Parse fields from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void Parse(FastTransferStream stream)
 {
     if (stream.ReadMarker() == Markers.IncrSyncStateBegin)
     {
         this.StartMarker = Markers.IncrSyncStateBegin;
         this.PropList = new PropList(stream);
         if (stream.ReadMarker() == Markers.IncrSyncStateEnd)
         {
             this.EndMarker = Markers.IncrSyncStateEnd;
         }
         else
         {
             throw new Exception("The State cannot be parsed successfully. The IncrSyncStateEnd Marker is missed.");
         }
     }
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the SubFolderNoDelProps class.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public SubFolderNoDelProps(FastTransferStream stream)
     : base(stream)
 {
 }
コード例 #10
0
 /// <summary>
 /// Verify that a stream's current position contains a serialized State.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 /// <returns>If the stream's current position contains a serialized State, return true, else false.</returns>
 public static bool Verify(FastTransferStream stream)
 {
     return stream.VerifyMarker(Markers.IncrSyncStateBegin);
 }
コード例 #11
0
 /// <summary>
 /// Parse fields from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void Parse(FastTransferStream stream)
 {
     if (stream.ReadMarker() == Markers.IncrSyncDel)
     {
         this.StartMarker = Markers.IncrSyncDel;
         this.PropList = new PropList(stream);
     }
 }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the State class.
 /// </summary>
 /// <param name="stream">The stream.</param>
 public State(FastTransferStream stream)
     : base(stream)
 {
 }
コード例 #13
0
 /// <summary>
 /// Parse from a stream.
 /// </summary>
 /// <param name="stream">A stream contains SizedXid.</param>
 public void Parse(FastTransferStream stream)
 {
     this.xidSize = stream.ReadByte();
     this.xid = new XID((int)this.xidSize);
     this.xid.Parse(stream);
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the Deletions class.
 /// </summary>
 /// <param name="stream">The stream.</param>
 public Deletions(FastTransferStream stream)
     : base(stream)
 {
 }
コード例 #15
0
 /// <summary>
 /// Initializes a new instance of the DispidNamedPropInfo class.
 /// </summary>
 /// <param name="stream">A FastTransferStream</param>
 public DispidNamedPropInfo(FastTransferStream stream)
     : base(stream)
 {
 }
コード例 #16
0
 /// <summary>
 /// Parse fields from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void Parse(FastTransferStream stream)
 {
     if (stream.ReadMarker() == Markers.StartSubFld)
     {
         this.StartMarker = Markers.StartSubFld;
         this.folderContentNoDelProps = new FolderContentNoDelProps(stream);
         if (stream.ReadMarker() == Markers.EndFolder)
         {
             this.EndMarker = Markers.EndFolder;
         }
         else
         {
             throw new Exception("The SubFolderNoDelProps cannot be parsed successfully. The EndFolder Marker is missed.");
         }
     }
 }
コード例 #17
0
 /// <summary>
 /// Parse fields from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void Parse(FastTransferStream stream)
 {
     if (stream.ReadMarker() == Markers.StartTopFld)
     {
         this.StartMarker = Markers.StartTopFld;
         this.FolderContentNoDelProps = new FolderContentNoDelProps(stream);
         if (stream.ReadMarker() == Markers.EndFolder)
         {
             this.EndMarker = Markers.EndFolder;
         }
     }
 }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the SyncMessagePartialPropList class.
 /// </summary>
 /// <param name="stream">The stream.</param>
 public SyncMessagePartialPropList(FastTransferStream stream)
     : base(stream)
 {
 }
コード例 #19
0
 /// <summary>
 /// Parse a VarPropTypePropValue instance from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 /// <returns>A VarPropTypePropValue instance.</returns>
 public static new LexicalBase ParseFrom(FastTransferStream stream)
 {
     return new VarPropTypePropValue(stream);
 }
コード例 #20
0
 /// <summary>
 /// Verify that a stream's current position contains a serialized SyncMessagePartialPropList.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 /// <returns>If the stream's current position contains a serialized SyncMessagePartialPropList, return true, else false.</returns>
 public static bool Verify(FastTransferStream stream)
 {
     return stream.VerifyUInt32() == (uint)MetaProperties.MetaTagIncrementalSyncMessagePartial;
 }
コード例 #21
0
        /// <summary>
        /// Parse next object from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Parse(FastTransferStream stream)
        {
            base.Parse(stream);
            this.Length = stream.ReadInt32();

            if (LexicalTypeHelper.IsCodePageType(this.PropType))
            {
                CodePageType type = (CodePageType)this.PropType;
                switch (type)
                {
                    case CodePageType.PtypCodePageUnicode:
                        PtypString pstring = new PtypString();
                        pstring.Parse(stream);
                        this.ValueArray = pstring;
                        break;
                    case CodePageType.PtypCodePageUnicodeBigendian:
                    case CodePageType.PtypCodePageWesternEuropean:
                        PtypString8 pstring8 = new PtypString8();
                        pstring8.Parse(stream);
                        this.ValueArray = pstring8;
                        break;
                    default:
                        PtypString8 defaultstring8 = new PtypString8();
                        defaultstring8.Parse(stream);
                        break;
                }
            }
            else
            {
                PropertyDataType type = (PropertyDataType)this.PropType;
                switch (type)
                {
                    case PropertyDataType.PtypInteger32:
                    case PropertyDataType.PtypBinary:
                        // PidTagParentSourceKey, PidTagParentSourceKey, PidTagChangeKey
                        if (this.PropInfo.PropID == 0x65E0 || this.PropInfo.PropID == 0x65E1 || this.PropInfo.PropID == 0x65E2)
                        {
                            if (this.Length != 0)
                            {
                                XID tmpXID = new XID(this.Length);
                                tmpXID.Parse(stream);
                                this.ValueArray = tmpXID;
                            }
                        }
                        else if (this.PropInfo.PropID == 0x65E3) // PidTagPredecessorChangeList
                        {
                            PredecessorChangeList tmpPredecessorChangeList = new PredecessorChangeList(this.Length);
                            tmpPredecessorChangeList.Parse(stream);
                            this.ValueArray = tmpPredecessorChangeList;
                        }
                        else if (this.PropInfo.PropID == 0x402D || this.PropInfo.PropID == 0x402E || this.PropInfo.PropID == 0x67E5 || this.PropInfo.PropID == 0x4021 || this.PropInfo.PropID == 0x6793)
                        {
                            if (this.Length != 0)
                            {
                                int begionPosition = (int)stream.Position;
                                int EveLength = this.Length;
                                List<IDSET_REPLID> InterIDSET_REPLID = new List<IDSET_REPLID>();
                                while (EveLength > 0)
                                {
                                    IDSET_REPLID tmpIDSET_REPLID = new IDSET_REPLID();
                                    tmpIDSET_REPLID.Parse(stream);
                                    InterIDSET_REPLID.Add(tmpIDSET_REPLID);
                                    EveLength -= ((int)stream.Position - begionPosition);
                                }
                                this.ValueArray = InterIDSET_REPLID.ToArray();
                            }
                        }
                        else if (this.PropInfo.PropID == 0x4017 || this.PropInfo.PropID == 0x6796 || this.PropInfo.PropID == 0x67DA || this.PropInfo.PropID == 0x67D2)
                        {
                            if (this.Length != 0)
                            {
                                int begionPosition = (int)stream.Position;
                                int EveLength = this.Length;
                                List<IDSET_REPLGUID> InterIDSET_REPLGUID = new List<IDSET_REPLGUID>();
                                while (EveLength > 0)
                                {
                                    IDSET_REPLGUID tmpIDSET_REPLGUID = new IDSET_REPLGUID();
                                    tmpIDSET_REPLGUID.Parse(stream);
                                    InterIDSET_REPLGUID.Add(tmpIDSET_REPLGUID);
                                    EveLength -= ((int)stream.Position - begionPosition);
                                }
                                this.ValueArray = InterIDSET_REPLGUID.ToArray();
                            }
                        }
                        else
                        {
                            this.ValueArray = stream.ReadBlock(this.Length);
                        }
                        break;
                    case PropertyDataType.PtypString:
                        PtypString pstring = new PtypString();
                        pstring.Parse(stream);
                        this.ValueArray = pstring;
                        break;
                    case PropertyDataType.PtypString8:
                        PtypString8 pstring8 = new PtypString8();
                        pstring8.Parse(stream);
                        this.ValueArray = pstring8;
                        break;
                    case PropertyDataType.PtypServerId:
                        PtypServerId pserverId = new PtypServerId();
                        pserverId.Parse(stream);
                        this.ValueArray = pserverId;
                        break;
                    case PropertyDataType.PtypObject_Or_PtypEmbeddedTable:
                        this.ValueArray = stream.ReadBlock(this.Length);
                        break;
                    default:
                        this.ValueArray = stream.ReadBlock(this.Length);
                        break;
                }
            }
        }
コード例 #22
0
 /// <summary>
 /// Parse fields from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void Parse(FastTransferStream stream)
 {
     if (stream.VerifyMetaProperty(MetaProperties.MetaTagIncrementalSyncMessagePartial))
     {
         this.Meta_SyncMessagePartial = new MetaPropValue(stream);
     }
     this.PropList = new PropList(stream);
 }
コード例 #23
0
 /// <summary>
 /// Parse from a stream.
 /// </summary>
 /// <param name="stream">A stream contains XID.</param>
 public void Parse(FastTransferStream stream)
 {
     this.namespaceGuid = stream.ReadGuid();
     this.localId = stream.ReadBlock((int)this.length - 16);
 }
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the SyntacticalBase class.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 protected SyntacticalBase(FastTransferStream stream)
 {
     this.PreviousPosition = stream.Position;
     if (stream != null && stream.Length > 0)
     {
         this.Parse(stream);
     }
 }
コード例 #25
0
 /// <summary>
 /// Parse next object from a FastTransferStream.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public override void Parse(FastTransferStream stream)
 {
     base.Parse(stream);
     this.Dispid = stream.ReadInt32();
 }
コード例 #26
0
 /// <summary>
 /// Parse object from memory stream,
 /// </summary>
 /// <param name="stream">Stream contains the serialized object</param>
 public abstract void Parse(FastTransferStream stream);
コード例 #27
0
 /// <summary>
 /// Verify that a stream's current position contains a serialized EmbeddedMessage.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 /// <returns>If the stream's current position contains a serialized EmbeddedMessage, return true, else false.</returns>
 public static bool Verify(FastTransferStream stream)
 {
     return stream.VerifyMarker(Markers.StartEmbed);
 }
コード例 #28
0
 /// <summary>
 /// Initializes a new instance of the TopFolder class.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 public TopFolder(FastTransferStream stream)
     : base(stream)
 {
 }
コード例 #29
0
 /// <summary>
 /// Parse from a stream.
 /// </summary>
 /// <param name="stream">A stream contains EndCommand.</param>
 public override void Parse(FastTransferStream stream)
 {
     this.Command = stream.ReadByte();
 }
コード例 #30
0
 /// <summary>
 /// Verify that a stream's current position contains a serialized contentsSync.
 /// </summary>
 /// <param name="stream">A FastTransferStream.</param>
 /// <returns>If the stream's current position contains a serialized contentsSync, return true, else false.</returns>
 public static bool Verify(FastTransferStream stream)
 {
     return (ProgressTotal.Verify(stream)
         || ProgressPerMessageChange.Verify(stream)
         || Deletions.Verify(stream)
         || ReadStateChanges.Verify(stream)
         || State.Verify(stream))
         && stream.VerifyMarker(Markers.IncrSyncEnd, (int)stream.Length - 4 - (int)stream.Position); ;
 }