Пример #1
0
        private IEnumerable <ShellSettings> LoadSettingsInternal()
        {
            var filePaths = _appDataFolder
                            .ListDirectories("Sites")
                            .SelectMany(path => _appDataFolder.ListFiles(path))
                            .Where(path => String.Equals(Path.GetFileName(path), SettingsFileName, StringComparison.OrdinalIgnoreCase));

            foreach (var filePath in filePaths)
            {
                yield return(ShellSettingsSerializer.ParseSettings(_appDataFolder.ReadFile(filePath)));
            }
        }
Пример #2
0
        void IShellSettingsManager.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.Information("Saving ShellSettings for tenant '{0}'...", settings.Name);
            var filePath = Path.Combine(Path.Combine("Sites", settings.Name), SettingsFileName);

            _appDataFolder.CreateFile(filePath, ShellSettingsSerializer.ComposeSettings(settings));

            Logger.Information("ShellSettings saved successfully; flagging tenant '{0}' for restart.", settings.Name);
            _events.Saved(settings);
        }