more useless changes on some oar/iar files

This commit is contained in:
UbitUmarov
2022-10-15 21:10:15 +01:00
parent bf1feaa616
commit fa3975b4e8
2 changed files with 151 additions and 161 deletions

View File

@@ -131,12 +131,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <value> /// <value>
/// original oar region size. not using Constants.RegionSize /// original oar region size. not using Constants.RegionSize
/// </value> /// </value>
protected Vector3 m_incomingRegionSize = new Vector3(256f, 256f, float.MaxValue); protected Vector3 m_incomingRegionSize = new(256f, 256f, float.MaxValue);
/// <value> /// <value>
/// Center around which to apply the rotation relative to the original oar position /// Center around which to apply the rotation relative to the original oar position
/// </value> /// </value>
protected Vector3 m_rotationCenter = new Vector3(128f, 128f, 0f); protected Vector3 m_rotationCenter = new(128f, 128f, 0f);
/// <value> /// <value>
/// Corner 1 of a bounding cuboid which specifies which objects we load from the oar /// Corner 1 of a bounding cuboid which specifies which objects we load from the oar
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <value> /// <value>
/// Size of a bounding cuboid which specifies which objects we load from the oar /// Size of a bounding cuboid which specifies which objects we load from the oar
/// </value> /// </value>
protected Vector3 m_boundingSize = new Vector3(Constants.MaximumRegionSize, Constants.MaximumRegionSize, float.MaxValue); protected Vector3 m_boundingSize = new(Constants.MaximumRegionSize, Constants.MaximumRegionSize, float.MaxValue);
protected bool m_noObjects = false; protected bool m_noObjects = false;
protected bool m_boundingBox = false; protected bool m_boundingBox = false;
@@ -155,17 +155,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <summary> /// <summary>
/// Used to cache lookups for valid uuids. /// Used to cache lookups for valid uuids.
/// </summary> /// </summary>
private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>(); private readonly Dictionary<UUID, bool> m_validUserUuids = new();
private IUserManagement m_UserMan; private IUserManagement m_UserMan;
private IUserManagement UserManager private IUserManagement UserManager
{ {
get get
{ {
if (m_UserMan == null) m_UserMan ??= m_rootScene.RequestModuleInterface<IUserManagement>();
{
m_UserMan = m_rootScene.RequestModuleInterface<IUserManagement>();
}
return m_UserMan; return m_UserMan;
} }
} }
@@ -173,11 +170,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <summary> /// <summary>
/// Used to cache lookups for valid groups. /// Used to cache lookups for valid groups.
/// </summary> /// </summary>
private IDictionary<UUID, bool> m_validGroupUuids = new Dictionary<UUID, bool>(); private readonly Dictionary<UUID, bool> m_validGroupUuids = new();
private IGroupsModule m_groupsModule; private readonly IGroupsModule m_groupsModule;
private IAssetService m_assetService = null; private readonly IAssetService m_assetService = null;
private UUID m_defaultUser; private UUID m_defaultUser;
@@ -294,10 +291,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private void loadNeededAssets(assetfileInfo[] assetsFiles, int count, ref int successfulAssetRestores, private void loadNeededAssets(assetfileInfo[] assetsFiles, int count, ref int successfulAssetRestores,
ref int failedAssetRestores, ref int skipedAssetRestores) ref int failedAssetRestores, ref int skipedAssetRestores)
{ {
List<string> ids = new List<string>(count); List<string> ids = new(count);
List<UUID> uuids = new List<UUID>(count); List<UUID> uuids = new(count);
List<sbyte> types = new List<sbyte>(count); List<sbyte> types = new(count);
List<byte[]> datas = new List<byte[]>(count); List<byte[]> datas = new(count);
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
@@ -307,7 +304,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
assetsFiles[i].path = null; assetsFiles[i].path = null;
assetsFiles[i].data = null; assetsFiles[i].data = null;
string filename = assetPath.Substring(ArchiveConstants.ASSETS_PATH.Length); string filename = assetPath[ArchiveConstants.ASSETS_PATH.Length..];
int indx = filename.LastIndexOf(ArchiveConstants.ASSET_EXTENSION_SEPARATOR); int indx = filename.LastIndexOf(ArchiveConstants.ASSET_EXTENSION_SEPARATOR);
if (indx < 0) if (indx < 0)
{ {
@@ -317,7 +314,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
failedAssetRestores++; failedAssetRestores++;
continue; continue;
} }
string extension = filename.Substring(indx); string extension = filename[indx..];
if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension))
{ {
string id = filename.Remove(indx); string id = filename.Remove(indx);
@@ -336,7 +333,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
bool[] exits = m_assetService.AssetsExist(ids.ToArray()); bool[] exits = m_assetService.AssetsExist(ids.ToArray());
ids.Clear(); ids.Clear();
if (exits == null) if (exits is null)
{ {
m_log.Error("[ARCHIVER]: asset service AssetsExists failed"); m_log.Error("[ARCHIVER]: asset service AssetsExists failed");
failedAssetRestores += uuids.Count; failedAssetRestores += uuids.Count;
@@ -388,19 +385,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// We dearchive all the scenes at once, because the files in the TAR archive might be mixed. // We dearchive all the scenes at once, because the files in the TAR archive might be mixed.
// Therefore, we have to keep track of the dearchive context of all the scenes. // Therefore, we have to keep track of the dearchive context of all the scenes.
Dictionary<UUID, DearchiveContext> sceneContexts = new Dictionary<UUID, DearchiveContext>(); Dictionary<UUID, DearchiveContext> sceneContexts = new();
string fullPath = "NONE"; string fullPath = "NONE";
TarArchiveReader archive = null; TarArchiveReader archive = null;
byte[] data; byte[] data;
TarArchiveReader.TarEntryType entryType;
assetfileInfo[] assetsFiles = new assetfileInfo[32]; assetfileInfo[] assetsFiles = new assetfileInfo[32];
int assetsFilesCount = 0; int assetsFilesCount = 0;
try try
{ {
FindAndLoadControlFile(out archive, out dearchivedScenes); FindAndLoadControlFile(out archive, out dearchivedScenes);
while ((data = archive.ReadEntry(out fullPath, out entryType)) != null) while ((data = archive.ReadEntry(out fullPath, out TarArchiveReader.TarEntryType entryType)) is not null)
{ {
//m_log.DebugFormat( //m_log.DebugFormat(
// "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length); // "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length);
@@ -410,13 +406,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Find the scene that this file belongs to // Find the scene that this file belongs to
Scene scene; if (!dearchivedScenes.GetRegionFromPath(fullPath, out Scene scene, out string filePath))
string filePath;
if (!dearchivedScenes.GetRegionFromPath(fullPath, out scene, out filePath))
continue; // this file belongs to a region that we're not loading continue; // this file belongs to a region that we're not loading
DearchiveContext sceneContext = null; DearchiveContext sceneContext = null;
if (scene != null) if (scene is not null)
{ {
if (!sceneContexts.TryGetValue(scene.RegionInfo.RegionID, out sceneContext)) if (!sceneContexts.TryGetValue(scene.RegionInfo.RegionID, out sceneContext))
{ {
@@ -427,36 +421,43 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Process the file // Process the file
if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH) && !m_noObjects) if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
{ {
sceneContext.SerialisedSceneObjects.Add(Encoding.UTF8.GetString(data)); if(!m_noObjects)
sceneContext.SerialisedSceneObjects.Add(Encoding.UTF8.GetString(data));
} }
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH) && !m_skipAssets) else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{ {
assetfileInfo asf = new assetfileInfo if(!m_skipAssets)
{ {
path = filePath, assetfileInfo asf = new()
data = data {
}; path = filePath,
data = data
};
assetsFiles[assetsFilesCount++] = asf; assetsFiles[assetsFilesCount++] = asf;
if (assetsFilesCount == 32) if (assetsFilesCount == 32)
{ {
loadNeededAssets(assetsFiles, assetsFilesCount, ref successfulAssetRestores, ref failedAssetRestores, ref skippedAssetRestores); loadNeededAssets(assetsFiles, assetsFilesCount, ref successfulAssetRestores, ref failedAssetRestores, ref skippedAssetRestores);
assetsFilesCount = 0; assetsFilesCount = 0;
}
} }
} }
else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_mergeTerrain)) else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
{ {
LoadTerrain(scene, filePath, data); if(!m_merge || m_mergeTerrain)
LoadTerrain(scene, filePath, data);
} }
else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) else if (filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
{ {
LoadRegionSettings(scene, filePath, data, dearchivedScenes); if(!m_merge)
LoadRegionSettings(scene, filePath, data, dearchivedScenes);
} }
else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_mergeParcels)) else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
{ {
sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); if(!m_merge || m_mergeParcels)
sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data));
} }
else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) else if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
{ {
@@ -471,33 +472,32 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error( m_log.Error($"[ARCHIVER]: Aborting load with error in archive file {fullPath}: {e.Message}");
String.Format("[ARCHIVER]: Aborting load with error in archive file {0} ", fullPath), e); m_errorMessage += e.Message;
m_errorMessage += e.ToString();
m_rootScene.EventManager.TriggerOarFileLoaded(m_requestId, new List<UUID>(), m_errorMessage); m_rootScene.EventManager.TriggerOarFileLoaded(m_requestId, new List<UUID>(), m_errorMessage);
return; return;
} }
finally finally
{ {
if (archive != null) if (archive is not null)
archive.Close(); archive.Close();
} }
if (!m_skipAssets) if (!m_skipAssets)
{ {
m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores + skippedAssetRestores); m_log.Info($"[ARCHIVER]: Restored {successfulAssetRestores + skippedAssetRestores} assets");
m_log.InfoFormat("[ARCHIVER]: Skipped {0} asset uploads", skippedAssetRestores); m_log.Info($"[ARCHIVER]: Skipped {skippedAssetRestores} asset uploads");
if (failedAssetRestores > 0) if (failedAssetRestores > 0)
{ {
m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); m_log.Error($"[ARCHIVER]: Failed to load {failedAssetRestores} assets");
m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); m_errorMessage += $"Failed to load {failedAssetRestores} assets";
} }
} }
foreach (DearchiveContext sceneContext in sceneContexts.Values) foreach (DearchiveContext sceneContext in sceneContexts.Values)
{ {
m_log.InfoFormat("[ARCHIVER]: Loading region {0}", sceneContext.Scene.RegionInfo.RegionName); m_log.Info($"[ARCHIVER]: Loading region {sceneContext.Scene.RegionInfo.RegionName}");
if (!m_merge) if (!m_merge)
{ {
@@ -513,13 +513,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Inform any interested parties that the region has changed. We waited until now so that all // Inform any interested parties that the region has changed. We waited until now so that all
// of the region's objects will be loaded when we send this notification. // of the region's objects will be loaded when we send this notification.
IEstateModule estateModule = sceneContext.Scene.RequestModuleInterface<IEstateModule>(); IEstateModule estateModule = sceneContext.Scene.RequestModuleInterface<IEstateModule>();
if (estateModule != null) if (estateModule is not null)
estateModule.TriggerRegionInfoChange(); estateModule.TriggerRegionInfoChange();
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[ARCHIVER]: Error loading parcels or objects ", e); m_log.Error($"[ARCHIVER]: Error loading parcels or objects :{e.Message}");
m_errorMessage += e.ToString(); m_errorMessage += e.Message;
m_rootScene.EventManager.TriggerOarFileLoaded(m_requestId, new List<UUID>(), m_errorMessage); m_rootScene.EventManager.TriggerOarFileLoaded(m_requestId, new List<UUID>(), m_errorMessage);
return; return;
} }
@@ -544,7 +544,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
sceneContext.SceneObjects.Clear(); sceneContext.SceneObjects.Clear();
} }
m_log.Info("[ARCHIVER]: Start scripts done"); m_log.Info("[ARCHIVER]: Start scripts done");
}, null, string.Format("ReadArchiveStartScripts (request {0})", m_requestId)); }, null, $"ReadArchiveStartScripts (request {m_requestId})");
} }
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
@@ -567,12 +567,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
archive = new TarArchiveReader(m_loadStream); archive = new TarArchiveReader(m_loadStream);
dearchivedScenes = new DearchiveScenesInfo(); dearchivedScenes = new DearchiveScenesInfo();
string filePath;
byte[] data; byte[] data;
TarArchiveReader.TarEntryType entryType;
bool firstFile = true; bool firstFile = true;
while ((data = archive.ReadEntry(out filePath, out entryType)) != null) while ((data = archive.ReadEntry(out string filePath, out TarArchiveReader.TarEntryType entryType)) is not null)
{ {
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
continue; continue;
@@ -582,7 +580,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
LoadControlFile(filePath, data, dearchivedScenes); LoadControlFile(filePath, data, dearchivedScenes);
// Find which scenes are available in the simulator // Find which scenes are available in the simulator
ArchiveScenesGroup simulatorScenes = new ArchiveScenesGroup(); ArchiveScenesGroup simulatorScenes = new();
SceneManager.Instance.ForEachScene(delegate(Scene scene2) SceneManager.Instance.ForEachScene(delegate(Scene scene2)
{ {
simulatorScenes.AddScene(scene2); simulatorScenes.AddScene(scene2);
@@ -598,7 +596,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
m_loadStream.Seek(0, SeekOrigin.Begin); m_loadStream.Seek(0, SeekOrigin.Begin);
} }
else if (m_loadPath != null) else if (m_loadPath is not null)
{ {
archive.Close(); archive.Close();
archive = null; archive = null;
@@ -629,10 +627,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
protected void LoadObjects(Scene scene, List<string> serialisedSceneObjects, List<SceneObjectGroup> sceneObjects) protected void LoadObjects(Scene scene, List<string> serialisedSceneObjects, List<SceneObjectGroup> sceneObjects)
{ {
// Reload serialized prims // Reload serialized prims
m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); m_log.Info($"[ARCHIVER]: Loading {serialisedSceneObjects.Count} scene objects. Please wait.");
// Convert rotation to radians // Convert rotation to radians
double rotation = Math.PI * m_rotation / 180f; double rotation = MathF.PI * m_rotation / 180f;
OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, (float)rotation); OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, (float)rotation);
@@ -640,7 +638,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>(); IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>();
int sceneObjectsLoadedCount = 0; int sceneObjectsLoadedCount = 0;
Vector3 boundingExtent = new Vector3(m_boundingOrigin.X + m_boundingSize.X, m_boundingOrigin.Y + m_boundingSize.Y, m_boundingOrigin.Z + m_boundingSize.Z); Vector3 boundingExtent = new(m_boundingOrigin.X + m_boundingSize.X, m_boundingOrigin.Y + m_boundingSize.Y, m_boundingOrigin.Z + m_boundingSize.Z);
int mergeskip = 0; int mergeskip = 0;
foreach (string serialisedSceneObject in serialisedSceneObjects) foreach (string serialisedSceneObject in serialisedSceneObjects)
@@ -660,7 +658,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
Vector3 pos = sceneObject.AbsolutePosition; Vector3 pos = sceneObject.AbsolutePosition;
if (m_debug) if (m_debug)
m_log.DebugFormat("[ARCHIVER]: Loading object from OAR with original scene position {0}.", pos.ToString()); m_log.Debug($"[ARCHIVER]: Loading object from OAR with original scene position {pos}");
// Happily this does not do much to the object since it hasn't been added to the scene yet // Happily this does not do much to the object since it hasn't been added to the scene yet
if (!sceneObject.IsAttachment) if (!sceneObject.IsAttachment)
@@ -669,8 +667,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
//fix the rotation center to the middle of the incoming region now as it's otherwise hopelessly confusing on varRegions //fix the rotation center to the middle of the incoming region now as it's otherwise hopelessly confusing on varRegions
//as it only works with objects and terrain (using old Merge method) and not parcels //as it only works with objects and terrain (using old Merge method) and not parcels
m_rotationCenter.X = m_incomingRegionSize.X / 2; m_rotationCenter.X = m_incomingRegionSize.X * 0.5f;
m_rotationCenter.Y = m_incomingRegionSize.Y / 2; m_rotationCenter.Y = m_incomingRegionSize.Y * 0.5f;
// Rotate the object // Rotate the object
sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation; sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation;
@@ -680,7 +678,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
offset *= rot; offset *= rot;
// Restore the object position back to relative to the region // Restore the object position back to relative to the region
pos = m_rotationCenter + offset; pos = m_rotationCenter + offset;
if (m_debug) m_log.DebugFormat("[ARCHIVER]: After rotation, object from OAR is at scene position {0}.", pos.ToString()); if (m_debug) m_log.Debug($"[ARCHIVER]: After rotation, object from OAR is at scene position {pos}");
} }
if (m_boundingBox) if (m_boundingBox)
{ {
@@ -688,7 +686,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|| pos.Y < m_boundingOrigin.Y || pos.Y >= boundingExtent.Y || pos.Y < m_boundingOrigin.Y || pos.Y >= boundingExtent.Y
|| pos.Z < m_boundingOrigin.Z || pos.Z >= boundingExtent.Z) || pos.Z < m_boundingOrigin.Z || pos.Z >= boundingExtent.Z)
{ {
if (m_debug) m_log.DebugFormat("[ARCHIVER]: Skipping object from OAR in scene because it's position {0} is outside of bounding cube.", pos.ToString()); if (m_debug) m_log.Debug($"[ARCHIVER]: Skipping object from OAR in scene because it's position {pos} is outside of bounding cube.");
continue; continue;
} }
//adjust object position to be relative to <0,0> so we can apply the displacement //adjust object position to be relative to <0,0> so we can apply the displacement
@@ -702,15 +700,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|| pos.Y < 0 || pos.Y >= scene.RegionInfo.RegionSizeY || pos.Y < 0 || pos.Y >= scene.RegionInfo.RegionSizeY
|| pos.Z < Constants.MinSimulationHeight || pos.Z > Constants.MaxSimulationHeight) || pos.Z < Constants.MinSimulationHeight || pos.Z > Constants.MaxSimulationHeight)
{ {
if (m_debug) m_log.DebugFormat("[ARCHIVER]: Skipping object from OAR After displacement clip {0}.", pos.ToString()); if (m_debug) m_log.Debug($"[ARCHIVER]: Skipping object from OAR After displacement clip {pos}");
continue; continue;
} }
if (m_debug) m_log.DebugFormat("[ARCHIVER]: After displacement, object from OAR is at scene position {0}.", pos.ToString()); if (m_debug) m_log.Debug($"[ARCHIVER]: After displacement, object from OAR is at scene position {pos}");
} }
sceneObject.AbsolutePosition = pos; sceneObject.AbsolutePosition = pos;
} }
if (m_debug) if (m_debug)
m_log.DebugFormat("[ARCHIVER]: Placing object from OAR in scene at position {0}. ", pos.ToString()); m_log.Debug($"[ARCHIVER]: Placing object from OAR in scene at position {pos}. ");
bool isTelehub = (sceneObject.UUID.Equals(oldTelehubUUID)) && (!oldTelehubUUID.IsZero()); bool isTelehub = (sceneObject.UUID.Equals(oldTelehubUUID)) && (!oldTelehubUUID.IsZero());
@@ -739,22 +737,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
} }
m_log.InfoFormat("[ARCHIVER]: Loaded {0} scene objects to the scene", sceneObjectsLoadedCount); m_log.Info($"[ARCHIVER]: Loaded {sceneObjectsLoadedCount} scene objects to the scene");
int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount - mergeskip; int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount - mergeskip;
if(mergeskip > 0) if(mergeskip > 0)
{ {
if(m_mergeReplaceObjects) if(m_mergeReplaceObjects)
m_log.InfoFormat("[ARCHIVER]: Replaced {0} scene objects", mergeskip); m_log.Info($"[ARCHIVER]: Replaced {mergeskip} scene objects");
else else
m_log.InfoFormat("[ARCHIVER]: Skipped {0} scene objects that already existed in the scene", mergeskip); m_log.Info($"[ARCHIVER]: Skipped {mergeskip} scene objects that already existed in the scene");
} }
if (ignoredObjects > 0) if (ignoredObjects > 0)
m_log.WarnFormat("[ARCHIVER]: Ignored {0} possible out of bounds", ignoredObjects); m_log.Warn($"[ARCHIVER]: Ignored {ignoredObjects} possible out of bounds");
if (!oldTelehubUUID.IsZero()) if (!oldTelehubUUID.IsZero())
{ {
m_log.WarnFormat("[ARCHIVER]: Telehub object not found: {0}", oldTelehubUUID); m_log.Warn($"[ARCHIVER]: Telehub object not found: {oldTelehubUUID}");
scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero; scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero;
scene.RegionInfo.RegionSettings.ClearSpawnPoints(); scene.RegionInfo.RegionSettings.ClearSpawnPoints();
} }
@@ -775,7 +773,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (!ResolveUserUuid(scene, part.CreatorID)) if (!ResolveUserUuid(scene, part.CreatorID))
part.CreatorID = m_defaultUser; part.CreatorID = m_defaultUser;
} }
if (UserManager != null) if (UserManager is not null)
UserManager.AddCreatorUser(part.CreatorID, part.CreatorData); UserManager.AddCreatorUser(part.CreatorID, part.CreatorData);
if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID))) if (!(ResolveUserUuid(scene, part.OwnerID) || ResolveGroupUuid(part.OwnerID)))
@@ -796,11 +794,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// being no copy/no mod for everyone // being no copy/no mod for everyone
lock (part.TaskInventory) lock (part.TaskInventory)
{ {
/* avination code disabled for opensim
// And zap any troublesome sit target information
part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
part.SitTargetPosition = new Vector3(0, 0, 0);
*/
// Fix ownership/creator of inventory items // Fix ownership/creator of inventory items
// Not doing so results in inventory items // Not doing so results in inventory items
// being no copy/no mod for everyone // being no copy/no mod for everyone
@@ -820,14 +813,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
kvp.Value.CreatorID = m_defaultUser; kvp.Value.CreatorID = m_defaultUser;
} }
if (UserManager != null) if (UserManager is not null)
UserManager.AddCreatorUser(kvp.Value.CreatorID, kvp.Value.CreatorData); UserManager.AddCreatorUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
if (!ResolveGroupUuid(kvp.Value.GroupID)) if (!ResolveGroupUuid(kvp.Value.GroupID))
kvp.Value.GroupID = UUID.Zero; kvp.Value.GroupID = UUID.Zero;
} }
part.TaskInventory.LockItemsForRead(false); part.TaskInventory.LockItemsForRead(false);
} }
} }
} }
@@ -846,15 +838,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
// Reload serialized parcels // Reload serialized parcels
m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count); m_log.Info($"[ARCHIVER]: Loading {serialisedParcels.Count} parcels. Please wait.");
List<LandData> landData = new List<LandData>(); List<LandData> landData = new();
ILandObject landObject = scene.RequestModuleInterface<ILandObject>(); ILandObject landObject;
List<ILandObject> parcels; List<ILandObject> parcels;
Vector3 parcelDisp = new Vector3(m_displacement.X, m_displacement.Y, 0f); Vector2 displacement = new(m_displacement.X, m_displacement.Y);
Vector2 displacement = new Vector2(m_displacement.X, m_displacement.Y); Vector2 boundingOrigin = new(m_boundingOrigin.X, m_boundingOrigin.Y);
Vector2 boundingOrigin = new Vector2(m_boundingOrigin.X, m_boundingOrigin.Y); Vector2 boundingSize = new(m_boundingSize.X, m_boundingSize.Y);
Vector2 boundingSize = new Vector2(m_boundingSize.X, m_boundingSize.Y); Vector2 regionSize = new(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY);
Vector2 regionSize = new Vector2(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY);
// Gather any existing parcels before we add any more. Later as we add parcels we can check if the new parcel // Gather any existing parcels before we add any more. Later as we add parcels we can check if the new parcel
// data overlays any of the old data, and we can modify and remove (if empty) the old parcel so that there's no conflict // data overlays any of the old data, and we can modify and remove (if empty) the old parcel so that there's no conflict
@@ -866,31 +857,30 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
LandData parcel = LandDataSerializer.Deserialize(serialisedParcel); LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
bool overrideRegionSize = true; //use the src land parcel data size not the dst region size bool overrideRegionSize = true; //use the src land parcel data size not the dst region size
bool isEmptyNow;
// create a new LandObject that we can use to manipulate the incoming source parcel data // create a new LandObject that we can use to manipulate the incoming source parcel data
// this is ok, but just beware that some of the LandObject functions (that we haven't used here) still // this is ok, but just beware that some of the LandObject functions (that we haven't used here) still
// assume we're always using the destination region size // assume we're always using the destination region size
LandData ld = new LandData(); LandData ld = new();
landObject = new LandObject(ld, scene); landObject = new LandObject(ld, scene)
landObject.LandData = parcel; {
LandData = parcel
};
bool[,] srcLandBitmap = landObject.ConvertBytesToLandBitmap(overrideRegionSize); bool[,] srcLandBitmap = landObject.ConvertBytesToLandBitmap(overrideRegionSize);
if (landObject.IsLandBitmapEmpty(srcLandBitmap)) if (landObject.IsLandBitmapEmpty(srcLandBitmap))
{ {
m_log.InfoFormat("[ARCHIVER]: Skipping source parcel {0} with GlobalID: {1} LocalID: {2} that has no claimed land.", m_log.Info($"[ARCHIVER]: Skipping source parcel {parcel.Name} with GlobalID: {parcel.GlobalID} LocalID: {parcel.LocalID} that has no claimed land.");
parcel.Name, parcel.GlobalID, parcel.LocalID);
continue; continue;
} }
//m_log.DebugFormat("[ARCHIVER]: Showing claimed land for source parcel: {0} with GlobalID: {1} LocalID: {2}.", //m_log.DebugFormat("[ARCHIVER]: Showing claimed land for source parcel: {0} with GlobalID: {1} LocalID: {2}.",
// parcel.Name, parcel.GlobalID, parcel.LocalID); // parcel.Name, parcel.GlobalID, parcel.LocalID);
//landObject.DebugLandBitmap(srcLandBitmap); //landObject.DebugLandBitmap(srcLandBitmap);
bool[,] dstLandBitmap = landObject.RemapLandBitmap(srcLandBitmap, displacement, m_rotation, boundingOrigin, boundingSize, regionSize, out isEmptyNow); bool[,] dstLandBitmap = landObject.RemapLandBitmap(srcLandBitmap, displacement, m_rotation, boundingOrigin, boundingSize, regionSize, out bool isEmptyNow);
if (isEmptyNow) if (isEmptyNow)
{ {
m_log.WarnFormat("[ARCHIVER]: Not adding destination parcel {0} with GlobalID: {1} LocalID: {2} because, after applying rotation, bounding and displacement, it has no claimed land.", m_log.Warn($"[ARCHIVER]: Not adding destination parcel {parcel.Name} with GlobalID: {parcel.GlobalID} LocalID: {parcel.LocalID} because, after applying rotation, bounding and displacement, it has no claimed land.");
parcel.Name, parcel.GlobalID, parcel.LocalID);
continue; continue;
} }
//m_log.DebugFormat("[ARCHIVER]: Showing claimed land for destination parcel: {0} with GlobalID: {1} LocalID: {2} after applying rotation, bounding and displacement.", //m_log.DebugFormat("[ARCHIVER]: Showing claimed land for destination parcel: {0} with GlobalID: {1} LocalID: {2} after applying rotation, bounding and displacement.",
@@ -909,7 +899,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
//and if so modify or lose the existing parcels //and if so modify or lose the existing parcels
for (int i = 0; i < parcels.Count; i++) for (int i = 0; i < parcels.Count; i++)
{ {
if (parcels[i] != null) if (parcels[i] is not null)
{ {
bool[,] modLandBitmap = parcels[i].ConvertBytesToLandBitmap(overrideRegionSize); bool[,] modLandBitmap = parcels[i].ConvertBytesToLandBitmap(overrideRegionSize);
modLandBitmap = parcels[i].RemoveFromLandBitmap(modLandBitmap, dstLandBitmap, out isEmptyNow); modLandBitmap = parcels[i].RemoveFromLandBitmap(modLandBitmap, dstLandBitmap, out isEmptyNow);
@@ -950,7 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
} }
List<LandAccessEntry> accessList = new List<LandAccessEntry>(); List<LandAccessEntry> accessList = new();
foreach (LandAccessEntry entry in parcel.ParcelAccessList) foreach (LandAccessEntry entry in parcel.ParcelAccessList)
{ {
if (ResolveUserUuid(scene, entry.AgentID)) if (ResolveUserUuid(scene, entry.AgentID))
@@ -959,13 +949,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
parcel.ParcelAccessList = accessList; parcel.ParcelAccessList = accessList;
if (m_debug) m_log.DebugFormat("[ARCHIVER]: Adding parcel {0}, local id {1}, owner {2}, group {3}, isGroupOwned {4}, area {5}", if (m_debug)
parcel.Name, parcel.LocalID, parcel.OwnerID, parcel.GroupID, parcel.IsGroupOwned, parcel.Area); m_log.Debug($"[ARCHIVER]: Adding parcel {parcel.Name}, local id {parcel.LocalID}, owner {parcel.OwnerID}, group {parcel.GroupID}, isGroupOwned {parcel.IsGroupOwned}, area {parcel.Area}");
landData.Add(parcel); landData.Add(parcel);
} }
m_log.InfoFormat("[ARCHIVER]: Clearing {0} parcels.", parcels.Count); m_log.Info($"[ARCHIVER]: Clearing {parcels.Count} parcels.");
bool setupDefaultParcel = (landData.Count == 0); bool setupDefaultParcel = (landData.Count == 0);
scene.LandChannel.Clear(setupDefaultParcel); scene.LandChannel.Clear(setupDefaultParcel);
@@ -974,17 +964,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver
int j = 0; int j = 0;
for (int i = 0; i < parcels.Count; i++) //if merging then we need to also add back in any existing parcels for (int i = 0; i < parcels.Count; i++) //if merging then we need to also add back in any existing parcels
{ {
if (parcels[i] != null) if (parcels[i] is not null)
{ {
landData.Add(parcels[i].LandData); landData.Add(parcels[i].LandData);
j++; j++;
} }
} }
m_log.InfoFormat("[ARCHIVER]: Keeping {0} old parcels.", j); m_log.Info($"[ARCHIVER]: Keeping {j} old parcels.");
} }
scene.EventManager.TriggerIncomingLandDataFromStorage(landData); scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
m_log.InfoFormat("[ARCHIVER]: Added {0} total parcels.", landData.Count); m_log.Info($"[ARCHIVER]: Added {landData.Count} total parcels.");
} }
/// <summary> /// <summary>
@@ -1002,7 +992,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Note: we call GetUserAccount() inside the lock because this UserID is likely // Note: we call GetUserAccount() inside the lock because this UserID is likely
// to occur many times, and we only want to query the users service once. // to occur many times, and we only want to query the users service once.
UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid); UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid);
m_validUserUuids.Add(uuid, account != null); m_validUserUuids.Add(uuid, account is not null);
} }
return m_validUserUuids[uuid]; return m_validUserUuids[uuid];
@@ -1021,7 +1011,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (!m_validGroupUuids.ContainsKey(uuid)) if (!m_validGroupUuids.ContainsKey(uuid))
{ {
bool exists; bool exists;
if (m_groupsModule == null) if (m_groupsModule is null)
{ {
exists = false; exists = false;
} }
@@ -1029,7 +1019,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
// Note: we call GetGroupRecord() inside the lock because this GroupID is likely // Note: we call GetGroupRecord() inside the lock because this GroupID is likely
// to occur many times, and we only want to query the groups service once. // to occur many times, and we only want to query the groups service once.
exists = (m_groupsModule.GetGroupRecord(uuid) != null); exists = (m_groupsModule.GetGroupRecord(uuid) is not null);
} }
m_validGroupUuids.Add(uuid, exists); m_validGroupUuids.Add(uuid, exists);
} }
@@ -1042,7 +1032,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
if (assetType == (sbyte)AssetType.Unknown) if (assetType == (sbyte)AssetType.Unknown)
{ {
m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, assetID.ToString()); m_log.Warn($"[ARCHIVER]: Importing {data.Length} byte asset {assetID} with unknown type");
} }
else if (assetType == (sbyte)AssetType.Object) else if (assetType == (sbyte)AssetType.Object)
{ {
@@ -1053,13 +1043,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
return true; return true;
}); });
if (data == null) if (data is null)
return false; return false;
} }
//m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
AssetBase asset = new AssetBase(assetID, string.Empty, assetType, UUID.Zero.ToString()); AssetBase asset = new(assetID, string.Empty, assetType, UUID.Zero.ToString())
asset.Data = data; {
Data = data
};
m_assetService.Store(asset); m_assetService.Store(asset);
return true; // not right return true; // not right
@@ -1078,21 +1070,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private bool LoadRegionSettings(Scene scene, string settingsPath, byte[] data, DearchiveScenesInfo dearchivedScenes) private bool LoadRegionSettings(Scene scene, string settingsPath, byte[] data, DearchiveScenesInfo dearchivedScenes)
{ {
RegionSettings loadedRegionSettings; RegionSettings loadedRegionSettings;
ViewerEnvironment regionEnv = null; ViewerEnvironment regionEnv;
try try
{ {
loadedRegionSettings = RegionSettingsSerializer.Deserialize(data, out regionEnv, scene.RegionInfo.EstateSettings); loadedRegionSettings = RegionSettingsSerializer.Deserialize(data, out regionEnv, scene.RegionInfo.EstateSettings);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.Error(
"[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", $"[ARCHIVER]: Could not parse region settings file {settingsPath}: {e.Message}");
settingsPath, e);
return false; return false;
} }
IEnvironmentModule mEnv = scene.RequestModuleInterface<IEnvironmentModule>(); IEnvironmentModule mEnv = scene.RequestModuleInterface<IEnvironmentModule>();
if(mEnv != null) if(mEnv is not null)
{ {
mEnv.StoreOnRegion(regionEnv); mEnv.StoreOnRegion(regionEnv);
mEnv.WindlightRefresh(0); mEnv.WindlightRefresh(0);
@@ -1144,7 +1135,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
scene.EstateDataServiceSafe?.StoreEstateSettings(scene.RegionInfo.EstateSettings); scene.EstateDataServiceSafe?.StoreEstateSettings(scene.RegionInfo.EstateSettings);
IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>(); IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
if (estateModule != null) if (estateModule is not null)
estateModule.sendRegionHandshakeToAll(); estateModule.sendRegionHandshakeToAll();
return true; return true;
@@ -1162,21 +1153,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private bool LoadTerrain(Scene scene, string terrainPath, byte[] data) private bool LoadTerrain(Scene scene, string terrainPath, byte[] data)
{ {
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
using (MemoryStream ms = new MemoryStream(data)) using MemoryStream ms = new(data);
if (!m_displacement.IsZero() || m_rotation != 0f || m_boundingBox)
{ {
if (!m_displacement.IsZero() || m_rotation != 0f || m_boundingBox) Vector2 boundingOrigin = new(m_boundingOrigin.X, m_boundingOrigin.Y);
{ Vector2 boundingSize = new(m_boundingSize.X, m_boundingSize.Y);
Vector2 boundingOrigin = new Vector2(m_boundingOrigin.X, m_boundingOrigin.Y); terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, boundingOrigin, boundingSize, ms); ;
Vector2 boundingSize = new Vector2(m_boundingSize.X, m_boundingSize.Y); }
terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, boundingOrigin, boundingSize, ms); ; else
} {
else terrainModule.LoadFromStream(terrainPath, ms);
{
terrainModule.LoadFromStream(terrainPath, ms);
}
} }
m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath); m_log.Debug($"[ARCHIVER]: Restored terrain {terrainPath}");
return true; return true;
} }
@@ -1189,10 +1179,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <param name="dearchivedScenes"></param> /// <param name="dearchivedScenes"></param>
public DearchiveScenesInfo LoadControlFile(string path, byte[] data, DearchiveScenesInfo dearchivedScenes) public DearchiveScenesInfo LoadControlFile(string path, byte[] data, DearchiveScenesInfo dearchivedScenes)
{ {
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); XmlNamespaceManager nsmgr = new(new NameTable());
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); XmlParserContext context = new(null, nsmgr, null, XmlSpace.None);
XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); XmlTextReader xtr = new(Encoding.ASCII.GetString(data), XmlNodeType.Document, context)
xtr.DtdProcessing = DtdProcessing.Ignore; {
DtdProcessing = DtdProcessing.Ignore
};
// Loaded metadata will be empty if no information exists in the archive // Loaded metadata will be empty if no information exists in the archive
dearchivedScenes.LoadedCreationDateTime = 0; dearchivedScenes.LoadedCreationDateTime = 0;
@@ -1213,17 +1205,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (majorVersion > MAX_MAJOR_VERSION) if (majorVersion > MAX_MAJOR_VERSION)
{ {
throw new Exception( throw new Exception(
string.Format( $"The OAR you are trying to load has major version number of {majorVersion} but this version can only load OARs with major version number {MAX_MAJOR_VERSION} and below");
"The OAR you are trying to load has major version number of {0} but this version of OpenSim can only load OARs with major version number {1} and below",
majorVersion, MAX_MAJOR_VERSION));
} }
m_log.InfoFormat("[ARCHIVER]: Loading OAR with version {0}", version); m_log.InfoFormat($"[ARCHIVER]: Loading OAR with version {version}");
} }
else if (xtr.Name.ToString() == "datetime") else if (xtr.Name.ToString() == "datetime")
{ {
int value; if (Int32.TryParse(xtr.ReadElementContentAsString(), out int value))
if (Int32.TryParse(xtr.ReadElementContentAsString(), out value))
dearchivedScenes.LoadedCreationDateTime = value; dearchivedScenes.LoadedCreationDateTime = value;
} }
else if (xtr.Name.ToString() == "row") else if (xtr.Name.ToString() == "row")
@@ -1248,15 +1237,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
else if (xtr.Name.ToString() == "size_in_meters") else if (xtr.Name.ToString() == "size_in_meters")
{ {
Vector3 value; string size = $"<{xtr.ReadElementContentAsString()},0>";
string size = "<" + xtr.ReadElementContentAsString() + ",0>"; if (Vector3.TryParse(size, out Vector3 value))
if (Vector3.TryParse(size, out value))
{ {
m_incomingRegionSize = value; m_incomingRegionSize = value;
if(multiRegion) if(multiRegion)
dearchivedScenes.SetRegionSize(m_incomingRegionSize); dearchivedScenes.SetRegionSize(m_incomingRegionSize);
m_log.DebugFormat("[ARCHIVER]: Found region_size info {0}", m_log.Debug($"[ARCHIVER]: Found region_size info {m_incomingRegionSize}");
m_incomingRegionSize.ToString());
} }
} }
} }
@@ -1274,7 +1261,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
} }
ControlFileLoaded = true; ControlFileLoaded = true;
if(xtr != null) if(xtr is not null)
xtr.Close(); xtr.Close();
return dearchivedScenes; return dearchivedScenes;

