refactor: Reuse Get() method in AssetService to eliminate some copy/paste in other Get methods
parent
bd0c1d9b6a
commit
45dee383db
|
@ -124,15 +124,11 @@ namespace OpenSim.Services.AssetService
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id);
|
// m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id);
|
||||||
|
|
||||||
UUID assetID;
|
AssetBase asset = Get(id);
|
||||||
|
|
||||||
if (!UUID.TryParse(id, out assetID))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
AssetBase asset = m_Database.GetAsset(assetID);
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset.Metadata;
|
return asset.Metadata;
|
||||||
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,12 +136,7 @@ namespace OpenSim.Services.AssetService
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id);
|
// m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id);
|
||||||
|
|
||||||
UUID assetID;
|
AssetBase asset = Get(id);
|
||||||
|
|
||||||
if (!UUID.TryParse(id, out assetID))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
AssetBase asset = m_Database.GetAsset(assetID);
|
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
return asset.Data;
|
return asset.Data;
|
||||||
|
@ -157,16 +148,7 @@ namespace OpenSim.Services.AssetService
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[AssetService]: Get asset async {0}", id);
|
//m_log.DebugFormat("[AssetService]: Get asset async {0}", id);
|
||||||
|
|
||||||
UUID assetID;
|
handler(id, sender, Get(id));
|
||||||
|
|
||||||
if (!UUID.TryParse(id, out assetID))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
AssetBase asset = m_Database.GetAsset(assetID);
|
|
||||||
|
|
||||||
//m_log.DebugFormat("[AssetService]: Got asset {0}", asset);
|
|
||||||
|
|
||||||
handler(id, sender, asset);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue