From 4bd164b6b248af81691e776358f6185522d265c2 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Mon, 17 Jan 2011 02:40:08 +0000 Subject: [PATCH] RecentFiles class - don't exceed the MAX_FILES value --- BizHawk.MultiClient/MainForm.cs | 5 +---- BizHawk.MultiClient/RecentFiles.cs | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 7c8d988c71..a7e7881eab 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -609,13 +609,10 @@ namespace BizHawk.MultiClient { for (int x = 0; x < RecentRoms.Length(); x++) { - recentROMToolStripMenuItem.DropDownItems.Add(RecentRoms.GetRecentFileByPosition(x)); + recentROMToolStripMenuItem.DropDownItems.Add(RecentRoms.GetRecentFileByPosition(x)); //TODO: truncate this to a nice size } } recentROMToolStripMenuItem.DropDownItems.Add("Clear"); - - //MenuItem recent1 = new MenuItem("test"); - //recentROMToolStripMenuItem.DropDownItems.Add("testme"); } } } \ No newline at end of file diff --git a/BizHawk.MultiClient/RecentFiles.cs b/BizHawk.MultiClient/RecentFiles.cs index 462463e361..5bd1ebdc28 100644 --- a/BizHawk.MultiClient/RecentFiles.cs +++ b/BizHawk.MultiClient/RecentFiles.cs @@ -44,6 +44,8 @@ namespace BizHawk.MultiClient } } recentlist.Add(newFile); + if (recentlist.Count > MAX_RECENT_FILES) + recentlist.Remove(recentlist[0]); } public bool Remove(string newFile)