Example #1
0
        // Token: 0x0600038D RID: 909 RVA: 0x000154F8 File Offset: 0x000136F8
        public static AutdStatusData Load(SyncStateStorage syncStateStorage, bool readOnly, bool createIfMissing)
        {
            AutdStatusData autdStatusData = null;
            bool           flag           = false;

            try
            {
                autdStatusData = new AutdStatusData();
                AutdSyncStateInfo autdSyncStateInfo = new AutdSyncStateInfo();
                autdSyncStateInfo.ReadOnly         = readOnly;
                autdStatusData.autdStatusSyncState = syncStateStorage.GetCustomSyncState(autdSyncStateInfo, new PropertyDefinition[0]);
                if (autdStatusData.autdStatusSyncState == null)
                {
                    if (!createIfMissing)
                    {
                        return(null);
                    }
                    autdStatusData.autdStatusSyncState = syncStateStorage.CreateCustomSyncState(autdSyncStateInfo);
                }
                autdStatusData.dirty = false;
                flag = true;
            }
            finally
            {
                if (!flag && autdStatusData != null)
                {
                    autdStatusData.Dispose();
                    autdStatusData = null;
                }
            }
            return(autdStatusData);
        }
        // Token: 0x06000D1B RID: 3355 RVA: 0x000478C8 File Offset: 0x00045AC8
        public static IAutdStatusData Load(GlobalInfo globalInfo, SyncStateStorage syncStateStorage)
        {
            NewAutdStatusData newAutdStatusData = new NewAutdStatusData();

            newAutdStatusData.globalInfo     = globalInfo;
            newAutdStatusData.deviceMetadata = syncStateStorage.DeviceMetadata;
            if (!globalInfo.HasNewAutdData)
            {
                using (AutdStatusData autdStatusData = AutdStatusData.Load(syncStateStorage, false, false))
                {
                    if (autdStatusData != null)
                    {
                        newAutdStatusData.lastPingHeartbeat = autdStatusData.LastPingHeartbeat;
                        newAutdStatusData.DPFolderList      = ((autdStatusData.DPFolderList == null) ? null : new Dictionary <string, PingCommand.DPFolderInfo>(autdStatusData.DPFolderList));
                    }
                }
                newAutdStatusData.deviceMetadataStateChanged = true;
                newAutdStatusData.globalStateModified        = true;
            }
            else
            {
                newAutdStatusData.lastPingHeartbeat = globalInfo.LastPingHeartbeat;
                if (newAutdStatusData.deviceMetadata.PingFolderList != null)
                {
                    newAutdStatusData.DPFolderList = ((newAutdStatusData.deviceMetadata.PingFolderList == null) ? null : new Dictionary <string, PingCommand.DPFolderInfo>((Dictionary <string, PingCommand.DPFolderInfo>)newAutdStatusData.deviceMetadata.PingFolderList));
                }
                newAutdStatusData.deviceMetadataStateChanged = false;
                newAutdStatusData.globalStateModified        = false;
            }
            return(newAutdStatusData);
        }
 // Token: 0x060009C1 RID: 2497 RVA: 0x00039668 File Offset: 0x00037868
 private void LoadSyncState()
 {
     this.folderIdMappingSyncState = base.SyncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0]);
     if (this.folderIdMappingSyncState == null || this.folderIdMappingSyncState[CustomStateDatumType.IdMapping] == null)
     {
         CustomSyncState customSyncState = base.SyncStateStorage.GetCustomSyncState(new GlobalSyncStateInfo(), new PropertyDefinition[0]);
         if (customSyncState == null)
         {
             base.SyncStateStorage.DeleteAllSyncStates();
         }
         else
         {
             customSyncState.Dispose();
             using (AutdStatusData autdStatusData = AutdStatusData.Load(base.SyncStateStorage, true, false))
             {
                 if (autdStatusData != null)
                 {
                     base.SyncStateStorage.DeleteAllSyncStates();
                 }
             }
         }
         this.folderIdMappingSyncState = base.SyncStateStorage.CreateCustomSyncState(new FolderIdMappingSyncStateInfo());
         this.folderIdMappingSyncState[CustomStateDatumType.IdMapping]              = new FolderIdMapping();
         this.folderIdMappingSyncState[CustomStateDatumType.FullFolderTree]         = new FolderTree();
         this.folderIdMappingSyncState[CustomStateDatumType.RecoveryFullFolderTree] = this.folderIdMappingSyncState[CustomStateDatumType.FullFolderTree];
     }
 }