protected virtual ExitCode ListSettings(IClientSettings clientSettings) { Table table = Table.Create(ColumnFormat.FromCount(2)); table.HasHeader = true; table.AddRow(XTaskStrings.ConfigurationTypeColumn, XTaskStrings.ConfigurationLocationColumn); foreach (SettingsLocation location in new SettingsLocation[] { SettingsLocation.Local, SettingsLocation.Roaming, SettingsLocation.RunningExecutable }) { table.AddRow(location.ToString(), clientSettings.GetConfigurationPath(location) ?? XTaskStrings.NoValue); } this.Loggers[LoggerType.Result].Write(table); this.Loggers[LoggerType.Result].WriteLine(); List <ClientSetting> settings = ( from setting in clientSettings.GetAllSettings() orderby setting.Name orderby setting.Location select setting ).ToList(); this.Loggers[LoggerType.Result].WriteLine(XTaskStrings.DefaultsCount, settings.Count); table = Table.Create(ColumnFormat.FromCount(3)); table.HasHeader = true; table.AddRow(XTaskStrings.DefaultsSettingColumnHeader, XTaskStrings.DefaultsLocationColumnHeader, XTaskStrings.DefaultsValueColumnHeader); foreach (ClientSetting setting in settings) { table.AddRow(setting.Name, setting.Location.ToString(), setting.Value.ToString()); } this.Loggers[LoggerType.Result].Write(table); return(ExitCode.Success); }
protected virtual ExitCode ListSettings(IClientSettings clientSettings) { Table table = Table.Create(ColumnFormat.FromCount(2)); table.HasHeader = true; table.AddRow(XTaskStrings.ConfigurationTypeColumn, XTaskStrings.ConfigurationLocationColumn); foreach (SettingsLocation location in new SettingsLocation[] { SettingsLocation.Local, SettingsLocation.Roaming, SettingsLocation.RunningExecutable }) { table.AddRow(location.ToString(), clientSettings.GetConfigurationPath(location) ?? XTaskStrings.NoValue); } this.Loggers[LoggerType.Result].Write(table); this.Loggers[LoggerType.Result].WriteLine(); List<ClientSetting> settings = ( from setting in clientSettings.GetAllSettings() orderby setting.Name orderby setting.Location select setting ).ToList(); this.Loggers[LoggerType.Result].WriteLine(XTaskStrings.DefaultsCount, settings.Count); table = Table.Create(ColumnFormat.FromCount(3)); table.HasHeader = true; table.AddRow(XTaskStrings.DefaultsSettingColumnHeader, XTaskStrings.DefaultsLocationColumnHeader, XTaskStrings.DefaultsValueColumnHeader); foreach (ClientSetting setting in settings) { table.AddRow(setting.Name, setting.Location.ToString(), setting.Value.ToString()); } this.Loggers[LoggerType.Result].Write(table); return ExitCode.Success; }
public string GetConfigurationPath(SettingsLocation location) { return(_clientSettings.GetConfigurationPath(location)); }