/// <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> /// Initializes a new instance of the LexicalBase class. /// </summary> /// <param name="stream">A FastTransferStream</param> protected LexicalBase(FastTransferStream stream) { this.Deserialize(stream); // No exception set flag this.isNotSplitedInSingleItem = true; }
/// <summary> /// Deserialize structure defined as StartMarker content /// </summary> /// <typeparam name="T">The type of the deserialized structure</typeparam> /// <param name="stream">A FastTransferStream</param> /// <param name="startMarker">The start marker of the deserialized structure</param> /// <param name="member">The deserialized structure</param> public void Deserialize <T>( FastTransferStream stream, Markers startMarker, 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); member = tmp as T; AdapterHelper.Site.Assert.IsNotNull(member, "The deserialization operation should be successful."); return; } AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully."); member = null; }
/// <summary> /// Deserialize fields from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> public override void Deserialize(FastTransferStream stream) { this.Deserialize<PropList>( stream, Markers.PidTagIncrSyncProgressPerMsg, out this.propList); }
/// <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> /// 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(StartMarker) && stream.VerifyMarker( EndMarker, (int)stream.Length - MarkersHelper.PidTagLength - (int)stream.Position)); }
/// <summary> /// Deserialize fields from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> public override void Deserialize(FastTransferStream stream) { this.Deserialize <PropList>( stream, Markers.PidTagIncrSyncProgressPerMsg, out this.propList); }
/// <summary> /// Deserialize next object from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream</param> public override void ConsumeNext(FastTransferStream stream) { base.ConsumeNext(stream); PropertyDataType type = (PropertyDataType)this.PropType; this.length = stream.ReadInt16(); switch (type) { case PropertyDataType.PtypMultipleInteger16: this.fixedSizeValueList = stream.ReadBlocks(this.length, 2); break; case PropertyDataType.PtypMultipleInteger32: this.fixedSizeValueList = stream.ReadBlocks(this.length, 4); break; case PropertyDataType.PtypMultipleFloating32: this.fixedSizeValueList = stream.ReadBlocks(this.length, 4); break; case PropertyDataType.PtypMultipleFloating64: this.fixedSizeValueList = stream.ReadBlocks(this.length, 8); break; case PropertyDataType.PtypMultipleCurrency: this.fixedSizeValueList = stream.ReadBlocks(this.length, 8); break; case PropertyDataType.PtypMultipleFloatingTime: this.fixedSizeValueList = stream.ReadBlocks(this.length, 8); break; case PropertyDataType.PtypMultipleInteger64: this.fixedSizeValueList = stream.ReadBlocks(this.length, 8); break; case PropertyDataType.PtypMultipleTime: this.fixedSizeValueList = stream.ReadBlocks(this.length, 8); break; case PropertyDataType.PtypMultipleGuid: this.fixedSizeValueList = stream.ReadBlocks(this.length, Guid.Empty.ToByteArray().Length); break; case PropertyDataType.PtypMultipleBinary: this.varSizeValueList = stream.ReadLengthBlocks(this.length); break; case PropertyDataType.PtypMultipleString: this.varSizeValueList = stream.ReadLengthBlocks(this.length); break; case PropertyDataType.PtypMultipleString8: this.varSizeValueList = stream.ReadLengthBlocks(this.length); break; } }
/// <summary> /// Verify that a stream's current position contains a serialized hierarchySync. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>If the stream's current position contains /// a serialized hierarchySync, return true, else false.</returns> public static bool Verify(FastTransferStream stream) { return((FolderChange.Verify(stream) || Deletions.Verify(stream) || State.Verify(stream)) && stream.VerifyMarker( Markers.PidTagIncrSyncEnd, (int)stream.Length - MarkersHelper.PidTagLength - (int)stream.Position)); }
/// <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> /// 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.errorInfoList = new List <ErrorInfo>(); this.Deserialize(stream); } // No exception set flag. this.isNotSplitedInSingleItem = true; }
/// <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) || ProgressPerMessage.Verify(stream) || MessageChange.Verify(stream) || Deletions.Verify(stream) || ReadStateChanges.Verify(stream) || State.Verify(stream)) && stream.VerifyMarker( EndMarker, (int)stream.Length - MarkersHelper.PidTagLength - (int)stream.Position)); }
/// <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> /// Check errorInfos in a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream</param> /// <param name="offset">An offset to the current position of the FastTransferStream</param> /// <returns>If the FastTransferStream contains errorInfos then read them and /// return true, else return false. /// </returns> protected bool CheckErrorInfo(FastTransferStream stream, int offset) { int count = 0; stream.Position += offset; while (stream.VerifyErrorInfo(0)) { this.errorInfoList.Add(new ErrorInfo(stream)); count++; } return(count > 0); }
/// <summary> /// Deserialize fields from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> public override void Deserialize(FastTransferStream stream) { this.propValues = new List <PropValue>(); while (PropValue.Verify(stream) && !MarkersHelper.IsEndMarkerExceptEcWarning(stream.VerifyUInt32())) { this.propValues.Add(PropValue.DeserializeFrom(stream) as PropValue); } if (SyntacticalBase.AllPropList != null) { SyntacticalBase.AllPropList.Add(this); } }
/// <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 a messageChange from a stream. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>A messageChange object.</returns> public static SyntacticalBase DeserializeFrom(FastTransferStream stream) { if (MessageChangeFull.Verify(stream)) { return new MessageChangeFull(stream); } else if (MessageChangePartial.Verify(stream)) { return new MessageChangePartial(stream); } else { AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully."); return null; } }
/// <summary> /// Deserialize next object from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> public override void ConsumeNext(FastTransferStream stream) { base.ConsumeNext(stream); byte[] buffer = new byte[Guid.Empty.ToByteArray().Length]; stream.Read(buffer, 0, buffer.Length); this.propertySet = new Guid(buffer); int tmp = stream.ReadByte(); if (tmp == -1) { AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully."); } else if (tmp > 0) { this.flag = (byte)tmp; } }
/// <summary> /// Deserialize a messageChange from a stream. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>A messageChange object.</returns> public static SyntacticalBase DeserializeFrom(FastTransferStream stream) { if (MessageChangeFull.Verify(stream)) { return(new MessageChangeFull(stream)); } else if (MessageChangePartial.Verify(stream)) { return(new MessageChangePartial(stream)); } else { AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully."); return(null); } }
/// <summary> /// Deserialize a NamedPropInfo instance from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>A NamedPropInfo instance.</returns> public static LexicalBase DeserializeFrom(FastTransferStream stream) { if (DispidNamedPropInfo.Verify(stream)) { return new DispidNamedPropInfo(stream); } else if (NameNamedPropInfo.Verify(stream)) { return new NameNamedPropInfo(stream); } else { AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully."); return null; } }
/// <summary> /// Deserialize a NamedPropInfo instance from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>A NamedPropInfo instance.</returns> public static LexicalBase DeserializeFrom(FastTransferStream stream) { if (DispidNamedPropInfo.Verify(stream)) { return(new DispidNamedPropInfo(stream)); } else if (NameNamedPropInfo.Verify(stream)) { return(new NameNamedPropInfo(stream)); } else { AdapterHelper.Site.Assert.Fail("The stream cannot be deserialized successfully."); return(null); } }
/// <summary> /// Deserialize a LexicalBase instance from a FastTransferStream. /// </summary> /// <typeparam name="T">A subclass of LexicalBase</typeparam> /// <param name="stream">A FastTransferStream</param> /// <returns>The deserialized lexical object</returns> public static T DeserializeTo <T>(FastTransferStream stream) where T : LexicalBase { Type subType = typeof(T); object tmp = subType.Assembly.CreateInstance( subType.FullName, false, BindingFlags.CreateInstance, null, new object[] { stream }, null, null); T t = tmp as T; Debug.Assert(t != null, "Assure deserialize success."); return(t); }
/// <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]); } }
/// <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) { 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) { 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> /// Initializes a new instance of the FolderReplicaInfo structure. /// </summary> /// <param name="stream">A FastTransferStream.</param> public FolderReplicaInfo(FastTransferStream stream) { this.Flags = stream.ReadUInt32(); this.Depth = stream.ReadUInt32(); this.FolderLongTermId = new LongTermId { DatabaseGuid = stream.ReadGuid().ToByteArray(), GlobalCounter = new byte[6] }; stream.Read( this.FolderLongTermId.GlobalCounter, 0, this.FolderLongTermId.GlobalCounter.Length); stream.Read(new byte[2], 0, 2); this.ServerDNCount = stream.ReadUInt32(); this.CheapServerDNCount = stream.ReadUInt32(); this.ServerDNArray = new string[this.ServerDNCount]; for (int i = 0; i < this.ServerDNCount; i++) { this.ServerDNArray[i] = stream.ReadString8(); } }
/// <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> /// Verify that a stream's current position contains a serialized NameNamedPropInfo. /// </summary> /// <param name="stream">A FastTransferStream</param> /// <returns>If the stream's current position contains /// a serialized NameNamedPropInfo, return true, else false</returns> public static bool Verify(FastTransferStream stream) { return stream.Verify(0x01, Guid.Empty.ToByteArray().Length); }
/// <summary> /// Initializes a new instance of the NameNamedPropInfo class. /// </summary> /// <param name="stream">A FastTransferStream.</param> public NameNamedPropInfo(FastTransferStream stream) : base(stream) { }
/// <summary> /// Initializes a new instance of the ProgressPerMessage class. /// </summary> /// <param name="stream">a FastTransferStream</param> public ProgressPerMessage(FastTransferStream stream) : base(stream) { }
/// <summary> /// Verify that a stream's current position contains a serialized messageChange. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>If the stream's current position contains /// a serialized messageChange, return true, else false</returns> public static bool Verify(FastTransferStream stream) { return(MessageChangeFull.Verify(stream) || MessageChangePartial.Verify(stream)); }
/// <summary> /// Initializes a new instance of the MessageChange class. /// </summary> /// <param name="stream">A FastTransferStream.</param> protected MessageChange(FastTransferStream stream) : base(stream) { }
/// <summary> /// Initializes a new instance of the MessageChangeHeader class. /// </summary> /// <param name="stream">A FastTransferStream.</param> public MessageChangeHeader(FastTransferStream stream) : base(stream) { }
/// <summary> /// Initializes a new instance of the MessageChangePartial class. /// </summary> /// <param name="stream">A FastTransferStream object.</param> public MessageChangePartial(FastTransferStream stream) : base(stream) { }
/// <summary> /// Verify that a stream's current position contains a serialized MessageChangePartial. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>If the stream's current position contains /// a serialized MessageChangePartial, return true, else false.</returns> public static new bool Verify(FastTransferStream stream) { return GroupInfo.Verify(stream) || stream.VerifyMetaProperty(MetaProperties.MetaTagIncrSyncGroupId) || stream.VerifyMarker(Markers.PidTagIncrSyncChgPartial); }
/// <summary> /// Initializes a new instance of the State class. /// </summary> /// <param name="stream">A FastTransferStream.</param> public State(FastTransferStream stream) : base(stream) { }
/// <summary> /// Downloads the next portion of a FastTransfer stream. /// </summary> /// <param name="serverId">A 32-bit signed integer represent the Identity of server.</param> /// <param name="downloadHandleIndex">A fast transfer stream object handle index. </param> /// <param name="bufferSize">Specifies the maximum amount of data to be output in the TransferBuffer.</param> /// <param name="transferBufferIndex">The index of data get from the fast transfer stream.</param> /// <param name="abstractFastTransferStream">Fast transfer stream.</param> /// <param name="transferDataSmallOrEqualToBufferSize">Variable to not if the transferData is small or equal to bufferSize</param> /// <returns>Indicate the result of this ROP operation.</returns> public RopResult FastTransferSourceGetBuffer(int serverId, int downloadHandleIndex, BufferSize bufferSize, out int transferBufferIndex, out AbstractFastTransferStream abstractFastTransferStream, out bool transferDataSmallOrEqualToBufferSize) { // Initialize ROP data. SyntacticalBase.AllPropList = null; RopResult returnValue = RopResult.InvalidParameter; this.totalTransferBufferList.Clear(); transferBufferIndex = -1; abstractFastTransferStream = new AbstractFastTransferStream(); transferDataSmallOrEqualToBufferSize = false; if (downloadHandleIndex < 0) { return returnValue; } if (bufferSize == BufferSize.Greater && !Common.IsRequirementEnabled(2625, this.Site)) { returnValue = RopResult.BufferTooSmall; return returnValue; } RopFastTransferSourceGetBufferResponse response = new RopFastTransferSourceGetBufferResponse(); uint sourceHandle = this.handleContainer[downloadHandleIndex]; uint downloadContextHandle = sourceHandle; // Construct ROP request. RopFastTransferSourceGetBufferRequest fastTransferSourceGetBufferRequest; fastTransferSourceGetBufferRequest.RopId = 0x4e; fastTransferSourceGetBufferRequest.LogonId = 0x00; fastTransferSourceGetBufferRequest.InputHandleIndex = 0x00; fastTransferSourceGetBufferRequest.BufferSize = (ushort)bufferSize; if (bufferSize != BufferSize.Normal) { fastTransferSourceGetBufferRequest.MaximumBufferSize = null; } else { fastTransferSourceGetBufferRequest.MaximumBufferSize = (ushort)bufferSize; } bool isRunIntoPartial = false; bool isRunIntoNoRoom = false; do { IDeserializable tempRopResponse = null; if ((tempRopResponse = this.Process(serverId, fastTransferSourceGetBufferRequest, downloadContextHandle)) != null) { // Send request and get response. response = (RopFastTransferSourceGetBufferResponse)tempRopResponse; byte[] transferBuffer = new byte[(int)response.TransferBufferSize]; if (response.ReturnValue == 0) { if (bufferSize != BufferSize.Normal) { transferDataSmallOrEqualToBufferSize = transferBuffer.Length <= (int)bufferSize; } for (int i = 0; i < (int)response.TransferBufferSize; i++) { transferBuffer[i] = response.TransferBuffer[i]; } this.totalTransferBufferList.Add(transferBuffer); if (response.TransferStatus == (ushort)TransferStatus.Partial) { isRunIntoPartial = true; } if (response.TransferStatus == (ushort)TransferStatus.NoRoom) { isRunIntoNoRoom = true; } } } else { break; } } while (response.TransferStatus != (ushort)TransferStatus.Done && (RopResult)response.ReturnValue == RopResult.Success); if (response.TransferBuffer == null) { returnValue = (RopResult)this.ropResult; } else { returnValue = (RopResult)response.ReturnValue; } bool isReachedBufferTooSmall = (bufferSize == BufferSize.Greater) && (returnValue == RopResult.BufferTooSmall); this.VerifyTransferStatus(isRunIntoPartial, isRunIntoNoRoom, isReachedBufferTooSmall); if (isReachedBufferTooSmall) { this.previousGetBufferResult = RopResult.BufferTooSmall; } if (response.TransferStatus == (ushort)TransferStatus.Done) { returnValue = RopResult.Success; int bufferlength = 0; foreach (byte[] blengt in this.totalTransferBufferList) { bufferlength += blengt.Length; } byte[] totalTransferBuffer = new byte[bufferlength]; int index = 0; foreach (byte[] buffer in this.totalTransferBufferList) { Array.Copy(buffer, 0, totalTransferBuffer, index, buffer.Length); index += buffer.Length; } byte[] requiredTransferBuffer = this.ProcessFXSourceGetBuffer(totalTransferBuffer); using (FastTransferStream fs = new FastTransferStream(requiredTransferBuffer, true)) { // Verify FastTransfer Stream this.VerifyFastTransferStream(fs, this.streamType); } abstractFastTransferStream = this.GenerateAbstractFastTransferStream(serverId, requiredTransferBuffer); if (bufferSize == BufferSize.Greater) { transferBufferIndex = -1; } else { transferBufferIndex = AdapterHelper.GetStreamBufferIndex(); } int k = this.streamBufferContainer.Count; foreach (byte[] subBuffer in this.totalTransferBufferList) { this.streamBufferContainer.Add(++k, subBuffer); } } if (response.RopId != 0x00) { // Verify ROP FastTransferSourceGetBuffer this.VerifyRopFastTransferSourceGetBuffer(response); } return returnValue; }
/// <summary> /// Deserialize a NameNamedPropInfo instance from a FastTransferStream /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>A NameNamedPropInfo instance.</returns> public static new LexicalBase DeserializeFrom(FastTransferStream stream) { return new NameNamedPropInfo(stream); }
/// <summary> /// Verify that a stream's current position contains a serialized ProgressPerMessage. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>If the stream's current position contains /// a serialized ProgressPerMessage, return true, else false.</returns> public static bool Verify(FastTransferStream stream) { return stream.VerifyMarker(Markers.PidTagIncrSyncProgressPerMsg); }
/// <summary> /// Deserialize next object from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> public override void ConsumeNext(FastTransferStream stream) { base.ConsumeNext(stream); this.name = stream.ReadString(); }
/// <summary> /// Verify that a stream's current position contains a serialized MessageList. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>If the stream's current position contains /// a serialized MessageList, return true, else false.</returns> public static bool Verify(FastTransferStream stream) { return (!stream.IsEndOfStream && stream.VerifyUInt32() == (uint)MetaProperties.PidTagEcWarning) || Message.Verify(stream); }
/// <summary> /// Generate fast transfer stream data. /// </summary> /// <param name="serverId">server id.</param> /// <param name="buffer">Input buffer data.</param> /// <returns>AbstractFastTransferStream object.</returns> private AbstractFastTransferStream GenerateAbstractFastTransferStream( int serverId, byte[] buffer) { using (FastTransferStream fs = new FastTransferStream(buffer, false)) { AbstractFastTransferStream afts; // Record all property list generated while deserializing. SyntacticalBase.AllPropList = new List<PropList>(); int icsStateIndex = -1; switch (this.streamType) { case FastTransferStreamType.state: State s = new State(fs); this.VerifyMarkers(s); // Insert state to the ICSStateContainer icsStateIndex = this.InsertStateDict(s); afts = new AbstractFastTransferStream(); // Get the AbstractState corresponding to the state from the fast transfer stream. AbstractState astate = this.GetAbstractState(serverId, icsStateIndex, s); // Set the AbstractState of the AbstractFastTransferStream. afts.AbstractState = new AbstractState { AbstractICSStateIndex = icsStateIndex, IdSetGiven = astate.IdSetGiven }; //// Other fields of the AbstractState of the AbstractFastTransferStream do not need. afts.StreamType = FastTransferStreamType.state; return afts; case FastTransferStreamType.attachmentContent: AttachmentContent att = new AttachmentContent(fs); this.VerifyMarkers(att); return att.GetAbstractFastTransferStream(); case FastTransferStreamType.contentsSync: ContentsSync cs = new ContentsSync(fs); this.VerifyMarkers(cs); // Insert the state of the contentsSync to the ICSStateContainer icsStateIndex = this.InsertStateDict(cs.State); afts = this.GetAbstractContentSync( serverId, icsStateIndex, cs); return afts; case FastTransferStreamType.folderContent: FolderContent fc = new FolderContent(fs); this.VerifyMarkers(fc); this.VerifyFolderReplicaInfoStructure(fc); afts = fc.GetAbstractFastTransferStream(); if (!this.existNoPermissionFolder) { afts.AbstractFolderContent.IsNoPermissionObjNotOut = false; } this.VerifyMetaProperty(afts); return afts; case FastTransferStreamType.hierarchySync: HierarchySync hs = new HierarchySync(fs); this.VerifyMarkers(hs); if (hs.FolderChangeList.Count > 0) { PropValue property = hs.FolderChangeList[hs.FolderChangeList.Count - 1].PropList.PropValues.Find(p => p.PropInfo.PropID == 0x65e3); if (property != null) { this.lastConflictInfo.PCLXFromServer = ((VarPropTypePropValue)property).ValueArray; this.VerifyPidTagPredecessorChangeList(); } } // Insert state to the ICSStateContainer icsStateIndex = this.InsertStateDict(hs.State); afts = this.GetAbstractHierachySync(serverId, hs, icsStateIndex); return afts; case FastTransferStreamType.MessageContent: MessageContent mc = new MessageContent(fs); for (int i = 0; i < mc.PropList.PropValues.Count; i++) { PropValue propValue = mc.PropList.PropValues[i]; if (propValue.PropType == 0x84b0) { CodePage codePage = new CodePage(); codePage.Deserialize(propValue.PropType); this.VerifyCodePageProperty(codePage); } } this.VerifyMarkers(mc); afts = mc.GetAbstractFastTransferStream(); this.VerifyMetaProperty(afts); return afts; case FastTransferStreamType.MessageList: MessageList ml = new MessageList(fs); afts = ml.GetAbstractFastTransferStream(); this.VerifyMetaProperty(afts); this.VerifyMarkers(ml); return afts; case FastTransferStreamType.TopFolder: TopFolder tf = new TopFolder(fs); this.VerifyMarkers(tf); afts = tf.GetAbstractFastTransferStream(); this.VerifyMetaProperty(afts); return afts; default: AdapterHelper.Site.Assert.Fail("The stream type is invalid, its value is:{0}.", this.streamType); return new AbstractFastTransferStream(); } } }
/// <summary> /// Deserialize next object from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> public override void ConsumeNext(FastTransferStream stream) { base.ConsumeNext(stream); this.dispid = stream.ReadInt32(); }
/// <summary> /// Verify that a stream's current position contains a serialized ProgressPerMessage. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>If the stream's current position contains /// a serialized ProgressPerMessage, return true, else false.</returns> public static bool Verify(FastTransferStream stream) { return(stream.VerifyMarker(Markers.PidTagIncrSyncProgressPerMsg)); }
/// <summary> /// Verify that a stream's current position contains a serialized propList. /// </summary> /// <param name="stream">A FastTransferStream.</param> /// <returns>If the stream's current position contains /// a serialized propList, return true, else false.</returns> public static bool Verify(FastTransferStream stream) { return PropValue.Verify(stream); }
/// <summary> /// Initializes a new instance of the PropList class. /// </summary> /// <param name="stream">A FastTransferStream.</param> public PropList(FastTransferStream stream) : base(stream) { }
/// <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(StartMarker) && stream.VerifyMarker( EndMarker, (int)stream.Length - MarkersHelper.PidTagLength - (int)stream.Position); }
/// <summary> /// Deserialize fields from a FastTransferStream. /// </summary> /// <param name="stream">A FastTransferStream.</param> public override void Deserialize(FastTransferStream stream) { this.propValues = new List<PropValue>(); while (PropValue.Verify(stream) && !MarkersHelper.IsEndMarkerExceptEcWarning(stream.VerifyUInt32())) { this.propValues.Add(PropValue.DeserializeFrom(stream) as PropValue); } if (SyntacticalBase.AllPropList != null) { SyntacticalBase.AllPropList.Add(this); } }
/// <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) { this.propList = new PropList(stream); }
/// <summary> /// Initializes a new instance of the MessageList class. /// </summary> /// <param name="stream">The stream.</param> public MessageList(FastTransferStream stream) : base(stream) { }
/// <summary> /// Initializes a new instance of the DispidGroupNamedPropInfo class. /// </summary> /// <param name="stream">A FastTransferStream</param> public DispidGroupNamedPropInfo(FastTransferStream stream) : base(stream) { }
/// <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> /// Verify that a stream's current position contains a serialized DispidGroupNamedPropInfo. /// </summary> /// <param name="stream">A FastTransferStream</param> /// <returns>If the stream's current position contains /// a serialized DispidGroupNamedPropInfo, return true, else false</returns> public static bool Verify(FastTransferStream stream) { return stream.VerifyUInt32(Guid.Empty.ToByteArray().Length) == 0x00000000; }