public virtual void SaveSettings(ShellSettings settings) { if (settings == null) { throw new ArgumentNullException("settings"); } if (String.IsNullOrEmpty(settings.Name)) { throw new ArgumentException("The Name property of the supplied ShellSettings object is null or empty; the settings cannot be saved.", "settings"); } Logger.Debug("Saving ShellSettings for tenant '{0}'...", settings.Name); var content = ShellSettingsSerializer.ComposeSettings(settings); var filePath = _fileSystem.Combine(settings.Name, Constants.ShellSettingsFileName); var file = _fileSystem.FileExists(filePath) ? _fileSystem.GetFile(filePath) : _fileSystem.CreateFile(filePath); using (var stream = file.OpenWrite()) { using (var writer = new StreamWriter(stream)) { writer.Write(content); } } Logger.Debug("ShellSettings saved successfully; flagging tenant '{0}' for restart.", settings.Name); _events.Saved(settings); }
void IShellSettingsManager.SaveSettings(ShellSettings settings) { var content = ShellSettingsSerializer.ComposeSettings(settings); var filePath = _fileSystem.Combine(settings.Name, SettingsFilename); var file = _fileSystem.FileExists(filePath) ? _fileSystem.GetFile(filePath) : _fileSystem.CreateFile(filePath); using (var stream = file.OpenWrite()) { using (var writer = new StreamWriter(stream)) { writer.Write(content); } } _events.Saved(settings); }