public void Save() { using (UserConfiguration userConfiguration = UserConfigurationUtilities.GetUserConfiguration(this.configurationAttribute.ConfigurationName, this.userContext)) { using (Stream xmlStream = userConfiguration.GetXmlStream()) { xmlStream.SetLength(0L); using (StreamWriter streamWriter = Utilities.CreateStreamWriter(xmlStream)) { using (XmlTextWriter xmlTextWriter = new XmlTextWriter(streamWriter)) { xmlTextWriter.WriteStartElement(this.configurationAttribute.ConfigurationRootNodeName); foreach (T t in this.entries) { xmlTextWriter.WriteStartElement("entry"); foreach (SimpleConfigurationPropertyAttribute simpleConfigurationPropertyAttribute in this.configurationAttribute.GetPropertyCollection()) { xmlTextWriter.WriteAttributeString(simpleConfigurationPropertyAttribute.Name, simpleConfigurationPropertyAttribute.GetValue(t).ToString()); } xmlTextWriter.WriteFullEndElement(); } xmlTextWriter.WriteFullEndElement(); } } } UserConfigurationUtilities.TrySaveConfiguration(userConfiguration); } }
public RecipientCacheTransaction(string configurationName, UserContext userContext) { using (DisposeGuard disposeGuard = this.Guard()) { if (userContext.CanActAsOwner) { this.configuration = UserConfigurationUtilities.GetUserConfiguration(configurationName, userContext); } disposeGuard.Success(); } }
public void Load() { this.entries.Clear(); using (UserConfiguration userConfiguration = UserConfigurationUtilities.GetUserConfiguration(this.configurationAttribute.ConfigurationName, this.userContext)) { using (Stream xmlStream = userConfiguration.GetXmlStream()) { if (xmlStream != null && xmlStream.Length > 0L) { this.reader = SafeXmlFactory.CreateSafeXmlTextReader(xmlStream); this.Parse(this.reader); } } } }
// Token: 0x060014F9 RID: 5369 RVA: 0x0007F560 File Offset: 0x0007D760 public static UserConfiguration GetUserConfiguration(string configurationName, UserContext userContext) { if (string.IsNullOrEmpty(configurationName)) { throw new ArgumentException("configurationName must not be null or empty"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } UserConfiguration userConfiguration = null; try { userConfiguration = userContext.MailboxSession.UserConfigurationManager.GetMailboxConfiguration(configurationName, UserConfigurationTypes.XML); } catch (ObjectNotFoundException) { userConfiguration = userContext.MailboxSession.UserConfigurationManager.CreateMailboxConfiguration(configurationName, UserConfigurationTypes.XML); try { UserConfigurationUtilities.TrySaveConfiguration(userConfiguration, false); } catch (ObjectExistedException) { try { userConfiguration = userContext.MailboxSession.UserConfigurationManager.GetMailboxConfiguration(configurationName, UserConfigurationTypes.XML); } catch (ObjectNotFoundException thisObject) { throw new OwaSaveConflictException("A save conflict happened during the creation and save of the userconfiguration.", thisObject); } } catch (StoragePermanentException) { } } return(userConfiguration); }
// Token: 0x060014FA RID: 5370 RVA: 0x0007F624 File Offset: 0x0007D824 public static void TrySaveConfiguration(UserConfiguration configuration) { UserConfigurationUtilities.TrySaveConfiguration(configuration, true); }
// Token: 0x060014FC RID: 5372 RVA: 0x0007F6AC File Offset: 0x0007D8AC public static UserConfiguration GetFolderConfiguration(string configurationName, UserContext userContext, StoreId folderId) { if (string.IsNullOrEmpty(configurationName)) { throw new ArgumentException("configurationName must not be null or empty"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } if (folderId == null) { throw new ArgumentNullException("folderId"); } bool flag = false; Exception ex = null; UserConfiguration userConfiguration = null; try { userConfiguration = userContext.MailboxSession.UserConfigurationManager.GetFolderConfiguration(configurationName, UserConfigurationTypes.Dictionary, folderId); userConfiguration.GetDictionary(); } catch (ObjectNotFoundException) { flag = true; } catch (InvalidOperationException ex2) { ex = ex2; userContext.MailboxSession.UserConfigurationManager.DeleteFolderConfigurations(folderId, new string[] { configurationName }); flag = true; } catch (CorruptDataException ex3) { ex = ex3; userContext.MailboxSession.UserConfigurationManager.DeleteFolderConfigurations(folderId, new string[] { configurationName }); flag = true; } catch (Exception ex4) { ex = ex4; if (userConfiguration != null) { userConfiguration.Dispose(); } userConfiguration = null; } if (ex != null) { ExTraceGlobals.CoreTracer.TraceDebug <string, string, string>(0L, "UserConfiguration.GetFolderConfiguration failed for configuration object {0}. Error: {1}. Stack: {2}", configurationName, ex.Message, ex.StackTrace); } if (flag) { if (userConfiguration != null) { userConfiguration.Dispose(); } userConfiguration = UserConfigurationUtilities.CreateAndSaveFolderConfiguration(configurationName, userContext, folderId); } if (userConfiguration == null) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "UserConfiguration.GetFolderConfiguration failed for configuration object {0}. Returning null", configurationName); } return(userConfiguration); }