示例#1
0
 /// <summary>
 /// Construct a priority receive data collection
 /// </summary>
 /// <param name="defragmentor">Defragmentor used to deserialize an object.</param>
 /// <param name="createdByClientTM">
 /// True if a client transport manager created this collection.
 /// This is used to generate custom messages for server and client.
 /// </param>
 internal PriorityReceiveDataCollection(Fragmentor defragmentor, bool createdByClientTM)
 {
     _defragmentor = defragmentor;
     string[] names = Enum.GetNames(typeof(DataPriorityType));
     _recvdData = new ReceiveDataCollection[names.Length];
     for (int index = 0; index < names.Length; index++)
     {
         _recvdData[index] = new ReceiveDataCollection(defragmentor, createdByClientTM);
     }
     _isCreateByClientTM = createdByClientTM;
 }
 internal void ProcessRawData(byte[] data, DataPriorityType priorityType, ReceiveDataCollection.OnDataAvailableCallback callback)
 {
     try
     {
         this.defragmentor.DeserializationContext.LogExtraMemoryUsage(data.Length);
     }
     catch (XmlException)
     {
         PSRemotingTransportException exception = null;
         if (this.isCreateByClientTM)
         {
             exception = new PSRemotingTransportException(PSRemotingErrorId.ReceivedDataSizeExceededMaximumClient, RemotingErrorIdStrings.ReceivedDataSizeExceededMaximumClient, new object[] { this.defragmentor.DeserializationContext.MaximumAllowedMemory.Value });
         }
         else
         {
             exception = new PSRemotingTransportException(PSRemotingErrorId.ReceivedDataSizeExceededMaximumServer, RemotingErrorIdStrings.ReceivedDataSizeExceededMaximumServer, new object[] { this.defragmentor.DeserializationContext.MaximumAllowedMemory.Value });
         }
         throw exception;
     }
     this.recvdData[(int) priorityType].ProcessRawData(data, callback);
 }