/// <summary> /// Start App /// </summary> /// <param name="isConsole"></param> public static void Start(bool isConsole, string[] cmds) { if (isConsole) { Console.Title = "RobotBum\n"; Console.WriteLine("-RobotBum-\n"); Console.WriteLine("Starting...\n"); } startDateTime = DateTime.Now; hoursToNextTwitterMediumAlertPost = 9; nextTimeTwitterMediumAlertPost = DateTime.Now.AddHours(hoursToNextTwitterMediumAlertPost); twitterManager = new TwitterManager(); strPath = "logs"; bool exists = System.IO.Directory.Exists(strPath); if (!exists) { System.IO.Directory.CreateDirectory(strPath); } #if DEBUG // Quick test line. //cmds = new List<string>() { "-AirportICAO","SBBR", // "-ModeSMixerURL","http://bsbradar.ddns.net:8081", // "-URLServerFolder","server" , // "-ShowAllCruisesHeavyWeight","1" , // "-AvoidAllFlightsStartingWith","\"GLO,GOL,TAM\"", // "-ShowAllFlightStartingWith","\"EK,DAL\"", // "-AvoidAllModelsStartingWith","A32,B73", // "-ShowAllModelsStartingWith","\"EK,DAL\"", // "-ShowHelicopters","1", // "-User","bsb", // "-Password","aero", // "-MessageLanguage","en-PIRATE", //}.ToArray(); #endif var commandsAnalyse = AnalyseCommands(cmds); if (!String.IsNullOrEmpty(commandsAnalyse)) { Console.WriteLine(commandsAnalyse); Console.WriteLine("Closing application..."); return; } Radar radar = GetRadarAndSetCommands(cmds); try { Radar.AddRadar(radar); } catch (ArgumentException e) { Console.WriteLine(e.Message); return; } catch (Exception e) { throw e; } var autoEvent = new AutoResetEvent(false); var timer = new System.Threading.Timer(new TimerCallback(CheckStatus), null, new TimeSpan(0), new TimeSpan(1, 0, 10)); if (isConsole) { while (true) { switch (Console.ReadLine()) { case "log on": showUpdates = true; nConsoleUpdates = 0; Console.WriteLine("Starting log...\n"); break; case "log off": nConsoleUpdates = 0; showUpdates = false; Console.WriteLine("Log done.\n"); break; case "updateall": isToForceUpdateAll = true; Console.WriteLine("Forcing updates...\n"); break; case "online": Console.WriteLine("Online time:{0}\n", DateTime.Now - startDateTime); break; case "twitter on": isTwitterActive = true; Console.WriteLine("Twitter actived.\n"); break; case "twitter off": isTwitterActive = false; Console.WriteLine("Twitter desactived.\n"); break; case "refresh": PluginsManager.RefreshAll(); Console.WriteLine("Cache cleaned.\n"); break; case "plugins": PluginsManager.AccessPluginCommandLine(); break; case "help": Console.WriteLine("- log on/off"); Console.WriteLine("- updateall"); Console.WriteLine("- online"); Console.WriteLine("- refresh"); Console.WriteLine("- Plugins"); break; case "exit": Environment.Exit(0); break; default: Console.WriteLine("\nComando desconhecido.\n"); break; } } } }