static int Main(string[] args)
        {
#if DEBUG
            Console.WriteLine("Mode=Debug");
#else
            Console.WriteLine("Mode=Release");
#endif
            Console.ReadLine();
            return(0);

            if (args.Length < 2)
            {
                Console.WriteLine("Please enter a port and projectRootPath.");
                return(1);
            }

            if (int.TryParse(args[0], out int port))
            {
                var projectRootPath  = args[1];
                var simpleHTTPServer = new HTTPServer(projectRootPath, port);
                Console.ReadLine();
                simpleHTTPServer.Stop();
            }
            return(0);
        }
Example #2
0
        static void Main(string[] args)
        {
            //List<string> prefixes = new List<string> {  };

            HTTPServer myServer = null;

            while (true)
            {
                if (args.Count() < 5)
                {
                    args = Console.ReadLine().Split().ToArray();
                }

                if (args[0] == "start")
                {
                    if (args.Count() > 5)
                    {
                        // Example: D:/HTTPServer /index.html /404.html false http://localhost:8080/
                        myServer = new HTTPServer(args.Skip(5).ToList(), args[1], args[2], args[3], bool.Parse(args[4]));
                        myServer.StartListening();
                    }
                    else
                    {
                        Logger.Log("Missing input data!");
                        Logger.Log("Example: D:/HTTPServer /index.html /404.html false http://localhost:8080/");
                    }
                }
                else if (args[0] == "netacl")
                {
                    NetAclChecker.AddAddresses(args.Skip(1).ToList());
                }
                else if (args[0] == "stop")
                {
                    if (myServer != null)
                    {
                        myServer.StopListening();
                    }
                }
                else if (args[0] == "quit")
                {
                    break;
                }

                args = new string[5];
            }
        }
Example #3
0
 public RequestHandler(HttpListener l, HTTPServer sr)
 {
     Listener        = l;
     ServerReference = sr;
 }