Beispiel #1
0
        public static void Main(string[] args)
        {
            // Move into the directory of the exe file, important for unix like environments
            // ReSharper disable once PossibleNullReferenceException
            Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).ToString(CultureInfo.InvariantCulture);

            var options = new Options();
            if (options.LoadFromFile() || Parser.Default.ParseArguments(args, options))
            {
                var p = new Program(options);
                p.Run(options);
            }
            else
                HelpText.DefaultParsingErrorsHandler(options, null);
        }
Beispiel #2
0
        private void Run(Options options)
        {
            _server.Start(options);

            //Under mono if you deamonize a process a Console.ReadLine will cause an EOF
            //so we need to block another way
            if (_daemon)
            {
                while (true)
                    Thread.Sleep(10000);
            }
            else
            {
                Console.WriteLine("Press Any Key To Exit");
                Console.ReadKey();
            }
        }
Beispiel #3
0
        private Program(Options options)
        {
            _daemon = options.Daemon;

            if (options.CleanStart)
                options.InteractiveSetup();

            Database.Database db = new Database.Database(options.CleanStart, options.ConnectionString);

            _server = new HttpServer.HttpServer(options.HttpPort, db.ConnectionFactory);
        }