Beispiel #1
0
 private NMMemoryStateStoreService.TrackerState GetTrackerState(NMMemoryStateStoreService.TrackerKey
                                                                key)
 {
     NMMemoryStateStoreService.TrackerState ts = trackerStates[key];
     if (ts == null)
     {
         ts = new NMMemoryStateStoreService.TrackerState();
         trackerStates[key] = ts;
     }
     return(ts);
 }
Beispiel #2
0
 public override bool Equals(object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (obj == null)
     {
         return(false);
     }
     if (!(obj is NMMemoryStateStoreService.TrackerKey))
     {
         return(false);
     }
     NMMemoryStateStoreService.TrackerKey other = (NMMemoryStateStoreService.TrackerKey
                                                   )obj;
     if (appId == null)
     {
         if (other.appId != null)
         {
             return(false);
         }
     }
     else
     {
         if (!appId.Equals(other.appId))
         {
             return(false);
         }
     }
     if (user == null)
     {
         if (other.user != null)
         {
             return(false);
         }
     }
     else
     {
         if (!user.Equals(other.user))
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #3
0
 public override NMStateStoreService.RecoveredLocalizationState LoadLocalizationState
     ()
 {
     lock (this)
     {
         NMStateStoreService.RecoveredLocalizationState result = new NMStateStoreService.RecoveredLocalizationState
                                                                     ();
         foreach (KeyValuePair <NMMemoryStateStoreService.TrackerKey, NMMemoryStateStoreService.TrackerState
                                > e in trackerStates)
         {
             NMMemoryStateStoreService.TrackerKey   tk = e.Key;
             NMMemoryStateStoreService.TrackerState ts = e.Value;
             // check what kind of tracker state we have and recover appropriately
             // public trackers have user == null
             // private trackers have a valid user but appId == null
             // app-specific trackers have a valid user and valid appId
             if (tk.user == null)
             {
                 result.publicTrackerState = LoadTrackerState(ts);
             }
             else
             {
                 NMStateStoreService.RecoveredUserResources rur = result.userResources[tk.user];
                 if (rur == null)
                 {
                     rur = new NMStateStoreService.RecoveredUserResources();
                     result.userResources[tk.user] = rur;
                 }
                 if (tk.appId == null)
                 {
                     rur.privateTrackerState = LoadTrackerState(ts);
                 }
                 else
                 {
                     rur.appTrackerStates[tk.appId] = LoadTrackerState(ts);
                 }
             }
         }
         return(result);
     }
 }