~ubuntu-branches/debian/sid/nunit/sid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// ****************************************************************
// Copyright 2007, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org
// ****************************************************************

using System;
using System.Collections;

namespace NUnit.Util
{
	/// <summary>
	/// Summary description for RecentFilesCollection.
	/// </summary>
	public class RecentFilesCollection : ReadOnlyCollectionBase
	{
		public void Add( RecentFileEntry entry )
		{
			InnerList.Add( entry );
		}

		public void Insert( int index, RecentFileEntry entry )
		{
			InnerList.Insert( index, entry );
		}

		public void Remove( string fileName )
		{
			int index = IndexOf( fileName );
			if ( index != -1 )
				RemoveAt( index );
		}

		public void RemoveAt( int index )
		{
			InnerList.RemoveAt( index );
		}

		public int IndexOf( string fileName )
		{
			for( int index = 0; index < InnerList.Count; index++ )
				if ( this[index].Path == fileName )
					return index;
			return -1;
		}

		public RecentFileEntry this[int index]
		{
			get { return (RecentFileEntry)InnerList[index]; }
		}

		public void Clear()
		{
			InnerList.Clear();
		}
	}
}