/// <summary> /// Initializes the WebServer /// </summary> internal static void Main() { Thread checkThread = new Thread(new ThreadStart(CheckConfigFile)); checkThread.Start(); server = new WebServer(); }
/// <summary> /// Checks the configuration file every second to see if it has been updated. /// If it has been, it reloads the configuration file. /// </summary> internal static void CheckConfigFile() { string cnf = DEFAULT_CONFIG_PATH + DEFAULT_CONFIG_FILE; DateTime lastTime = File.GetLastWriteTime(cnf); while (true) { if (File.GetLastWriteTime(cnf) != lastTime) { try { Console.Clear(); } catch (IOException) { } Console.WriteLine("Config File Updated. Reloading."); if (server != null) { server.Close(); server = new WebServer(); } lastTime = File.GetLastWriteTime(cnf); } Thread.Sleep(1000); } }