Exemplo n.º 1
0
 public CacheItem Get(CacheComplexKey key)
 {
     return Get(key.Key, key.Size, key.Date);
 }
Exemplo n.º 2
0
 public CacheEntry<FileSystemItem> GetEntry(CacheComplexKey key)
 {
     return GetEntry(key.Key, key.Size, key.Date);
 }
Exemplo n.º 3
0
 public CacheItem GetCacheEntry(FileSystemItem item, out CacheComplexKey cacheKey)
 {
     cacheKey = GetCacheKey(item);
     return _cacheManager.Get(cacheKey);
 }
Exemplo n.º 4
0
 private CacheComplexKey GetCacheKey(FileSystemItem item)
 {
     var key = new CacheComplexKey();
     switch (item.TitleType)
     {
         case TitleType.SystemDir:
         case TitleType.SystemFile:
         case TitleType.Content:
             key.Item = item;
             key.Key = item.Name;
             break;
         case TitleType.Game:
             key.Item = item;
             key.Key = item.Type == ItemType.File ? item.Name.Replace(".gpd", string.Empty) : item.Name;
             break;
         case TitleType.Profile:
             if (item.Type == ItemType.File)
             {
                 key.Item = item;
                 key.Key = item.FullPath;
             } 
             else
             {
                 var recognition = GetProfileItem(item);
                 key.Item = recognition.Item;
                 key.Key = recognition.Path;
                 key.ErrorMessage = recognition.ErrorMessage;
             }
             break;
         case TitleType.DataFile:
             key.Item = item;
             key.Key = item.FullPath;
             break;
     }
     if (key.Item != null)
     {
         key.Size = key.Item.Size;
         key.Date = key.Item.Date;
     }
     return key;
 }
Exemplo n.º 5
0
 private CacheItem SaveDataFileCache(CacheComplexKey cacheKey, FileSystemItem item)
 {
     if (item.RecognitionState == RecognitionState.Recognized)
     {
         var svodExpiration = GetExpirationFrom(_userSettingsProvider.XboxLiveContentExpiration);
         return _userSettingsProvider.XboxLiveContentInvalidation
                    ? _cacheManager.Set(cacheKey.Key, item, svodExpiration, item.Date, item.Size)
                    : _cacheManager.Set(cacheKey.Key, item, svodExpiration);
     }
     return _cacheManager.Set(cacheKey.Key, item, GetExpirationFrom(_userSettingsProvider.UnknownContentExpiration));
 }
Exemplo n.º 6
0
 private CacheItem SaveGameCache(CacheComplexKey cacheKey, FileSystemItem item)
 {
     var gameExpiration = GetGameExpiration(item.RecognitionState);
     item.IsCached = true;
     return _cacheManager.Set(cacheKey.Key, item, GetExpirationFrom(gameExpiration));
 }
Exemplo n.º 7
0
 private CacheItem SaveProfileCache(CacheComplexKey cacheKey, FileSystemItem item, byte[] content)
 {
     var profileExpiration = GetExpirationFrom(_userSettingsProvider.ProfileExpiration);
     item.IsCached = true;
     var cacheItem = _userSettingsProvider.ProfileInvalidation
                     ? _cacheManager.Set(cacheKey.Key, item, profileExpiration, cacheKey.Date, cacheKey.Size, content)
                     : _cacheManager.Set(cacheKey.Key, item, profileExpiration);
     _cacheManager.Set(item.Name, item);
     return cacheItem;
 }