Beispiel #1
0
	    private static int Execute(ServerParameters arg) {
	        var config = arg.BuildServerConfig();
	        EnsureRequiredApplications(arg,config);
	        config.DllFolder = EnvironmentInfo.ResolvePath("@repos@/.build/bin/all");
            var command = arg.Get("command", "");
	        if (string.IsNullOrWhiteSpace(command)) {
	            Console.WriteLine("LOGLEVEL " + config.LogLevel);
	        }
	        var hostServer = new HostServer(config);
            hostServer.Initialize();
            var consoleContext = new ConsoleContext
            {
                Container = hostServer.Container,
                Parameters = arg
            };
            var listener = new ConsoleListener(consoleContext);
            
	        if (!string.IsNullOrWhiteSpace(command)) {
	            var task = listener.Call(command);
	            task.Wait();
	        }
	        else {

	            LogHostInfo(arg, config);
	            hostServer.Start();
	            Console.WriteLine("LOGLEVEL " + config.LogLevel);

	            listener.Log = hostServer.Container.Get<ILoggyManager>().Get("console");
	            listener.Run();
	            hostServer.Stop();
	        }
	        return 0;
	    }
Beispiel #2
0
        private static int Execute(ServerParameters arg)
        {
            var config = arg.BuildServerConfig();

            EnsureRequiredApplications(arg, config);
            config.DllFolder = EnvironmentInfo.ResolvePath("@repos@/.build/bin/all");
            var command = arg.Get("command", "");

            if (string.IsNullOrWhiteSpace(command))
            {
                Console.WriteLine("LOGLEVEL " + config.LogLevel);
            }
            var hostServer = new HostServer(config);

            hostServer.Initialize();
            var consoleContext = new ConsoleContext
            {
                Container  = hostServer.Container,
                Parameters = arg
            };
            var listener = new ConsoleListener(consoleContext);

            if (!string.IsNullOrWhiteSpace(command))
            {
                var task = listener.Call(command);
                task.Wait();
            }
            else
            {
                LogHostInfo(arg, config);
                hostServer.Start();
                Console.WriteLine("LOGLEVEL " + config.LogLevel);

                listener.Log = hostServer.Container.Get <ILoggyManager>().Get("console");
                listener.Run();
                hostServer.Stop();
            }
            return(0);
        }