// Make room for image if needed (because of cache limits)
 private static void ExpireCacheEntries()
 {
     while (CacheFull)
     {
         string oldestUrl = null;
         CachedAssetStoreImage oldestEntry = null;
         foreach (KeyValuePair <string, CachedAssetStoreImage> kv in CachedAssetStoreImages)
         {
             if (oldestEntry == null || oldestEntry.lastUsed > kv.Value.lastUsed)
             {
                 oldestEntry = kv.Value;
                 oldestUrl   = kv.Key;
             }
         }
         CachedAssetStoreImages.Remove(oldestUrl);
         Instance.m_CacheRemove++;
         if (oldestEntry == null)
         {
             Debug.LogError("Null entry found while removing cache entry");
             break;
         }
         if (oldestEntry.client != null)
         {
             oldestEntry.client.Abort();
             oldestEntry.client = null;
         }
         if (oldestEntry.image != null)
         {
             Object.DestroyImmediate(oldestEntry.image);
         }
     }
 }
 private static void ExpireCacheEntries()
 {
     while (CacheFull)
     {
         string key = null;
         CachedAssetStoreImage image = null;
         foreach (KeyValuePair <string, CachedAssetStoreImage> pair in CachedAssetStoreImages)
         {
             if ((image == null) || (image.lastUsed > pair.Value.lastUsed))
             {
                 image = pair.Value;
                 key   = pair.Key;
             }
         }
         CachedAssetStoreImages.Remove(key);
         AssetStorePreviewManager instance = Instance;
         instance.m_CacheRemove++;
         if (image == null)
         {
             Debug.LogError("Null entry found while removing cache entry");
             break;
         }
         if (image.client != null)
         {
             image.client.Abort();
             image.client = null;
         }
         if (image.image != null)
         {
             UnityEngine.Object.DestroyImmediate(image.image);
         }
     }
 }