static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.DarkBlue; Console.ForegroundColor = ConsoleColor.White; Console.Clear(); int port = 8181; if (args.Length == 1) { Int32.TryParse(args[0], out port); } if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "Files"))) { Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "Files")); } HostConfiguration config = new HostConfiguration(); config.UrlReservations.CreateAutomatically = true; config.UrlReservations.User = new System.Security.Principal.SecurityIdentifier("S-1-1-0").Translate(typeof(System.Security.Principal.NTAccount)).ToString(); NancyHost host = new NancyHost(new ApplicationBootstrapper(), config, new Uri(String.Format("http://localhost:{0}", port))); Console.WriteLine("Starting server on http://localhost:" + port.ToString()); Helper.CacheUpdater updater = new Helper.CacheUpdater(); Helper.Users.Authentication.TryLoadUsersFromFile(usersDbFile); host.Start(); MessageLoop(); updater.StopUpdater(); host.Stop(); Helper.Users.Authentication.TrySaveUsersToFile(usersDbFile); }
static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.DarkBlue; Console.ForegroundColor = ConsoleColor.White; Console.Clear(); int port = 8181; if (args.Length == 1) { Int32.TryParse(args[0], out port); } if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "Files"))) Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "Files")); HostConfiguration config = new HostConfiguration(); config.UrlReservations.CreateAutomatically = true; config.UrlReservations.User = new System.Security.Principal.SecurityIdentifier("S-1-1-0").Translate(typeof(System.Security.Principal.NTAccount)).ToString(); NancyHost host = new NancyHost(new ApplicationBootstrapper(), config, new Uri(String.Format("http://localhost:{0}", port))); Console.WriteLine("Starting server on http://localhost:" + port.ToString()); Helper.CacheUpdater updater = new Helper.CacheUpdater(); Helper.Users.Authentication.TryLoadUsersFromFile(usersDbFile); host.Start(); MessageLoop(); updater.StopUpdater(); host.Stop(); Helper.Users.Authentication.TrySaveUsersToFile(usersDbFile); }