1 // ****************************************************************
2 // Copyright 2007, Charlie Poole
3 // This is free software licensed under the NUnit license. You may
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
5 // ****************************************************************
6 
7 using System;
8 using System.Collections;
9 
10 namespace NUnit.Util
11 {
12 	/// <summary>
13 	/// Summary description for RecentFilesCollection.
14 	/// </summary>
15 	public class RecentFilesCollection : ReadOnlyCollectionBase
16 	{
Add( RecentFileEntry entry )17 		public void Add( RecentFileEntry entry )
18 		{
19 			InnerList.Add( entry );
20 		}
21 
Insert( int index, RecentFileEntry entry )22 		public void Insert( int index, RecentFileEntry entry )
23 		{
24 			InnerList.Insert( index, entry );
25 		}
26 
Remove( string fileName )27 		public void Remove( string fileName )
28 		{
29 			int index = IndexOf( fileName );
30 			if ( index != -1 )
31 				RemoveAt( index );
32 		}
33 
RemoveAt( int index )34 		public void RemoveAt( int index )
35 		{
36 			InnerList.RemoveAt( index );
37 		}
38 
IndexOf( string fileName )39 		public int IndexOf( string fileName )
40 		{
41 			for( int index = 0; index < InnerList.Count; index++ )
42 				if ( this[index].Path == fileName )
43 					return index;
44 			return -1;
45 		}
46 
47 		public RecentFileEntry this[int index]
48 		{
49 			get { return (RecentFileEntry)InnerList[index]; }
50 		}
51 
Clear()52 		public void Clear()
53 		{
54 			InnerList.Clear();
55 		}
56 	}
57 }
58