本文整理汇总了C#中AssetRetrieved类的典型用法代码示例。如果您正苦于以下问题:C# AssetRetrieved类的具体用法?C# AssetRetrieved怎么用?C# AssetRetrieved使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssetRetrieved类属于命名空间,在下文中一共展示了AssetRetrieved类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public virtual bool Get(string id, Object sender, AssetRetrieved handler)
{
//m_log.DebugFormat("[AssetService]: Get asset async {0}", id);
handler(id, sender, Get(id));
return true;
}
示例2: Get
public void Get(string id, object sender, AssetRetrieved handler)
{
m_localService.Get(id, sender, delegate(string idd, object senderr, AssetBase asset)
{
if (asset == null)
handler(id, sender, Get(id));
else
handler(id, sender, asset);
});
}
示例3: Get
public bool Get(string id, Object sender, AssetRetrieved handler)
{
// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id);
string uri = m_ServerURI + "/assets/" + id;
AssetBase asset = null;
if (m_Cache != null)
asset = m_Cache.Get(id);
if (asset == null)
{
lock (m_AssetHandlers)
{
AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); });
AssetRetrievedEx handlers;
if (m_AssetHandlers.TryGetValue(id, out handlers))
{
// Someone else is already loading this asset. It will notify our handler when done.
handlers += handlerEx;
return true;
}
// Load the asset ourselves
handlers += handlerEx;
m_AssetHandlers.Add(id, handlers);
}
bool success = false;
try
{
AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0,
delegate(AssetBase a)
{
if (m_Cache != null)
m_Cache.Cache(a);
AssetRetrievedEx handlers;
lock (m_AssetHandlers)
{
handlers = m_AssetHandlers[id];
m_AssetHandlers.Remove(id);
}
handlers.Invoke(a);
}, 30);
success = true;
}
finally
{
if (!success)
{
lock (m_AssetHandlers)
{
m_AssetHandlers.Remove(id);
}
}
}
}
else
{
handler(id, sender, asset);
}
return true;
}
示例4: Get
public bool Get(string id, Object sender, AssetRetrieved handler)
{
string uri = m_ServerURI + "/assets/" + id;
AssetBase asset = null;
if (m_Cache != null)
asset = m_Cache.Get(id);
if (asset == null)
{
bool result = false;
AsynchronousRestObjectRequester.
MakeRequest<int, AssetBase>("GET", uri, 0,
delegate(AssetBase a)
{
if (m_Cache != null)
m_Cache.Cache(a);
handler(id, sender, a);
result = true;
});
return result;
}
else
{
//Util.FireAndForget(delegate { handler(id, sender, asset); });
handler(id, sender, asset);
}
return true;
}
示例5: Get
public override void Get(string id, object sender, AssetRetrieved handler)
{
base.Get(id, sender, handler);
}
示例6: Get
public bool Get(string id, object sender, AssetRetrieved handler)
{
handler(id, sender, Get(id));
return true;
}
示例7: Get
public bool Get(string id, Object sender, AssetRetrieved handler)
{
AssetBase asset = null;
if (m_Cache != null)
m_Cache.Get(id);
if (asset != null)
{
Util.FireAndForget(delegate { handler(id, sender, asset); });
return true;
}
return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
{
if ((a != null) && (m_Cache != null))
m_Cache.Cache(a);
Util.FireAndForget(delegate { handler(assetID, s, a); });
});
}
示例8: Get
public bool Get(string id, object sender, AssetRetrieved handler)
{
throw new NotImplementedException();
}
示例9: Get
public override bool Get(string id, Object sender, AssetRetrieved handler)
{
AssetBase asset = null;
if (m_Cache != null)
asset = m_Cache.Get(id);
if (asset != null)
{
Util.FireAndForget(delegate { handler(id, sender, asset); });
return true;
}
if (IsHG(id))
{
string url = string.Empty;
string assetID = string.Empty;
if (StringToUrlAndAssetID(id, out url, out assetID))
{
IAssetService connector = GetConnector(url);
return connector.Get(assetID, sender, delegate(string newAssetID, Object s, AssetBase a)
{
if (m_Cache != null)
m_Cache.Cache(a);
handler(assetID, s, a);
});
}
return false;
}
else
{
return base.Get(id, sender, delegate(string assetID, Object s, AssetBase a)
{
if (m_Cache != null)
m_Cache.Cache(a);
handler(assetID, s, a);
});
}
}
示例10: Get
public override bool Get(string id, object sender, AssetRetrieved handler)
{
string url = string.Empty;
string assetID = string.Empty;
if (StringToUrlAndAssetID (id, out url, out assetID))
{
IAssetService connector = GetConnector (url);
return connector.Get (assetID, sender, handler);
}
return base.Get (id, sender, handler);
}
示例11: Get
public virtual bool Get(String id, Object sender, AssetRetrieved handler)
{
//MainConsole.Instance.DebugFormat("[AssetService]: Get asset async {0}", id);
AssetBase asset = m_database.GetAsset(UUID.Parse(id));
IImprovedAssetCache cache = m_registry.RequestModuleInterface<IImprovedAssetCache>();
if (cache != null && asset != null && asset.Data.Length != 0)
cache.Cache(asset);
//MainConsole.Instance.DebugFormat("[AssetService]: Got asset {0}", asset);
handler(id, sender, asset);
return true;
}
示例12: Get
public bool Get(string id, Object sender, AssetRetrieved handler)
{
string uri = MapServer(id) + "/assets/" + id;
AssetBase asset = null;
if (m_Cache != null)
asset = m_Cache.Get(id);
if (asset == null || asset.Data == null || asset.Data.Length == 0)
{
lock (m_AssetHandlers)
{
AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); });
// AssetRetrievedEx handlers;
List<AssetRetrievedEx> handlers;
if (m_AssetHandlers.TryGetValue(id, out handlers))
{
// Someone else is already loading this asset. It will notify our handler when done.
// handlers += handlerEx;
handlers.Add(handlerEx);
return true;
}
// Load the asset ourselves
// handlers += handlerEx;
handlers = new List<AssetRetrievedEx>();
handlers.Add(handlerEx);
m_AssetHandlers.Add(id, handlers);
}
QueuedAssetRequest request = new QueuedAssetRequest();
request.id = id;
request.uri = uri;
m_requestQueue.Enqueue(request);
}
else
{
handler(id, sender, asset);
}
return true;
}
示例13: Get
public bool Get(string id, Object sender, AssetRetrieved handler)
{
AssetBase asset = null;
if (m_Cache != null)
m_Cache.Get(id);
if (asset != null)
{
handler.BeginInvoke(id, sender, asset, null, null);
return true;
}
return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
{
if ((a != null) && (m_Cache != null))
m_Cache.Cache(a);
handler.BeginInvoke(assetID, s, a, null, null);
});
}
示例14: Get
public virtual void Get (string id, object sender, AssetRetrieved handler)
{
var asset = Get (id);
if (asset != null) {
Util.FireAndForget ((o) => {handler (id, sender, asset);});
//asset.Dispose ();
}
}
示例15: Get
public bool Get(string id, Object sender, AssetRetrieved handler)
{
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Asynchronously requesting asset {0}", id);
if (m_Cache != null)
{
AssetBase asset = m_Cache.Get(id);
if (asset != null)
{
Util.FireAndForget(
o => handler(id, sender, asset), null, "LocalAssetServiceConnector.GotFromCacheCallback");
return true;
}
}
return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
{
if ((a != null) && (m_Cache != null))
m_Cache.Cache(a);
// if (null == a)
// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
Util.FireAndForget(
o => handler(assetID, s, a), null, "LocalAssetServiceConnector.GotFromServiceCallback");
});
}