Exemple #1
0
        public ImageCacher(ILocalImageCache localRunner)
        {
            this.localRunner = localRunner;
            LocalStorageRunner.QueueSpeed queueSpeed = this.GetQueueSpeed();
            this.localRunner.Init(queueSpeed);
            ImageCacher.UnloaderType unloaderType = this.GetUnloaderType();
            FMLogger.vCore(string.Concat(new object[]
            {
                "buffer type: ",
                unloaderType,
                " queue speed: ",
                queueSpeed
            }));
            switch (unloaderType)
            {
            case ImageCacher.UnloaderType.LowEnd:
                this.unloader = new LowEndUnloadBehaviour(this.cached, localRunner);
                break;

            case ImageCacher.UnloaderType.MidEnd:
                this.unloader = new MidEndUnloadBehaviour(this.cached, localRunner);
                break;

            case ImageCacher.UnloaderType.HighEnd:
                this.unloader = new HighEndUnloadBehaviour(this.cached, localRunner);
                break;

            default:
                this.unloader = new LowEndUnloadBehaviour(this.cached, localRunner);
                break;
            }
        }
Exemple #2
0
 public void Run(ILocalImageCache localRunner)
 {
     this.worker = new IconDownloadTask(this.initial.BaseUrls, this.initial.RelativeUrl, this.initial.CacheKey, delegate(bool success, Texture2D tex)
     {
         this.Tex = tex;
         if (this.Tex != null)
         {
             localRunner.MakeLocalCopy(this.initial.CacheKey, this.Tex);
         }
         this.ReportResults();
     });
     localRunner.HasLocalCopy(this.worker.CacheKey, delegate(Texture2D tex)
     {
         if (!this.worker.IsCanceled)
         {
             if (tex != null)
             {
                 this.worker.Result(true, tex);
             }
             else
             {
                 this.worker.AddHandlerOnCancelation(new Action <string, Texture2D>(localRunner.Recycle));
                 WebLoader.Instance.DownloadIcon(this.worker);
             }
         }
         else if (tex != null)
         {
             localRunner.DestroyTex(tex, false);
         }
     });
 }
 public void Run(ILocalImageCache localRunner)
 {
     localRunner.LoadLocalIcon(this.initial.Path, delegate(Texture2D tex)
     {
         base.Tex = tex;
         this.ReportResults();
     });
 }
Exemple #4
0
 public HighEndUnloadBehaviour(List <CacheImage> cached, ILocalImageCache localRunner)
 {
     this.cached      = cached;
     this.localRunner = localRunner;
 }
Exemple #5
0
 public ImageCache(ILocalImageCache localCache)
 {
     _localCache = localCache;
 }