public byte[] GetData(string id) { if (m_Cache != null) { Aurora.Framework.AssetBase fullAsset = m_Cache.Get(id); if (fullAsset != null) return fullAsset.Data; } List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AssetServerURI"); if (m_serverURL != string.Empty) serverURIs = new List<string>(new string[1] { m_serverURL }); foreach (string m_ServerURI in serverURIs) { RestClient rc = new RestClient(m_ServerURI); rc.AddResourcePath("assets"); rc.AddResourcePath(id); rc.AddResourcePath("data"); rc.RequestMethod = "GET"; System.IO.Stream s = rc.Request(); if (s == null) return null; if (s.Length > 0) { byte[] ret = new byte[s.Length]; s.Read(ret, 0, (int)s.Length); return ret; } } return null; }
public virtual byte[] GetData(string id) { if (m_Cache != null) { AssetBase fullAsset = m_Cache.Get(id); if (fullAsset != null) return fullAsset.Data; } List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AssetServerURI"); if (m_serverURL != string.Empty) serverURIs = new List<string>(new string[1] {m_serverURL}); #if (!ISWIN) foreach (string mServerUri in serverURIs) { RestClient rc = new RestClient(mServerUri); rc.AddResourcePath("assets"); rc.AddResourcePath(id); rc.AddResourcePath("data"); rc.RequestMethod = "GET"; Stream s = rc.Request(); if (s == null) return null; if (s.Length > 0) { byte[] ret = new byte[s.Length]; s.Read(ret, 0, (int) s.Length); return ret; } } #else foreach (RestClient rc in serverURIs.Select(m_ServerURI => new RestClient(m_ServerURI))) { rc.AddResourcePath("assets"); rc.AddResourcePath(id); rc.AddResourcePath("data"); rc.RequestMethod = "GET"; Stream s = rc.Request(); if (s == null) return null; if (s.Length > 0) { byte[] ret = new byte[s.Length]; s.Read(ret, 0, (int) s.Length); return ret; } } #endif return null; }