Example #1
0
        static void Main(string[] args)
        {
            var serverCtx = new ServerContext();
            var clientCtx = new ClientContext();

            serverCtx.L = clientCtx.L = new ConsoleLogger();

            var prime = new PrimeInstance(serverCtx);

            prime.ExtensionManager.LoadInstallConfig();
            prime.Start();

            // if this is removed DEBUG wont work across projects!??
            var i = ClassTestBase.Test();

            i = i + ClassTestCore.Test();
            // end HACK

            serverCtx.Assemblies.Refresh();
            serverCtx.Types.Refresh();

            var userName = Environment.UserName.ToLower();

            if (userName.Equals("yasko") || userName.Equals("alexander"))
            {
                AlyaskoTest.Go(serverCtx, clientCtx);
            }
            else if (userName.Equals("hitchhiker"))
            {
                Frank.Go(prime, clientCtx);
            }

            //Thread.Sleep(10000);
        }
Example #2
0
        private void Run()
        {
            var logger = new ConsoleLogger()
            {
                IncludePreamble = true
            };

            logger.Log("OS: " + Environment.OSVersion.Platform);
            logger.Log("Current directory: " + Environment.CurrentDirectory);

            var sCtx = new ServerContext()
            {
                L = logger
            };

            sCtx.Assemblies.Refresh();
            sCtx.Types.Refresh();

            // Run Prime.
            var prime = new PrimeInstance(sCtx);

            prime.ExtensionManager.LoadInstallConfig();
            prime.Start();

            // Run Messaging Server.
            var server = new MessagingServer.Server(sCtx);

            server.M.Register <HelloRequest>(this, (request) => { logger.Log($"{request.GetType()} received."); });

            logger.Log("Prime started");

            server.Start();

            // HACK. Run WS server. Unable to load it using extension manager.
            RunWs(server, sCtx);
            // END HACK.

            // Run command processor.
            var commandProcessor = new CommandProcessor();

            commandProcessor.Bind("exit", (cmd) => { Environment.Exit(0); });


            Console.ReadKey();
            //commandProcessor.Start();
        }