private static void HandleProject() { var info = new[] { "available commands: ", "new <name> <basedir>", "add <filename>", "save", "instrument", "q - quit" }; string cmd = ""; Projects.Project current = null; while (cmd != "q") { foreach (var i in info) Console.WriteLine(" # " + i); Console.WriteLine(" # {0}", current != null ? "current project: " + current.Name : "no project loaded"); cmd = Console.ReadLine().Trim(); var tokens = cmd.SplitArguments(); try { switch (tokens.First()) { case "new": current = new Projects.Project(tokens[1], tokens[2]); break; case "add": if (current == null) Console.WriteLine("No project loaded"); else current.AddFile(tokens[1]); break; case "save": if (current == null) Console.WriteLine("No project loaded"); else current.SaveToFile(Path.Combine(current.BaseDir, "eyedisposable.proj")); break; case "instrument": current.Instrument(); break; case "load": current = Project.LoadFromFile(tokens[1]); break; } } catch (Exception e) { Console.WriteLine(e.ToString()); } } }
private static void HandleProject() { var info = new[] { "available commands: ", "new <name> <basedir>", "add <filename>", "save", "instrument", "q - quit" }; string cmd = ""; Projects.Project current = null; while (cmd != "q") { foreach (var i in info) { Console.WriteLine(" # " + i); } Console.WriteLine(" # {0}", current != null ? "current project: " + current.Name : "no project loaded"); cmd = Console.ReadLine().Trim(); var tokens = cmd.SplitArguments(); try { switch (tokens.First()) { case "new": current = new Projects.Project(tokens[1], tokens[2]); break; case "add": if (current == null) { Console.WriteLine("No project loaded"); } else { current.AddFile(tokens[1]); } break; case "save": if (current == null) { Console.WriteLine("No project loaded"); } else { current.SaveToFile(Path.Combine(current.BaseDir, "eyedisposable.proj")); } break; case "instrument": current.Instrument(); break; case "load": current = Project.LoadFromFile(tokens[1]); break; } } catch (Exception e) { Console.WriteLine(e.ToString()); } } }