View File

@@ -29,7 +29,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Xml; using System.Xml;
using log4net; using log4net;
using OpenMetaverse; using OpenMetaverse;
@@ -49,7 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <summary> /// <summary>
/// Store for asset data we received before we get the metadata /// Store for asset data we received before we get the metadata
/// </summary> /// </summary>
protected Dictionary<string, byte[]> m_assetDataAwaitingMetadata = new Dictionary<string, byte[]>(); protected Dictionary<string, byte[]> m_assetDataAwaitingMetadata = new();
/// <summary> /// <summary>
/// Asset metadata. Is null if asset metadata isn't yet available. /// Asset metadata. Is null if asset metadata isn't yet available.
@@ -91,9 +90,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
m_metadata = new Dictionary<string, AssetMetadata>(); m_metadata = new Dictionary<string, AssetMetadata>();
StringReader sr = new StringReader(xml); StringReader sr = new(xml);
XmlTextReader reader = new XmlTextReader(sr); XmlTextReader reader = new(sr)
reader.DtdProcessing = DtdProcessing.Ignore; {
DtdProcessing = DtdProcessing.Ignore
};
reader.ReadStartElement("assets"); reader.ReadStartElement("assets");
reader.Read(); reader.Read();
@@ -102,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
reader.Read(); reader.Read();
AssetMetadata metadata = new AssetMetadata(); AssetMetadata metadata = new();
string filename = reader.ReadElementString("filename"); string filename = reader.ReadElementString("filename");
m_log.Debug($"[DEARCHIVER]: Reading node {filename}"); m_log.Debug($"[DEARCHIVER]: Reading node {filename}");
@@ -143,7 +144,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
protected void ResolveAssetData(string assetPath, byte[] data) protected void ResolveAssetData(string assetPath, byte[] data)
{ {
// Right now we're nastily obtaining the UUID from the filename // Right now we're nastily obtaining the UUID from the filename
string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); string filename = assetPath[ArchiveConstants.ASSETS_PATH.Length..];
if (m_metadata.ContainsKey(filename)) if (m_metadata.ContainsKey(filename))
{ {
@@ -155,9 +156,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.Debug($"[ARCHIVER]: Importing asset {filename}"); m_log.Debug($"[ARCHIVER]: Importing asset {filename}");
AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType, UUID.ZeroString); AssetBase asset = new(new UUID(filename), metadata.Name, metadata.AssetType, UUID.ZeroString)
asset.Description = metadata.Description; {
asset.Data = data; Description = metadata.Description,
Data = data
};
m_cache.Store(asset); m_cache.Store(asset);
} }