static void Main(string[] args) { bool exit = false; for (int i = 0; i < args.Length; ++i) { switch (args[i]) { case "-token": case "-t": if (i < args.Length - 1) { ++i; accessToken = args[i].ToLower(); } break; case "-tg": case "-tokengen": accessToken = UUID.Random().ToString(); break; case "-l": case "-list": AutomatonCommand atm = new AutomatonCommand(); string[] lines = atm.classesList().Values.ToArray().OrderBy(q => q).ToArray(); File.WriteAllLines("automaton_commands.txt", lines, Encoding.UTF8); ServiceCommand svc = new ServiceCommand(); lines = svc.classesList().Values.ToArray(); File.WriteAllLines("service_commands.txt", lines, Encoding.UTF8); exit = true; break; case "-w": case "-web": webPage = true; break; } } Console.WriteLine("----==[Access Token]==----"); Console.WriteLine(accessToken); Console.WriteLine("--------------------------"); WebServer ws = null; if (!exit) { ws = new WebServer(GetHttpResponse, url); ws.Run(); Console.WriteLine("Starting Service on " + url + ". Press a key to quit."); } string arg; //#if DEBUG /* * GridClient test = new GridClient() ; * foreach (FieldInfo p in test.Settings.GetType().GetFields()) * { * if (p.GetValue(test.Settings) != null) * { * Console.WriteLine("{0} : {1}", p.Name, p.GetValue(test.Settings).ToString()); * } * } * test = null; */ //Process.Start(url); //#endif timer = new Timer(timer_tick, null, 0, 1000); while (!exit) { arg = Console.ReadLine(); if (arg == "exit") { exit = true; } else if (arg == "help") { Console.WriteLine("THIS APPLICATION USES A WEB API, USE IT FUCKWAD."); } } if (ws != null) { ws.Stop(); } foreach (var pair in automatons) { pair.Value.Logout(); } timer.Dispose(); automatons.Clear(); }