Fix all CreateInstance overloads for void
[mcs.git] / nunit24 / ClientUtilities / util / RecentFileEntry.cs
blob0813fd7d76c94924d8a0d49123c7a9bf859cef59
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 // ****************************************************************
7 using System;
9 namespace NUnit.Util
11 public class RecentFileEntry
13 public static readonly char Separator = ',';
15 private string path;
17 private Version clrVersion;
19 public RecentFileEntry( string path )
21 this.path = path;
22 this.clrVersion = Environment.Version;
25 public RecentFileEntry( string path, Version clrVersion )
27 this.path = path;
28 this.clrVersion = clrVersion;
31 public string Path
33 get { return path; }
36 public Version CLRVersion
38 get { return clrVersion; }
41 public bool Exists
43 get { return path != null && System.IO.File.Exists( path ); }
46 public bool IsCompatibleCLRVersion
48 get { return clrVersion.Major <= Environment.Version.Major; }
51 public override string ToString()
53 return Path + Separator + CLRVersion.ToString();
56 public static RecentFileEntry Parse( string text )
58 int sepIndex = text.LastIndexOf( Separator );
60 if ( sepIndex > 0 )
61 try
63 return new RecentFileEntry( text.Substring( 0, sepIndex ),
64 new Version( text.Substring( sepIndex + 1 ) ) );
66 catch
68 //The last part was not a version, so fall through and return the whole text
71 return new RecentFileEntry( text );