public Dictionary <string, StoreObjectId> Upgrade(FolderHierarchySync folderHierarchySyncIn, SyncState syncState, Dictionary <string, FolderNode> nodesOldInfo, out Dictionary <string, StoreObjectType> contentTypeTable)
        {
            contentTypeTable         = new Dictionary <string, StoreObjectType>();
            this.syncState           = syncState;
            this.folderHierarchySync = folderHierarchySyncIn;
            Dictionary <string, StoreObjectId> result = this.ProcessCommand(nodesOldInfo, contentTypeTable);

            this.folderHierarchySync.AcknowledgeServerOperations();
            return(result);
        }
Example #2
0
 internal HierarchySyncOperations(FolderHierarchySync folderHierarchySync, IDictionary changes, bool moreAvailable)
 {
     this.moreAvailable = moreAvailable;
     this.changes       = new List <HierarchySyncOperation>(changes.Keys.Count);
     foreach (object obj in changes.Values)
     {
         FolderManifestEntry    manifestEntry          = (FolderManifestEntry)obj;
         HierarchySyncOperation hierarchySyncOperation = new HierarchySyncOperation();
         hierarchySyncOperation.Bind(folderHierarchySync, manifestEntry);
         this.changes.Add(hierarchySyncOperation);
     }
 }
Example #3
0
        private void AddServerManifestEntry(IStorePropertyBag propertyBag, bool excludeHiddenFolders, Dictionary <StoreObjectId, FolderStateEntry> serverFolders, ISyncLogger syncLogger)
        {
            SharingSubscriptionData[] array = null;
            bool flag = false;

            if (FolderHierarchySync.TryGetPropertyFromBag <bool>(propertyBag, InternalSchema.IsHidden, syncLogger, out flag) && excludeHiddenFolders && flag)
            {
                return;
            }
            VersionedId   versionedId;
            StoreObjectId parentId;

            byte[] array2;
            if (!FolderHierarchySync.TryGetPropertyFromBag <VersionedId>(propertyBag, FolderSchema.Id, syncLogger, out versionedId) || !FolderHierarchySync.TryGetPropertyFromBag <StoreObjectId>(propertyBag, StoreObjectSchema.ParentItemId, syncLogger, out parentId) || !FolderHierarchySync.TryGetPropertyFromBag <byte[]>(propertyBag, StoreObjectSchema.ChangeKey, syncLogger, out array2))
            {
                ExTraceGlobals.SyncTracer.Information((long)this.GetHashCode(), "Storage.FolderHierarchySync.AddServerManifestEntry. \nFolder is missing properties. Id , ParentId or ChangeKey");
                return;
            }
            int num = -1;

            serverFolders[versionedId.ObjectId] = null;
            FolderStateEntry folderStateEntry;

            if (this.ClientState.TryGetValue(versionedId.ObjectId, out folderStateEntry) && ArrayComparer <byte> .Comparer.Equals(folderStateEntry.ChangeKey, array2))
            {
                return;
            }
            if (this.changeTrackingDelegate != null)
            {
                num = this.changeTrackingDelegate(this.storeSession, versionedId.ObjectId, propertyBag);
                if (folderStateEntry != null && num == folderStateEntry.ChangeTrackingHash)
                {
                    folderStateEntry.ChangeKey = array2;
                    return;
                }
            }
            FolderManifestEntry folderManifestEntry = new FolderManifestEntry(versionedId.ObjectId);
            string className;

            FolderHierarchySync.TryGetPropertyFromBag <string>(propertyBag, StoreObjectSchema.ContainerClass, syncLogger, out className);
            folderManifestEntry.ChangeType         = ((folderStateEntry != null) ? ChangeType.Change : ChangeType.Add);
            folderManifestEntry.ChangeKey          = array2;
            folderManifestEntry.ParentId           = parentId;
            folderManifestEntry.ChangeTrackingHash = num;
            folderManifestEntry.Hidden             = flag;
            folderManifestEntry.ClassName          = className;
            if (folderManifestEntry.ClassName == null)
            {
                folderManifestEntry.ClassName = string.Empty;
            }
            folderManifestEntry.DisplayName = (propertyBag[FolderSchema.DisplayName] as string);
            if (folderManifestEntry.DisplayName == null)
            {
                folderManifestEntry.DisplayName = string.Empty;
            }
            int num2;

            if (!FolderHierarchySync.TryGetPropertyFromBag <int>(propertyBag, FolderSchema.ExtendedFolderFlags, syncLogger, out num2))
            {
                num2 = 0;
            }
            bool flag2 = (num2 & 1073741824) != 0;

            if (flag2)
            {
                if (array == null)
                {
                    using (SharingSubscriptionManager sharingSubscriptionManager = new SharingSubscriptionManager(this.storeSession))
                    {
                        array = sharingSubscriptionManager.GetAll();
                    }
                }
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i].LocalFolderId.Equals(folderManifestEntry.ItemId))
                    {
                        folderManifestEntry.Permissions = SyncPermissions.Readonly;
                        folderManifestEntry.Owner       = array[i].SharerIdentity;
                        break;
                    }
                }
            }
            this.ServerManifest.Add(folderManifestEntry.ItemId, folderManifestEntry);
        }
 internal void Bind(FolderHierarchySync folderHierarchySync, FolderManifestEntry manifestEntry)
 {
     this.manifestEntry       = manifestEntry;
     this.folderHierarchySync = folderHierarchySync;
 }