コード例 #1
0
ファイル: ModApplier.cs プロジェクト: vsafonkin/ualbion
        public object LoadAssetCached(AssetId id)
        {
            object asset = _assetCache.Get(id);

            if (asset is Exception) // If it failed to load once then stop trying (at least until an asset:reload / cycle)
            {
                return(null);
            }

            if (asset != null)
            {
                return(asset);
            }

            try
            {
                asset = LoadAssetInternal(id);
            }
            catch (Exception e)
            {
                if (CoreUtil.IsCriticalException(e))
                {
                    throw;
                }

                Raise(new LogEvent(LogEvent.Level.Error, $"Could not load asset {id}: {e}"));
                asset = e;
            }

            _assetCache.Add(asset, id);
            return(asset is Exception ? null : asset);
        }
コード例 #2
0
ファイル: ModApplier.cs プロジェクト: vsafonkin/ualbion
        public object LoadAsset(AssetId id)
        {
            try
            {
                var asset = LoadAssetInternal(id);
                return(asset is Exception ? null : asset);
            }
            catch (Exception e)
            {
                if (CoreUtil.IsCriticalException(e))
                {
                    throw;
                }

                Raise(new LogEvent(LogEvent.Level.Error, $"Could not load asset {id}: {e}"));
                return(null);
            }
        }