Exemplo n.º 1
0
 public void ParseRequest(XmlNode node)
 {
     foreach (object obj in node.ChildNodes)
     {
         XmlNode xmlNode = (XmlNode)obj;
         string  name;
         if ((name = xmlNode.Name) != null)
         {
             if (name == "ConversationId")
             {
                 this.conversationIdNode = xmlNode;
                 AirSyncByteArrayProperty airSyncByteArrayProperty = new AirSyncByteArrayProperty("ItemOperations:", "ConversationId", false);
                 airSyncByteArrayProperty.Bind(xmlNode);
                 if (airSyncByteArrayProperty.ByteArrayData != null)
                 {
                     try
                     {
                         this.conversationId = ConversationId.Create(airSyncByteArrayProperty.ByteArrayData);
                         continue;
                     }
                     catch (CorruptDataException innerException)
                     {
                         throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, innerException, false)
                               {
                                   ErrorStringForProtocolLogger = "BadConversationIdOnMove"
                               };
                     }
                 }
                 throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false)
                       {
                           ErrorStringForProtocolLogger = "InvalidConversationId(" + xmlNode.Name + ")OnMove"
                       };
             }
             if (name == "DstFldId")
             {
                 this.dstSyncFolderId = xmlNode.InnerText;
                 continue;
             }
             if (name == "Options")
             {
                 this.ParseOptions(xmlNode);
                 continue;
             }
         }
         throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false)
               {
                   ErrorStringForProtocolLogger = "InvalidNode(" + xmlNode.Name + ")OnConversationMove"
               };
     }
     if (string.IsNullOrEmpty(this.dstSyncFolderId) || this.conversationId == null)
     {
         throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false)
               {
                   ErrorStringForProtocolLogger = "NoDstFldOrIdOnConversationMove"
               };
     }
 }
        private QueryFilter ParseConversationId(XmlNode node)
        {
            if (this.Conversation != null)
            {
                throw new SearchFilterTooComplexException
                      {
                          ErrorStringForProtocolLogger = "SearchTooComplexError4"
                      };
            }
            AirSyncByteArrayProperty airSyncByteArrayProperty = new AirSyncByteArrayProperty("Search:", "ConversationId", false);

            airSyncByteArrayProperty.Bind(node);
            byte[] byteArrayData = airSyncByteArrayProperty.ByteArrayData;
            if (byteArrayData == null)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false)
                      {
                          ErrorStringForProtocolLogger = "BadConversationIdInSearch"
                      };
            }
            ConversationId conversationId;

            try
            {
                conversationId = ConversationId.Create(byteArrayData);
            }
            catch (CorruptDataException innerException)
            {
                throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, innerException, false)
                      {
                          ErrorStringForProtocolLogger = "BadConversationIdInSearch2"
                      };
            }
            Conversation conversation;

            Command.CurrentCommand.GetOrCreateConversation(conversationId, false, out conversation);
            this.Conversation = conversation;
            return(new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ConversationTopic, this.Conversation.Topic));
        }