当前位置: 首页>>代码示例>>C#>>正文


C# AssetRetrieved类代码示例

本文整理汇总了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;
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:8,代码来源:AssetService.cs

示例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);
     });
 }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:10,代码来源:IWCAssetConnector.cs

示例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;
        }
开发者ID:MAReantals,项目名称:opensim,代码行数:67,代码来源:AssetServicesConnector.cs

示例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;
        }
开发者ID:AlexRa,项目名称:opensim-mods-Alex,代码行数:32,代码来源:AssetServiceConnector.cs

示例5: Get

 public override void Get(string id, object sender, AssetRetrieved handler)
 {
     base.Get(id, sender, handler);
 }
开发者ID:JAllard,项目名称:HyperGrid,代码行数:4,代码来源:HGAssetService.cs

示例6: Get

 public bool Get(string id, object sender, AssetRetrieved handler)
 {
     handler(id, sender, Get(id));
     
     return true;
 }
开发者ID:intari,项目名称:OpenSimMirror,代码行数:6,代码来源:TestAssetService.cs

示例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); });
            });
        }
开发者ID:dirkhusemann,项目名称:opensim,代码行数:21,代码来源:LocalAssetServiceConnector.cs

示例8: Get

 public bool Get(string id, object sender, AssetRetrieved handler)
 {
     throw new NotImplementedException();
 }
开发者ID:ChrisD,项目名称:opensim,代码行数:4,代码来源:TestAssetService.cs

示例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);
                });
            }
        }
开发者ID:KristenMynx,项目名称:Aurora-Sim,代码行数:40,代码来源:HGAssetServiceConnector.cs

示例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);
        }
开发者ID:EnricoNirvana,项目名称:Aurora-HG-Plugin,代码行数:12,代码来源:HGAssetService.cs

示例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;
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:15,代码来源:AssetService.cs

示例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;
        }
开发者ID:TomDataworks,项目名称:opensim,代码行数:45,代码来源:AssetServicesConnector.cs

示例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);
            });
        }
开发者ID:ChrisD,项目名称:opensim,代码行数:21,代码来源:LocalAssetServiceConnector.cs

示例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 ();
     }
 }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:8,代码来源:FileBasedAssetService.cs

示例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");
            });
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:28,代码来源:LocalAssetServiceConnector.cs


注:本文中的AssetRetrieved类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。