From 95cdaf81a3292e4e48e597a748d402a2fa1cf0bc Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 15 Mar 2013 22:42:34 +0000 Subject: [PATCH] refactor: Reuse Get() method in AssetService to eliminate some copy/paste in other Get methods --- OpenSim/Services/AssetService/AssetService.cs | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 422fd0aff3..08fd3f858a 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -123,29 +123,20 @@ namespace OpenSim.Services.AssetService public virtual AssetMetadata GetMetadata(string id) { // m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id); - - UUID assetID; - if (!UUID.TryParse(id, out assetID)) - return null; + AssetBase asset = Get(id); - AssetBase asset = m_Database.GetAsset(assetID); if (asset != null) return asset.Metadata; - - return null; + else + return null; } public virtual byte[] GetData(string id) { // m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id); - - UUID assetID; - if (!UUID.TryParse(id, out assetID)) - return null; - - AssetBase asset = m_Database.GetAsset(assetID); + AssetBase asset = Get(id); if (asset != null) return asset.Data; @@ -156,17 +147,8 @@ namespace OpenSim.Services.AssetService public virtual bool Get(string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); - - UUID assetID; - 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); + handler(id, sender, Get(id)); return true; }