예제 #1
0
 private void Load(UserConfiguration configuration)
 {
     try
     {
         using (RecipientInfoCache recipientInfoCache = RecipientInfoCache.Create(configuration))
         {
             try
             {
                 this.cacheEntries = recipientInfoCache.Load("AutoCompleteCache");
                 this.syncTime     = recipientInfoCache.LastModifiedTime;
             }
             finally
             {
                 recipientInfoCache.DetachUserConfiguration();
             }
         }
     }
     catch (XmlException ex)
     {
         ExTraceGlobals.CoreTracer.TraceError <string>(0L, "Parser threw an XML exception: {0}'", ex.Message);
         this.ClearCache();
         this.Commit(configuration, true);
     }
     catch (CorruptDataException ex2)
     {
         ExTraceGlobals.CoreTracer.TraceError <string>(0L, "Parser threw a CorruptDataException exception: {0}'", ex2.Message);
         this.ClearCache();
         this.Commit(configuration, true);
     }
 }
예제 #2
0
 protected virtual void Commit(UserConfiguration configuration, bool forceSave)
 {
     if (this.userContext.CanActAsOwner)
     {
         if (this.cacheEntries.Count == 0 && !this.isDirty && !forceSave)
         {
             return;
         }
         using (RecipientInfoCache recipientInfoCache = RecipientInfoCache.Create(configuration))
         {
             try
             {
                 recipientInfoCache.Save(this.cacheEntries, "AutoCompleteCache", (int)this.cacheSize);
             }
             finally
             {
                 recipientInfoCache.DetachUserConfiguration();
             }
         }
     }
     this.isDirty = false;
 }