diff options
Diffstat (limited to 'OpenSim/Framework/ConfigurationMember.cs')
-rw-r--r-- | OpenSim/Framework/ConfigurationMember.cs | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs index 19275b3..e4cd9d8 100644 --- a/OpenSim/Framework/ConfigurationMember.cs +++ b/OpenSim/Framework/ConfigurationMember.cs | |||
@@ -92,6 +92,21 @@ namespace OpenSim.Framework | |||
92 | { | 92 | { |
93 | configurationPluginFilename = dll_filename; | 93 | configurationPluginFilename = dll_filename; |
94 | } | 94 | } |
95 | private void checkAndAddConfigOption(ConfigurationOption option) | ||
96 | { | ||
97 | if ((option.configurationKey != "" && option.configurationQuestion != "") || (option.configurationKey != "" && option.configurationUseDefaultNoPrompt)) | ||
98 | { | ||
99 | if (!configurationOptions.Contains(option)) | ||
100 | { | ||
101 | configurationOptions.Add(option); | ||
102 | } | ||
103 | } | ||
104 | else | ||
105 | { | ||
106 | MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + option.configurationKey + ")"); | ||
107 | } | ||
108 | } | ||
109 | |||
95 | public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) | 110 | public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) |
96 | { | 111 | { |
97 | ConfigurationOption configOption = new ConfigurationOption(); | 112 | ConfigurationOption configOption = new ConfigurationOption(); |
@@ -100,18 +115,20 @@ namespace OpenSim.Framework | |||
100 | configOption.configurationDefault = configuration_default; | 115 | configOption.configurationDefault = configuration_default; |
101 | configOption.configurationType = configuration_type; | 116 | configOption.configurationType = configuration_type; |
102 | configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; | 117 | configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; |
118 | configOption.shouldIBeAsked = null; //Assumes true, I can ask whenever | ||
119 | checkAndAddConfigOption(configOption); | ||
120 | } | ||
103 | 121 | ||
104 | if ((configuration_key != "" && configuration_question != "") || (configuration_key != "" && use_default_no_prompt)) | 122 | public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt, ConfigurationOption.ConfigurationOptionShouldBeAsked shouldIBeAskedDelegate) |
105 | { | 123 | { |
106 | if (!configurationOptions.Contains(configOption)) | 124 | ConfigurationOption configOption = new ConfigurationOption(); |
107 | { | 125 | configOption.configurationKey = configuration_key; |
108 | configurationOptions.Add(configOption); | 126 | configOption.configurationQuestion = configuration_question; |
109 | } | 127 | configOption.configurationDefault = configuration_default; |
110 | } | 128 | configOption.configurationType = configuration_type; |
111 | else | 129 | configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; |
112 | { | 130 | configOption.shouldIBeAsked = shouldIBeAskedDelegate; |
113 | MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")"); | 131 | checkAndAddConfigOption(configOption); |
114 | } | ||
115 | } | 132 | } |
116 | 133 | ||
117 | public void performConfigurationRetrieve() | 134 | public void performConfigurationRetrieve() |
@@ -195,15 +212,23 @@ namespace OpenSim.Framework | |||
195 | } | 212 | } |
196 | else | 213 | else |
197 | { | 214 | { |
198 | 215 | if ((configOption.shouldIBeAsked != null && configOption.shouldIBeAsked(configOption.configurationKey)) || configOption.shouldIBeAsked == null) | |
199 | if (configurationDescription.Trim() != "") | ||
200 | { | 216 | { |
201 | console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); | 217 | if (configurationDescription.Trim() != "") |
218 | { | ||
219 | console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); | ||
224 | } | ||
202 | } | 225 | } |
203 | else | 226 | else |
204 | { | 227 | { |
205 | console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); | 228 | //Dont Ask! Just use default |
229 | console_result = configOption.configurationDefault; | ||
206 | } | 230 | } |
231 | |||
207 | } | 232 | } |
208 | } | 233 | } |
209 | else | 234 | else |