diff options
Small bit of refactoring related to the hypergrid link loading from xml files.
-rw-r--r-- | OpenSim/Region/Application/HGOpenSimNode.cs | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index dcb8c15..f46c9e3 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs | |||
@@ -147,48 +147,7 @@ namespace OpenSim | |||
147 | { | 147 | { |
148 | if ((cmdparams.Length == 1) || (cmdparams.Length ==2)) | 148 | if ((cmdparams.Length == 1) || (cmdparams.Length ==2)) |
149 | { | 149 | { |
150 | try | 150 | LoadXmlLinkFile(cmdparams); |
151 | { | ||
152 | XmlReader r = XmlReader.Create(cmdparams[0]); | ||
153 | XmlConfigSource cs = new XmlConfigSource(r); | ||
154 | string[] excludeSections = null; | ||
155 | |||
156 | if (cmdparams.Length == 2) | ||
157 | { | ||
158 | if (cmdparams[1].StartsWith("excludeList:")) | ||
159 | { | ||
160 | string excludeString = cmdparams[1]; | ||
161 | excludeString = excludeString.Remove(0, 12); | ||
162 | char[] splitter = { ';' }; | ||
163 | |||
164 | excludeSections = excludeString.Split(splitter); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | for (int i = 0; i < cs.Configs.Count; i++) | ||
169 | { | ||
170 | bool skip = false; | ||
171 | if ((excludeSections != null) &&(excludeSections.Length > 0 )) | ||
172 | { | ||
173 | for (int n = 0; n < excludeSections.Length; n++) | ||
174 | { | ||
175 | if (excludeSections[n] == cs.Configs[i].Name) | ||
176 | { | ||
177 | skip = true; | ||
178 | break; | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | if (!skip) | ||
183 | { | ||
184 | ReadLinkFromConfig(cs.Configs[i]); | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | catch (Exception e) | ||
189 | { | ||
190 | Console.WriteLine(e.ToString()); | ||
191 | } | ||
192 | } | 151 | } |
193 | else | 152 | else |
194 | { | 153 | { |
@@ -234,6 +193,52 @@ namespace OpenSim | |||
234 | 193 | ||
235 | } | 194 | } |
236 | 195 | ||
196 | private void LoadXmlLinkFile(string[] cmdparams) | ||
197 | { | ||
198 | try | ||
199 | { | ||
200 | XmlReader r = XmlReader.Create(cmdparams[0]); | ||
201 | XmlConfigSource cs = new XmlConfigSource(r); | ||
202 | string[] excludeSections = null; | ||
203 | |||
204 | if (cmdparams.Length == 2) | ||
205 | { | ||
206 | if (cmdparams[1].StartsWith("excludeList:")) | ||
207 | { | ||
208 | string excludeString = cmdparams[1]; | ||
209 | excludeString = excludeString.Remove(0, 12); | ||
210 | char[] splitter = { ';' }; | ||
211 | |||
212 | excludeSections = excludeString.Split(splitter); | ||
213 | } | ||
214 | } | ||
215 | |||
216 | for (int i = 0; i < cs.Configs.Count; i++) | ||
217 | { | ||
218 | bool skip = false; | ||
219 | if ((excludeSections != null) && (excludeSections.Length > 0)) | ||
220 | { | ||
221 | for (int n = 0; n < excludeSections.Length; n++) | ||
222 | { | ||
223 | if (excludeSections[n] == cs.Configs[i].Name) | ||
224 | { | ||
225 | skip = true; | ||
226 | break; | ||
227 | } | ||
228 | } | ||
229 | } | ||
230 | if (!skip) | ||
231 | { | ||
232 | ReadLinkFromConfig(cs.Configs[i]); | ||
233 | } | ||
234 | } | ||
235 | } | ||
236 | catch (Exception e) | ||
237 | { | ||
238 | Console.WriteLine(e.ToString()); | ||
239 | } | ||
240 | } | ||
241 | |||
237 | private void ReadLinkFromConfig(IConfig config) | 242 | private void ReadLinkFromConfig(IConfig config) |
238 | { | 243 | { |
239 | RegionInfo regInfo; | 244 | RegionInfo regInfo; |