public void Add(MostRecentFile mrf) { object sync = this.Sync; lock (sync) { if (!this.IsLoaded) { this.LoadMruList(); } if (!this.Contains(mrf.Path)) { this.files.Enqueue(mrf); while (this.files.Count > this.maxCount) { this.files.Dequeue(); } } } }
public void LoadMruList() { object sync = this.Sync; lock (sync) { try { this.isLoaded = true; this.Clear(); for (int i = 0; i < this.MaxCount; i++) { try { string str = AppSettings.Instance.File.MostRecent.Paths[i].Value; if (!string.IsNullOrWhiteSpace(str)) { byte[] buffer = AppSettings.Instance.File.MostRecent.Thumbnails[i].Value; if (buffer.Length != 0) { using (MemoryStream stream = new MemoryStream(buffer)) { Image thumb = Image.FromStream(stream); MostRecentFile mrf = new MostRecentFile(str, thumb); this.Add(mrf); } } } } catch (Exception) { } } } catch (Exception) { this.Clear(); } } }