ArchiveReadRequest.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.IO;
  30. using System.IO.Compression;
  31. using System.Net;
  32. using System.Reflection;
  33. using System.Text;
  34. using System.Xml;
  35. using log4net;
  36. using OpenMetaverse;
  37. using OpenSim.Framework;
  38. using OpenSim.Framework.Serialization;
  39. using OpenSim.Framework.Serialization.External;
  40. using OpenSim.Framework.Communications.Cache;
  41. using OpenSim.Region.CoreModules.World.Terrain;
  42. using OpenSim.Region.Framework.Interfaces;
  43. using OpenSim.Region.Framework.Scenes;
  44. namespace OpenSim.Region.CoreModules.World.Archiver
  45. {
  46. /// <summary>
  47. /// Handles an individual archive read request
  48. /// </summary>
  49. public class ArchiveReadRequest
  50. {
  51. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  52. private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
  53. private static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
  54. private Scene m_scene;
  55. private Stream m_loadStream;
  56. private Guid m_requestId;
  57. private string m_errorMessage;
  58. /// <value>
  59. /// Should the archive being loaded be merged with what is already on the region?
  60. /// </value>
  61. private bool m_merge;
  62. /// <summary>
  63. /// Used to cache lookups for valid uuids.
  64. /// </summary>
  65. private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>();
  66. public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId)
  67. {
  68. m_scene = scene;
  69. m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
  70. m_errorMessage = String.Empty;
  71. m_merge = merge;
  72. m_requestId = requestId;
  73. }
  74. public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, Guid requestId)
  75. {
  76. m_scene = scene;
  77. m_loadStream = loadStream;
  78. m_merge = merge;
  79. m_requestId = requestId;
  80. }
  81. /// <summary>
  82. /// Dearchive the region embodied in this request.
  83. /// </summary>
  84. public void DearchiveRegion()
  85. {
  86. // The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions
  87. DearchiveRegion0DotStar();
  88. }
  89. private void DearchiveRegion0DotStar()
  90. {
  91. int successfulAssetRestores = 0;
  92. int failedAssetRestores = 0;
  93. List<string> serialisedSceneObjects = new List<string>();
  94. List<string> serialisedParcels = new List<string>();
  95. string filePath = "NONE";
  96. TarArchiveReader archive = new TarArchiveReader(m_loadStream);
  97. byte[] data;
  98. TarArchiveReader.TarEntryType entryType;
  99. try
  100. {
  101. while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
  102. {
  103. //m_log.DebugFormat(
  104. // "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length);
  105. if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
  106. continue;
  107. if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
  108. {
  109. serialisedSceneObjects.Add(m_utf8Encoding.GetString(data));
  110. }
  111. else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
  112. {
  113. if (LoadAsset(filePath, data))
  114. successfulAssetRestores++;
  115. else
  116. failedAssetRestores++;
  117. if ((successfulAssetRestores + failedAssetRestores) % 250 == 0)
  118. m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets...");
  119. }
  120. else if (!m_merge && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
  121. {
  122. LoadTerrain(filePath, data);
  123. }
  124. else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
  125. {
  126. LoadRegionSettings(filePath, data);
  127. }
  128. else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
  129. {
  130. serialisedParcels.Add(m_utf8Encoding.GetString(data));
  131. }
  132. else if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
  133. {
  134. LoadControlFile(filePath, data);
  135. }
  136. }
  137. //m_log.Debug("[ARCHIVER]: Reached end of archive");
  138. }
  139. catch (Exception e)
  140. {
  141. m_log.ErrorFormat(
  142. "[ARCHIVER]: Aborting load with error in archive file {0}. {1}", filePath, e);
  143. m_errorMessage += e.ToString();
  144. m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
  145. return;
  146. }
  147. finally
  148. {
  149. archive.Close();
  150. }
  151. m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);
  152. if (failedAssetRestores > 0)
  153. {
  154. m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
  155. m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
  156. }
  157. if (!m_merge)
  158. {
  159. m_log.Info("[ARCHIVER]: Clearing all existing scene objects");
  160. m_scene.DeleteAllSceneObjects();
  161. }
  162. // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
  163. // otherwise, use the master avatar uuid instead
  164. UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID;
  165. if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
  166. masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner;
  167. // Reload serialized parcels
  168. m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count);
  169. List<LandData> landData = new List<LandData>();
  170. foreach (string serialisedParcel in serialisedParcels)
  171. {
  172. LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
  173. if (!ResolveUserUuid(parcel.OwnerID))
  174. parcel.OwnerID = masterAvatarId;
  175. landData.Add(parcel);
  176. }
  177. m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
  178. m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
  179. // Reload serialized prims
  180. m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
  181. IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>();
  182. int sceneObjectsLoadedCount = 0;
  183. foreach (string serialisedSceneObject in serialisedSceneObjects)
  184. {
  185. /*
  186. m_log.DebugFormat("[ARCHIVER]: Loading xml with raw size {0}", serialisedSceneObject.Length);
  187. // Really large xml files (multi megabyte) appear to cause
  188. // memory problems
  189. // when loading the xml. But don't enable this check yet
  190. if (serialisedSceneObject.Length > 5000000)
  191. {
  192. m_log.Error("[ARCHIVER]: Ignoring xml since size > 5000000);");
  193. continue;
  194. }
  195. */
  196. SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject);
  197. // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
  198. // on the same region server and multiple examples a single object archive to be imported
  199. // to the same scene (when this is possible).
  200. sceneObject.ResetIDs();
  201. foreach (SceneObjectPart part in sceneObject.Children.Values)
  202. {
  203. if (!ResolveUserUuid(part.CreatorID))
  204. part.CreatorID = masterAvatarId;
  205. if (!ResolveUserUuid(part.OwnerID))
  206. part.OwnerID = masterAvatarId;
  207. if (!ResolveUserUuid(part.LastOwnerID))
  208. part.LastOwnerID = masterAvatarId;
  209. // And zap any troublesome sit target information
  210. part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
  211. part.SitTargetPosition = new Vector3(0, 0, 0);
  212. // Fix ownership/creator of inventory items
  213. // Not doing so results in inventory items
  214. // being no copy/no mod for everyone
  215. lock (part.TaskInventory)
  216. {
  217. TaskInventoryDictionary inv = part.TaskInventory;
  218. foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
  219. {
  220. if (!ResolveUserUuid(kvp.Value.OwnerID))
  221. {
  222. kvp.Value.OwnerID = masterAvatarId;
  223. }
  224. if (!ResolveUserUuid(kvp.Value.CreatorID))
  225. {
  226. kvp.Value.CreatorID = masterAvatarId;
  227. }
  228. }
  229. }
  230. }
  231. if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
  232. {
  233. sceneObjectsLoadedCount++;
  234. sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0);
  235. }
  236. }
  237. m_log.InfoFormat("[ARCHIVER]: Restored {0} scene objects to the scene", sceneObjectsLoadedCount);
  238. int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount;
  239. if (ignoredObjects > 0)
  240. m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects);
  241. m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
  242. m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
  243. }
  244. /// <summary>
  245. /// Look up the given user id to check whether it's one that is valid for this grid.
  246. /// </summary>
  247. /// <param name="uuid"></param>
  248. /// <returns></returns>
  249. private bool ResolveUserUuid(UUID uuid)
  250. {
  251. if (!m_validUserUuids.ContainsKey(uuid))
  252. {
  253. CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(uuid);
  254. if (profile != null && profile.UserProfile != null)
  255. m_validUserUuids.Add(uuid, true);
  256. else
  257. m_validUserUuids.Add(uuid, false);
  258. }
  259. if (m_validUserUuids[uuid])
  260. return true;
  261. else
  262. return false;
  263. }
  264. /// <summary>
  265. /// Load an asset
  266. /// </summary>
  267. /// <param name="assetFilename"></param>
  268. /// <param name="data"></param>
  269. /// <returns>true if asset was successfully loaded, false otherwise</returns>
  270. private bool LoadAsset(string assetPath, byte[] data)
  271. {
  272. // Right now we're nastily obtaining the UUID from the filename
  273. string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
  274. int i = filename.LastIndexOf(ArchiveConstants.ASSET_EXTENSION_SEPARATOR);
  275. if (i == -1)
  276. {
  277. m_log.ErrorFormat(
  278. "[ARCHIVER]: Could not find extension information in asset path {0} since it's missing the separator {1}. Skipping",
  279. assetPath, ArchiveConstants.ASSET_EXTENSION_SEPARATOR);
  280. return false;
  281. }
  282. string extension = filename.Substring(i);
  283. string uuid = filename.Remove(filename.Length - extension.Length);
  284. if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension))
  285. {
  286. sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
  287. if (assetType == (sbyte)AssetType.Unknown)
  288. m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
  289. //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
  290. AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType);
  291. asset.Data = data;
  292. // We're relying on the asset service to do the sensible thing and not store the asset if it already
  293. // exists.
  294. m_scene.AssetService.Store(asset);
  295. /**
  296. * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so
  297. * it might be best done when dearchive takes place on a separate thread
  298. if (asset.Type=AssetType.Texture)
  299. {
  300. IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
  301. if (cacheLayerDecode != null)
  302. cacheLayerDecode.syncdecode(asset.FullID, asset.Data);
  303. }
  304. */
  305. return true;
  306. }
  307. else
  308. {
  309. m_log.ErrorFormat(
  310. "[ARCHIVER]: Tried to dearchive data with path {0} with an unknown type extension {1}",
  311. assetPath, extension);
  312. return false;
  313. }
  314. }
  315. /// <summary>
  316. /// Load region settings data
  317. /// </summary>
  318. /// <param name="settingsPath"></param>
  319. /// <param name="data"></param>
  320. /// <returns>
  321. /// true if settings were loaded successfully, false otherwise
  322. /// </returns>
  323. private bool LoadRegionSettings(string settingsPath, byte[] data)
  324. {
  325. RegionSettings loadedRegionSettings;
  326. try
  327. {
  328. loadedRegionSettings = RegionSettingsSerializer.Deserialize(data);
  329. }
  330. catch (Exception e)
  331. {
  332. m_log.ErrorFormat(
  333. "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}",
  334. settingsPath, e);
  335. return false;
  336. }
  337. RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
  338. currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit;
  339. currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage;
  340. currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide;
  341. currentRegionSettings.AllowLandResell = loadedRegionSettings.AllowLandResell;
  342. currentRegionSettings.BlockFly = loadedRegionSettings.BlockFly;
  343. currentRegionSettings.BlockShowInSearch = loadedRegionSettings.BlockShowInSearch;
  344. currentRegionSettings.BlockTerraform = loadedRegionSettings.BlockTerraform;
  345. currentRegionSettings.DisableCollisions = loadedRegionSettings.DisableCollisions;
  346. currentRegionSettings.DisablePhysics = loadedRegionSettings.DisablePhysics;
  347. currentRegionSettings.DisableScripts = loadedRegionSettings.DisableScripts;
  348. currentRegionSettings.Elevation1NE = loadedRegionSettings.Elevation1NE;
  349. currentRegionSettings.Elevation1NW = loadedRegionSettings.Elevation1NW;
  350. currentRegionSettings.Elevation1SE = loadedRegionSettings.Elevation1SE;
  351. currentRegionSettings.Elevation1SW = loadedRegionSettings.Elevation1SW;
  352. currentRegionSettings.Elevation2NE = loadedRegionSettings.Elevation2NE;
  353. currentRegionSettings.Elevation2NW = loadedRegionSettings.Elevation2NW;
  354. currentRegionSettings.Elevation2SE = loadedRegionSettings.Elevation2SE;
  355. currentRegionSettings.Elevation2SW = loadedRegionSettings.Elevation2SW;
  356. currentRegionSettings.FixedSun = loadedRegionSettings.FixedSun;
  357. currentRegionSettings.ObjectBonus = loadedRegionSettings.ObjectBonus;
  358. currentRegionSettings.RestrictPushing = loadedRegionSettings.RestrictPushing;
  359. currentRegionSettings.TerrainLowerLimit = loadedRegionSettings.TerrainLowerLimit;
  360. currentRegionSettings.TerrainRaiseLimit = loadedRegionSettings.TerrainRaiseLimit;
  361. currentRegionSettings.TerrainTexture1 = loadedRegionSettings.TerrainTexture1;
  362. currentRegionSettings.TerrainTexture2 = loadedRegionSettings.TerrainTexture2;
  363. currentRegionSettings.TerrainTexture3 = loadedRegionSettings.TerrainTexture3;
  364. currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
  365. currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
  366. currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
  367. IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
  368. estateModule.sendRegionHandshakeToAll();
  369. return true;
  370. }
  371. /// <summary>
  372. /// Load terrain data
  373. /// </summary>
  374. /// <param name="terrainPath"></param>
  375. /// <param name="data"></param>
  376. /// <returns>
  377. /// true if terrain was resolved successfully, false otherwise.
  378. /// </returns>
  379. private bool LoadTerrain(string terrainPath, byte[] data)
  380. {
  381. ITerrainModule terrainModule = m_scene.RequestModuleInterface<ITerrainModule>();
  382. MemoryStream ms = new MemoryStream(data);
  383. terrainModule.LoadFromStream(terrainPath, ms);
  384. ms.Close();
  385. m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath);
  386. return true;
  387. }
  388. /// <summary>
  389. /// Resolve path to a working FileStream
  390. /// </summary>
  391. /// <param name="path"></param>
  392. /// <returns></returns>
  393. private Stream GetStream(string path)
  394. {
  395. if (File.Exists(path))
  396. {
  397. return new FileStream(path, FileMode.Open, FileAccess.Read);
  398. }
  399. else
  400. {
  401. try
  402. {
  403. Uri uri = new Uri(path);
  404. if (uri.Scheme == "file")
  405. {
  406. return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read);
  407. }
  408. else
  409. {
  410. if (uri.Scheme != "http")
  411. throw new Exception(String.Format("Unsupported URI scheme ({0})", path));
  412. // OK, now we know we have an HTTP URI to work with
  413. return URIFetch(uri);
  414. }
  415. }
  416. catch (UriFormatException)
  417. {
  418. // In many cases the user will put in a plain old filename that cannot be found so assume that
  419. // this is the problem rather than confusing the issue with a UriFormatException
  420. throw new Exception(String.Format("Cannot find file {0}", path));
  421. }
  422. }
  423. }
  424. private static Stream URIFetch(Uri uri)
  425. {
  426. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
  427. // request.Credentials = credentials;
  428. request.ContentLength = 0;
  429. request.KeepAlive = false;
  430. WebResponse response = request.GetResponse();
  431. Stream file = response.GetResponseStream();
  432. // justincc: gonna ignore the content type for now and just try anything
  433. //if (response.ContentType != "application/x-oar")
  434. // throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString()));
  435. if (response.ContentLength == 0)
  436. throw new Exception(String.Format("{0} returned an empty file", uri.ToString()));
  437. // return new BufferedStream(file, (int) response.ContentLength);
  438. return new BufferedStream(file, 1000000);
  439. }
  440. /// <summary>
  441. /// Load oar control file
  442. /// </summary>
  443. /// <param name="path"></param>
  444. /// <param name="data"></param>
  445. private void LoadControlFile(string path, byte[] data)
  446. {
  447. //Create the XmlNamespaceManager.
  448. NameTable nt = new NameTable();
  449. XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
  450. // Create the XmlParserContext.
  451. XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
  452. XmlTextReader xtr
  453. = new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context);
  454. RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
  455. // Loaded metadata will empty if no information exists in the archive
  456. currentRegionSettings.LoadedCreationDateTime = 0;
  457. currentRegionSettings.LoadedCreationID = "";
  458. while (xtr.Read())
  459. {
  460. if (xtr.NodeType == XmlNodeType.Element)
  461. {
  462. if (xtr.Name.ToString() == "datetime")
  463. {
  464. int value;
  465. if (Int32.TryParse(xtr.ReadElementContentAsString(), out value))
  466. currentRegionSettings.LoadedCreationDateTime = value;
  467. }
  468. else if (xtr.Name.ToString() == "id")
  469. {
  470. currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString();
  471. }
  472. }
  473. }
  474. currentRegionSettings.Save();
  475. }
  476. }
  477. }