public ImageContainer GetExistingContainer(FileListEntry key)
 {
     lock (this.cache)
     {
         this.cache.TryGetValue(key, out ImageContainer container);
         return(container);
     }
 }
Exemplo n.º 2
0
 private bool TryGetFile(int index, out FileListEntry file)
 {
     if (this.currentFileList == null || index < 0 || index >= this.currentFileList.Count)
     {
         file = null;
         return(false);
     }
     file = this.currentFileList[index];
     return(true);
 }
 public ImageContainer GetOrCreateContainer(FileListEntry key)
 {
     lock (this.cache)
     {
         if (!this.cache.TryGetValue(key, out ImageContainer container))
         {
             container = new ImageContainer(this, key);
             this.cache.Add(key, container);
         }
         return(container);
     }
 }
Exemplo n.º 4
0
        private CacheWorkItem GetCacheWorkItemForCurrentDisplayIndex()
        {
            var items = new FileListEntry[fileLoadOrder.Length];
            var list  = this.currentFileList;

            for (int i = 0; i < items.Length; ++i)
            {
                int offset             = fileLoadOrder[i];
                int index              = this.currentDisplayIndex + offset;
                int tmp_wrapped_around = index % list.Count;
                if (tmp_wrapped_around < 0)
                {
                    tmp_wrapped_around += list.Count;
                }
                items[i] = list[tmp_wrapped_around];
            }
            return(new CacheWorkItem(items[0], items));
        }
Exemplo n.º 5
0
 public OverviewFileListEntry(FileListEntry fileListEntry)
 {
     Debug.Assert(fileListEntry != null);
     this.fileListEntry = fileListEntry;
     this.fileName      = Path.GetFileName(this.fileListEntry.FullPath);
 }
 internal ImageContainer(ImageCache owner, FileListEntry key)
 {
     this.Key   = key ?? throw new ArgumentNullException(nameof(key));
     this.owner = owner ?? throw new ArgumentNullException(nameof(owner));
 }
 public ImageContainer GetOrCreateContainer(FileListEntry key)
 {
     return(this.imageCache.GetOrCreateContainer(key));
 }
 public CacheWorkItem(FileListEntry displayPath, FileListEntry[] surroundingPaths)
 {
     this.DisplayPath      = displayPath;
     this.SurroundingPaths = surroundingPaths;
 }