cosmetics

This commit is contained in:
UbitUmarov
2022-10-14 02:51:28 +01:00
parent 3b40bb4586
commit 84f39d04d1
3 changed files with 14 additions and 26 deletions

View File

@@ -126,8 +126,8 @@ namespace OpenSim.Framework.Serialization
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ASSET_EXTENSION_SEPARATOR + "texture.jp2";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ASSET_EXTENSION_SEPARATOR + "texture.tga";
ASSET_TYPE_TO_EXTENSION[(sbyte)OpenSimAssetType.Material] = ASSET_EXTENSION_SEPARATOR + "material.xml";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Material] = ASSET_EXTENSION_SEPARATOR + "prmat.dat";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Settings] = ASSET_EXTENSION_SEPARATOR + "settings.bin";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Material] = ASSET_EXTENSION_SEPARATOR + "prmat.dat";
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "animation.bvh"] = (sbyte)AssetType.Animation;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bodypart.txt"] = (sbyte)AssetType.Bodypart;

View File

@@ -125,30 +125,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// It appears that gtar, at least, doesn't need the intermediate directory entries in the tar
//archive.AddDir("assets");
string extension = string.Empty;
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.TryGetValue(asset.Type, out string extension))
{
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
m_archiveWriter.WriteFile($"{ArchiveConstants.ASSETS_PATH}{asset.FullID}{extension}", asset.Data);
}
else
{
m_log.ErrorFormat(
"[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded",
asset.Type, asset.ID);
m_log.Error(
$"[ARCHIVER]: Unrecognized asset type {asset.Type} with uuid {asset.ID}. This asset will be saved but may not load");
m_archiveWriter.WriteFile($"{ArchiveConstants.ASSETS_PATH}{asset.FullID}", asset.Data);
}
m_archiveWriter.WriteFile(
ArchiveConstants.ASSETS_PATH + asset.FullID.ToString() + extension,
asset.Data);
m_assetsWritten++;
//m_log.DebugFormat("[ARCHIVER]: Added asset {0}", m_assetsWritten);
if (m_assetsWritten % LOG_ASSET_LOAD_NOTIFICATION_INTERVAL == 0)
m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", m_assetsWritten);
m_log.Info($"[ARCHIVER]: Added {m_assetsWritten} assets to archive");
}
}
}

View File

@@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
AssetMetadata metadata = new AssetMetadata();
string filename = reader.ReadElementString("filename");
m_log.DebugFormat("[DEARCHIVER]: Reading node {0}", filename);
m_log.Debug($"[DEARCHIVER]: Reading node {filename}");
metadata.Name = reader.ReadElementString("name");
metadata.Description = reader.ReadElementString("description");
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
reader.Read();
}
m_log.DebugFormat("[DEARCHIVER]: Resolved {0} items of asset metadata", m_metadata.Count);
m_log.Debug($"[DEARCHIVER]: Resolved {m_metadata.Count} items of asset metadata");
ResolvePendingAssetData();
}
@@ -148,16 +148,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (m_metadata.ContainsKey(filename))
{
AssetMetadata metadata = m_metadata[filename];
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(metadata.AssetType))
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.TryGetValue(metadata.AssetType, out string extension))
{
string extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[metadata.AssetType];
filename = filename.Remove(filename.Length - extension.Length);
}
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
m_log.Debug($"[ARCHIVER]: Importing asset {filename}");
AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType, UUID.Zero.ToString());
AssetBase asset = new AssetBase(new UUID(filename), metadata.Name, metadata.AssetType, UUID.ZeroString);
asset.Description = metadata.Description;
asset.Data = data;
@@ -165,9 +163,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
else
{
m_log.ErrorFormat(
"[DEARCHIVER]: Tried to dearchive data with filename {0} without any corresponding metadata",
assetPath);
m_log.Error(
$"[DEARCHIVER]: Tried to dearchive data with filename {assetPath} without any corresponding metadata");
}
}