ReadMarker() public method

Read a Markers value from stream, and advance the position within the stream by 4
public ReadMarker ( ) : Markers
return Markers
Beispiel #1
0
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            if (GroupInfo.Verify(stream))
            {
                this.groupInfo = new GroupInfo(stream);
            }

            if (stream.VerifyMetaProperty(MetaProperties.MetaTagIncrSyncGroupId))
            {
                stream.ReadMarker();
                this.incrSyncGroupId = stream.ReadUInt32();
            }

            if (stream.ReadMarker(Markers.PidTagIncrSyncChgPartial))
            {
                this.messageChangeHeader = new MessageChangeHeader(stream);
                this.propListList        = new List <PropList>();
                while (stream.VerifyMetaProperty(MetaProperties.MetaTagIncrementalSyncMessagePartial))
                {
                    stream.ReadMarker();
                    this.incrementalSyncMessagePartial = stream.ReadUInt32();
                    this.propListList.Add(new PropList(stream));
                }

                this.MessageChildren = new MessageChildren(stream);
                return;
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
        }
        /// <summary>
        /// Deserialize a nested structure defined as StartMarker content EndMarker
        /// </summary>
        /// <typeparam name="T">The deserialized type</typeparam>
        /// <param name="stream">A FastTransferStream</param>
        /// <param name="startMarker">The start marker of the nested structure</param>
        /// <param name="endMarker">The end marker of the nested structure</param>
        /// <param name="member">The deserialized nested structure</param>
        public void Deserialize <T>(
            FastTransferStream stream,
            Markers startMarker,
            Markers endMarker,
            out T member) where T : SyntacticalBase
        {
            Type subType = typeof(T);

            this.FindVerify(subType);

            if (stream.ReadMarker(startMarker))
            {
                object tmp = subType.Assembly.CreateInstance(
                    subType.FullName,
                    false,
                    BindingFlags.CreateInstance,
                    null,
                    new object[] { stream },
                    null,
                    null);
                if (stream.ReadMarker(endMarker))
                {
                    member = tmp as T;
                    Debug.Assert(member != null, "The deserialization operation should be successful.");
                    return;
                }
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
            member = null;
        }
Beispiel #3
0
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            if (stream.ReadMarker(StartMarker))
            {
                this.props = new PropList(stream);
                if (stream.ReadMarker(EndMarker))
                {
                    return;
                }
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            if (stream.ReadMarker(Markers.PidTagIncrSyncChg))
            {
                this.messageChangeHeader = new MessageChangeHeader(stream);
                if (stream.ReadMarker(Markers.PidTagIncrSyncMessage))
                {
                    this.propList        = new PropList(stream);
                    this.messageChildren = new MessageChildren(stream);
                    return;
                }
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            int count = 0;

            this.messages      = new List <Message>();
            this.errorCodeList = new List <uint>();
            do
            {
                if (stream.VerifyMetaProperty(MetaProperties.PidTagEcWarning))
                {
                    stream.ReadMarker();
                    this.errorCodeList.Add(stream.ReadUInt32());
                    return;
                }

                if (Message.Verify(stream))
                {
                    this.messages.Add(new Message(stream));
                }
                else if (count > 0)
                {
                    return;
                }
                else
                {
                    AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
                }

                count++;
            }while (Verify(stream));
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            if (stream.ReadMarker(Markers.PidTagIncrSyncDel))
            {
                this.propList = new PropList(stream);
                return;
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
        }
Beispiel #7
0
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            if (stream.ReadMarker(Markers.PidTagIncrSyncDel))
            {
                this.propList = new PropList(stream);
                return;
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            this.fxdelPropsAll              = new List <uint>();
            this.fxdelPropsBeforeRecipient  = new List <uint>();
            this.fxdelPropsBeforeAttachment = new List <uint>();
            this.attachments = new List <Attachment>();
            this.recipients  = new List <Recipient>();
            while (stream.VerifyMetaProperty(MetaProperties.PidTagFXDelProp))
            {
                stream.ReadMarker();
                this.fxdelPropsBeforeRecipient.Add(stream.ReadUInt32());
            }

            if (Recipient.Verify(stream))
            {
                this.recipients = new List <Recipient>();
                while (Recipient.Verify(stream))
                {
                    this.recipients.Add(new Recipient(stream));
                }
            }

            while (stream.VerifyMetaProperty(MetaProperties.PidTagFXDelProp))
            {
                stream.ReadMarker();
                this.fxdelPropsBeforeAttachment.Add(stream.ReadUInt32());
            }

            while (Attachment.Verify(stream))
            {
                this.attachments.Add(new Attachment(stream));
            }

            for (int i = 0; i < this.fxdelPropsBeforeRecipient.Count; i++)
            {
                this.fxdelPropsAll.Add(this.fxdelPropsBeforeRecipient[i]);
            }

            for (int i = 0; i < this.fxdelPropsBeforeAttachment.Count; i++)
            {
                this.fxdelPropsAll.Add(this.fxdelPropsBeforeAttachment[i]);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            this.folderChangeList = new List <FolderChange>();
            while (FolderChange.Verify(stream))
            {
                this.folderChangeList.Add(new FolderChange(stream));
            }

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

            this.state = new State(stream);
            if (!stream.ReadMarker(Markers.PidTagIncrSyncEnd))
            {
                AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
            }
        }
Beispiel #10
0
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            this.messageChangeTuples = new List <Tuple <ProgressPerMessage, MessageChange> >();
            if (ProgressTotal.Verify(stream))
            {
                this.progressTotal = new ProgressTotal(stream);
            }

            while (ProgressPerMessage.Verify(stream) ||
                   MessageChange.Verify(stream))
            {
                ProgressPerMessage tmp1 = null;
                MessageChange      tmp2 = null;
                if (ProgressPerMessage.Verify(stream))
                {
                    tmp1 = new ProgressPerMessage(stream);
                }

                tmp2 = MessageChange.DeserializeFrom(stream) as MessageChange;
                this.messageChangeTuples.Add(
                    new Tuple <ProgressPerMessage, MessageChange>(
                        tmp1, tmp2));
            }

            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.PidTagIncrSyncEnd))
            {
                AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
            }
        }
Beispiel #11
0
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            int  count    = 0;
            long lastPosi = stream.Position;

            this.fxdelPropList    = new List <uint>();
            this.messageLists     = new List <MessageList>();
            this.messageTupleList = new List <Tuple <List <uint>, MessageList> >();
            while (!stream.IsEndOfStream &&
                   count < 2)
            {
                lastPosi = stream.Position;
                List <uint> metaProps = new List <uint>();
                while (stream.VerifyMetaProperty(MetaProperties.PidTagFXDelProp))
                {
                    stream.ReadMarker();
                    uint delProp = stream.ReadUInt32();
                    metaProps.Add(delProp);
                }

                if (MessageList.Verify(stream))
                {
                    MessageList msgList = new MessageList(stream);

                    this.messageLists.Add(msgList);
                    this.fxdelPropList.AddRange(metaProps);
                    this.messageTupleList.Add(new Tuple <List <uint>, MessageList>(
                                                  metaProps, msgList));
                }
                else
                {
                    stream.Position = lastPosi;
                    break;
                }

                count++;
            }
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            if (stream.ReadMarker(StartMarker))
            {
                this.props = new PropList(stream);
                if (stream.ReadMarker(EndMarker))
                {
                    return;
                }
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            int count = 0;
            long lastPosi = stream.Position;
            this.fxdelPropList = new List<uint>();
            this.messageLists = new List<MessageList>();
            this.messageTupleList = new List<Tuple<List<uint>, MessageList>>();
            while (!stream.IsEndOfStream 
                && count < 2)
            {
                lastPosi = stream.Position;
                List<uint> metaProps = new List<uint>();
                while (stream.VerifyMetaProperty(MetaProperties.PidTagFXDelProp))
                {
                    stream.ReadMarker();
                    uint delProp = stream.ReadUInt32();
                    metaProps.Add(delProp);
                }

                if (MessageList.Verify(stream))
                {
                    MessageList msgList = new MessageList(stream);

                    this.messageLists.Add(msgList);
                    this.fxdelPropList.AddRange(metaProps);
                    this.messageTupleList.Add(new Tuple<List<uint>, MessageList>(
                    metaProps, msgList));
                }
                else
                {
                    stream.Position = lastPosi;
                    break;
                }

                count++;
            }
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            if (stream.ReadMarker(Markers.PidTagIncrSyncChg))
            {
                this.messageChangeHeader = new MessageChangeHeader(stream);
                if (stream.ReadMarker(Markers.PidTagIncrSyncMessage))
                {
                    this.propList = new PropList(stream);
                    this.messageChildren = new MessageChildren(stream);
                    return;
                }
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            this.messageChangeTuples = new List<Tuple<ProgressPerMessage, MessageChange>>();
            if (ProgressTotal.Verify(stream))
            {
                this.progressTotal = new ProgressTotal(stream);
            }

            while (ProgressPerMessage.Verify(stream)
                || MessageChange.Verify(stream))
            {
                ProgressPerMessage tmp1 = null;
                MessageChange tmp2 = null;
                if (ProgressPerMessage.Verify(stream))
                {
                    tmp1 = new ProgressPerMessage(stream);
                }

                tmp2 = MessageChange.DeserializeFrom(stream) as MessageChange;
                this.messageChangeTuples.Add(
                    new Tuple<ProgressPerMessage, MessageChange>(
                        tmp1, tmp2));
            }

            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.PidTagIncrSyncEnd))
            {
                AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
            }
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            this.folderChangeList = new List<FolderChange>();
            while (FolderChange.Verify(stream))
            {
                this.folderChangeList.Add(new FolderChange(stream));
            }

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

            this.state = new State(stream);
            if (!stream.ReadMarker(Markers.PidTagIncrSyncEnd))
            {
                AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
            }
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            if (GroupInfo.Verify(stream))
            {
                this.groupInfo = new GroupInfo(stream);
            }

            if (stream.VerifyMetaProperty(MetaProperties.MetaTagIncrSyncGroupId))
            {
                stream.ReadMarker();
                this.incrSyncGroupId = stream.ReadUInt32();
            }

            if (stream.ReadMarker(Markers.PidTagIncrSyncChgPartial))
            {
                this.messageChangeHeader = new MessageChangeHeader(stream);
                this.propListList = new List<PropList>();
                while (stream.VerifyMetaProperty(MetaProperties.MetaTagIncrementalSyncMessagePartial))
                {
                    stream.ReadMarker();
                    this.incrementalSyncMessagePartial = stream.ReadUInt32();
                    this.propListList.Add(new PropList(stream));
                }

                this.MessageChildren = new MessageChildren(stream);
                return;
            }

            AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            int count = 0;
            this.messages = new List<Message>();
            this.errorCodeList = new List<uint>();
            do
            {
                if (stream.VerifyMetaProperty(MetaProperties.PidTagEcWarning))
                {
                    stream.ReadMarker();
                    this.errorCodeList.Add(stream.ReadUInt32());
                    return;
                }

                if (Message.Verify(stream))
                {
                    this.messages.Add(new Message(stream));
                }
                else if (count > 0)
                {
                    return;
                }
                else
                {
                    AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully.");
                }

                count++;
            } 
            while (Verify(stream));
        }
        /// <summary>
        /// Deserialize fields from a FastTransferStream.
        /// </summary>
        /// <param name="stream">A FastTransferStream.</param>
        public override void Deserialize(FastTransferStream stream)
        {
            this.fxdelPropsAll = new List<uint>();
            this.fxdelPropsBeforeRecipient = new List<uint>();
            this.fxdelPropsBeforeAttachment = new List<uint>();
            this.attachments = new List<Attachment>();
            this.recipients = new List<Recipient>();
            while (stream.VerifyMetaProperty(MetaProperties.PidTagFXDelProp))
            {
                stream.ReadMarker();
                this.fxdelPropsBeforeRecipient.Add(stream.ReadUInt32());
            }

            if (Recipient.Verify(stream))
            {
                this.recipients = new List<Recipient>();
                while (Recipient.Verify(stream))
                {
                    this.recipients.Add(new Recipient(stream));
                }
            }

            while (stream.VerifyMetaProperty(MetaProperties.PidTagFXDelProp))
            {
                stream.ReadMarker();
                this.fxdelPropsBeforeAttachment.Add(stream.ReadUInt32());
            }

            while (Attachment.Verify(stream))
            {
                this.attachments.Add(new Attachment(stream));
            }

            for (int i = 0; i < this.fxdelPropsBeforeRecipient.Count; i++)
            {
                this.fxdelPropsAll.Add(this.fxdelPropsBeforeRecipient[i]);
            }

            for (int i = 0; i < this.fxdelPropsBeforeAttachment.Count; i++)
            {
                this.fxdelPropsAll.Add(this.fxdelPropsBeforeAttachment[i]);
            }
        }