// Main.cs created with MonoDevelop
// User: Lukas ELsner at 2:24 PM 9/2/2008

using System;
using System.IO;
using System.Diagnostics;

namespace footnotesort
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			
			if(args.Length > 0) 
			{
				Footnotesorter fns = null;
				try
				{
					/* Create new footnotesorter with filename to sort as parameter (Catch thrown Exception if file not existing) */
					fns = new Footnotesorter(args[0]);
				}
				catch (FileNotFoundException fnfex) { Console.WriteLine(fnfex.Message + ": " + fnfex.FileName); }
				
				if(fns != null)
				{
					/* Process the given file and get the needed time */
					Stopwatch watch = new Stopwatch();
					watch.Start();
					fns.ParseFile();
					watch.Stop();
					Console.WriteLine("Time spent: " + watch.Elapsed);
				}
			}
			else
				Console.WriteLine("No inputfile specified");
		}
	}
}