Exemple #1
0
        private int?ComputeHash(XmlNode rootNode, bool shouldChangeTrack)
        {
            int?       result = null;
            List <int> list   = new List <int>(50);

            list.Add(ChangeTrackingNode.GetQualifiedName(rootNode).GetHashCode());
            foreach (object obj in rootNode.ChildNodes)
            {
                XmlNode xmlNode       = (XmlNode)obj;
                string  qualifiedName = ChangeTrackingNode.GetQualifiedName(xmlNode);
                if (shouldChangeTrack && this.changeTrackingNodes.ContainsKey(qualifiedName))
                {
                    int num = this.changeTrackingNodes[qualifiedName];
                    this.seenNodes[num] = xmlNode;
                    if (ChangeTrackingFilter.IsContainer(xmlNode))
                    {
                        AirSyncDiagnostics.TraceInfo <string>(ExTraceGlobals.RequestsTracer, this, "ChangeTrackingFilter.ComputeHash() Recursively computing hash for change tracked container {0}", qualifiedName);
                        this.newChangeTrackingInformation[num] = this.ComputeHash(xmlNode, shouldChangeTrack);
                        AirSyncDiagnostics.TraceInfo <string, int?>(ExTraceGlobals.RequestsTracer, this, "ChangeTrackingFilter.ComputeHash() Returned hash for change tracked container {0} = {1}", qualifiedName, this.newChangeTrackingInformation[num]);
                    }
                    else
                    {
                        int value = ChangeTrackingNode.GetQualifiedName(xmlNode).GetHashCode() ^ this.GetHashCode(xmlNode);
                        this.newChangeTrackingInformation[num] = new int?(value);
                        AirSyncDiagnostics.TraceInfo <string, int?>(ExTraceGlobals.RequestsTracer, this, "ChangeTrackingFilter.ComputeHash() Calculated change tracked node hash {0} {1}", qualifiedName, this.newChangeTrackingInformation[num]);
                    }
                }
                else if (ChangeTrackingFilter.IsContainer(xmlNode))
                {
                    int?arg = this.ComputeHash(xmlNode, false);
                    if (arg != null)
                    {
                        list.Add(arg.Value);
                        AirSyncDiagnostics.TraceInfo <string, string, int?>(ExTraceGlobals.RequestsTracer, this, "ChangeTrackingFilter.ComputeHash() Returned container node hash {0}{1} = {2}", xmlNode.NamespaceURI, xmlNode.Name, arg);
                    }
                }
                else
                {
                    int item = ChangeTrackingNode.GetQualifiedName(xmlNode).GetHashCode() ^ this.GetHashCode(xmlNode);
                    list.Add(item);
                    AirSyncDiagnostics.TraceInfo <string, string, int>(ExTraceGlobals.RequestsTracer, this, "ChangeTrackingFilter.ComputeHash() Calculated node hash {0}{1} = {2}", xmlNode.NamespaceURI, xmlNode.Name, item.GetHashCode());
                }
            }
            if (list.Count > 1)
            {
                list.Sort();
                StringBuilder stringBuilder = new StringBuilder(list.Count * 10);
                foreach (int num2 in list)
                {
                    stringBuilder.Append(num2.ToString(CultureInfo.InvariantCulture));
                }
                result = new int?(stringBuilder.ToString().GetHashCode());
            }
            return(result);
        }
 // Token: 0x0600184E RID: 6222 RVA: 0x0008E9FC File Offset: 0x0008CBFC
 private void UpdateFilter(Dictionary <StoreObjectId, string> mapping, DateTimeCustomSyncFilter dateTimeFilter, Dictionary <string, CommonNode> items)
 {
     foreach (StoreObjectId storeObjectId in mapping.Keys)
     {
         string      key        = mapping[storeObjectId];
         CommonNode  commonNode = items[key];
         ISyncItemId syncItemId = MailboxSyncItemId.CreateForNewItem(storeObjectId);
         if (commonNode.IsCalendar)
         {
             dateTimeFilter.UpdateFilterStateWithAddOrChange(syncItemId, true, true, commonNode.EndTime);
         }
         ChangeTrackingNode[] array;
         if (commonNode.IsEmail)
         {
             array = new ChangeTrackingNode[]
             {
                 ChangeTrackingNode.AllOtherNodes,
                 new ChangeTrackingNode("Email", "Read")
             };
         }
         else
         {
             array = new ChangeTrackingNode[]
             {
                 ChangeTrackingNode.AllNodes
             };
         }
         GenericDictionaryData <DerivedData <ISyncItemId>, ISyncItemId, FolderSync.ClientStateInformation> genericDictionaryData = (GenericDictionaryData <DerivedData <ISyncItemId>, ISyncItemId, FolderSync.ClientStateInformation>) this.syncState[SyncStateProp.ClientState];
         if (!genericDictionaryData.Data.ContainsKey(syncItemId))
         {
             genericDictionaryData.Data[syncItemId] = new FolderSync.ClientStateInformation();
         }
         FolderSync.ClientStateInformation clientStateInformation = genericDictionaryData.Data[syncItemId];
         clientStateInformation.ChangeTrackingInformation = new int?[array.Length];
         clientStateInformation.ClientHasItem             = true;
     }
 }