29 using System.Collections.Generic;
32 using OpenSim.Region.Framework.Scenes;
36 using System.Reflection;
37 using OpenSim.Framework.Serialization;
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56 public string Directory {
get; set; }
61 public Point Location {
get; set; }
66 public string OriginalID {
get; set; }
77 public Vector3 RegionSize {
get; set; }
81 RegionSize =
new Vector3(256f,256f,
float.MaxValue);
88 public Boolean MultiRegionFormat {
get; set; }
93 protected Dictionary<string, RegionInfo> m_directory2region =
new Dictionary<string, RegionInfo>();
98 protected Dictionary<UUID, RegionInfo> m_newId2region =
new Dictionary<UUID, RegionInfo>();
100 public int LoadedCreationDateTime {
get; set; }
101 public string DefaultOriginalID {
get; set; }
104 protected int? m_curY = null;
105 protected int? m_curX = null;
111 MultiRegionFormat =
false;
119 m_curY = (m_curY == null) ? 0 : m_curY + 1;
125 m_curX = (m_curX == null) ? 0 : m_curX + 1;
132 int x = (int)((m_curX == null) ? 0 : m_curX);
133 int y = (int)((m_curY == null) ? 0 : m_curY);
135 m_curRegion.Location =
new Point(x, y);
136 m_curRegion.OriginalID = id;
142 if(m_curRegion != null)
144 m_curRegion.Directory = directory;
145 m_directory2region[directory] = m_curRegion;
151 if(m_curRegion != null)
152 m_curRegion.RegionSize = size;
167 foreach (
RegionInfo archivedRegion
in m_directory2region.Values)
169 Point location =
new Point((
int)rootScene.RegionInfo.RegionLocX,
170 (
int)rootScene.RegionInfo.RegionLocY);
172 location.Offset(archivedRegion.Location);
175 if (simulatorScenes.TryGetScene(location, out scene))
177 archivedRegion.Scene = scene;
178 m_newId2region[scene.RegionInfo.RegionID] = archivedRegion;
182 m_log.WarnFormat(
"[ARCHIVER]: Not loading archived region {0} because there's no existing region at location {1},{2}",
183 archivedRegion.Directory, location.X, location.Y);
200 relativePath = fullPath;
202 if (!MultiRegionFormat)
204 if (m_newId2region.Count > 0)
205 scene = m_newId2region.First().Value.Scene;
212 string[] parts = fullPath.Split(
new Char[] {
'/' }, 3);
213 if (parts.Length != 3)
215 string regionDirectory = parts[1];
216 relativePath = parts[2];
219 if (m_directory2region.TryGetValue(regionDirectory, out region))
221 scene = region.Scene;
222 return (scene != null);
239 if (m_newId2region.TryGetValue(newID, out region))
242 return DefaultOriginalID;
251 return m_newId2region.Keys.ToList();
256 return m_directory2region.Count;
List< UUID > GetLoadedScenes()
Returns the scenes that have been (or will be) loaded.
bool GetRegionFromPath(string fullPath, out Scene scene, out string relativePath)
Returns the archived region according to the path of a file in the archive. Also, converts the full p...
The regions included in an OAR file.
A group of regions arranged in a rectangle, possibly with holes.
Constants for the archiving module
OpenSim.Framework.RegionInfo RegionInfo
string GetOriginalRegionID(UUID newID)
Returns the original UUID of a region (from the simulator where the OAR was saved), given the UUID of the scene it was loaded into in the current simulator.
void SetSimulatorScenes(Scene rootScene, ArchiveScenesGroup simulatorScenes)
Sets all the scenes present in the simulator.
void SetRegionOriginalID(string id)
void SetRegionSize(Vector3 size)
const string REGIONS_PATH
One region in the archive.
string OriginalID
The UUID of the original scene from which this archived region was saved.
void SetRegionDirectory(string directory)