diff --git a/TMI-practicum/Program.cs b/TMI-practicum/Program.cs index 51ea75e..d28a9d3 100644 --- a/TMI-practicum/Program.cs +++ b/TMI-practicum/Program.cs @@ -1,4 +1,5 @@ using System; +using System.IO; namespace TMI_practicum { @@ -6,7 +7,41 @@ namespace TMI_practicum { public static void Main(string[] args) { + if (args.Length < 1) + { + Console.WriteLine("Please enter a file."); + Environment.Exit(1); + } + + if (!File.Exists(args[0])) + { + Console.WriteLine("File {0} not found.", args[0]); + Environment.Exit(1); + } + Console.WriteLine("HOOOOOOOOOOOIIII"); } + + + private static void ParseFile(string path) + { + + int algoritme = 0; + int nbCircles = 0; + + using (StreamReader file = new StreamReader(path)) + { + if (!int.TryParse(file.ReadLine(), out algoritme) || !int.TryParse(file.ReadLine(), out nbCircles)) + { + throw new ArgumentException("An error occured parsing the input file."); + } + + string line; + while ((line = file.ReadLine()) != null) + { + line.Split(' '); + } + } + } } } \ No newline at end of file diff --git a/TMI-practicum/TMI-practicum.csproj b/TMI-practicum/TMI-practicum.csproj index 3077a34..e64941e 100644 --- a/TMI-practicum/TMI-practicum.csproj +++ b/TMI-practicum/TMI-practicum.csproj @@ -33,15 +33,23 @@ 4 + + + ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll + True + + + +