diff options
author | Justin Clarke Casey | 2008-05-30 18:32:18 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-30 18:32:18 +0000 |
commit | bc56efd1d238de8f990563aec3a77036b1f28fcf (patch) | |
tree | fb3e17f8c40bec5e3d38f397469a78fcecdb4079 /OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs | |
parent | * Refactor: Change multiple requests for a module interface to use a stored r... (diff) | |
download | opensim-SC_OLD-bc56efd1d238de8f990563aec3a77036b1f28fcf.zip opensim-SC_OLD-bc56efd1d238de8f990563aec3a77036b1f28fcf.tar.gz opensim-SC_OLD-bc56efd1d238de8f990563aec3a77036b1f28fcf.tar.bz2 opensim-SC_OLD-bc56efd1d238de8f990563aec3a77036b1f28fcf.tar.xz |
* Hook up archive loading to load in prim xml data
* This now has equivalent functionality to load-xml2 - no asset data is restored yet
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index 7f51b58..2ac0754 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs | |||
@@ -147,26 +147,43 @@ namespace OpenSim.Region.Environment.Scenes | |||
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | /// <summary> | ||
151 | /// Load prims from the xml2 format | ||
152 | /// </summary> | ||
153 | /// <param name="scene"></param> | ||
154 | /// <param name="fileName"></param> | ||
150 | public static void LoadPrimsFromXml2(Scene scene, string fileName) | 155 | public static void LoadPrimsFromXml2(Scene scene, string fileName) |
151 | { | 156 | { |
152 | XmlDocument doc = new XmlDocument(); | 157 | LoadPrimsFromXml2(scene, new XmlTextReader(fileName)); |
153 | XmlNode rootNode; | 158 | } |
154 | if (fileName.StartsWith("http:") || File.Exists(fileName)) | 159 | |
155 | { | 160 | /// <summary> |
156 | XmlTextReader reader = new XmlTextReader(fileName); | 161 | /// Load prims from the xml2 format |
157 | reader.WhitespaceHandling = WhitespaceHandling.None; | 162 | /// </summary> |
158 | doc.Load(reader); | 163 | /// <param name="scene"></param> |
159 | reader.Close(); | 164 | /// <param name="reader"></param> |
160 | rootNode = doc.FirstChild; | 165 | public static void LoadPrimsFromXml2(Scene scene, TextReader reader) |
161 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | 166 | { |
162 | { | 167 | LoadPrimsFromXml2(scene, new XmlTextReader(reader)); |
163 | CreatePrimFromXml(scene, aPrimNode.OuterXml); | 168 | } |
164 | } | 169 | |
165 | } | 170 | /// <summary> |
166 | else | 171 | /// Load prims from the xml2 format. This method will close the reader |
172 | /// </summary> | ||
173 | /// <param name="scene"></param> | ||
174 | /// <param name="reader"></param> | ||
175 | protected static void LoadPrimsFromXml2(Scene scene, XmlTextReader reader) | ||
176 | { | ||
177 | XmlDocument doc = new XmlDocument(); | ||
178 | reader.WhitespaceHandling = WhitespaceHandling.None; | ||
179 | doc.Load(reader); | ||
180 | reader.Close(); | ||
181 | XmlNode rootNode = doc.FirstChild; | ||
182 | |||
183 | foreach (XmlNode aPrimNode in rootNode.ChildNodes) | ||
167 | { | 184 | { |
168 | throw new Exception("Could not open file " + fileName + " for reading"); | 185 | CreatePrimFromXml(scene, aPrimNode.OuterXml); |
169 | } | 186 | } |
170 | } | 187 | } |
171 | 188 | ||
172 | public static void CreatePrimFromXml(Scene scene, string xmlData) | 189 | public static void CreatePrimFromXml(Scene scene, string xmlData) |