コード例 #1
0
ファイル: SimpleClient.cs プロジェクト: Elders/Skynet
        public void Execute()
        {
            //   throw new Exception("aasd");

            var tcpClient = new TcpClient(ServerLocation, ServerPort);
            var skynet = new SkynetClient("Client", tcpClient, null);
            skynet.Connect(true, false, TimeSpan.FromSeconds(60));
            try
            {
                var assembly = Assembly.LoadFrom(File);

                assembly.EntryPoint.Invoke(null, new object[] { new string[] { "args" } });
                new ManualResetEvent(false).WaitOne(1000);
            }
            catch (Exception ex)
            {
                log.Error("Failed to start process", ex);

                Environment.Exit(0);
            }

            //  runner.Start("");

            Environment.Exit(1);
        }
コード例 #2
0
        public void Execute()
        {
            var tcpClient = new TcpClient(ServerLocation, ServerPort);
            var skynet    = new SkynetClient("Client", tcpClient, null);

            skynet.Connect(true, false, TimeSpan.FromSeconds(60));
            try
            {
                var assembly = Assembly.LoadFrom(File);

                assembly.EntryPoint.Invoke(null, new object[] { new string[] { "args" } });
                new ManualResetEvent(false).WaitOne(1000);
            }
            catch (Exception ex)
            {
                log.Error("Failed to start process", ex);

                Environment.Exit(0);
            }

            Environment.Exit(1);
        }
コード例 #3
0
ファイル: Connect.cs プロジェクト: Elders/Skynet
        public void Execute()
        {
            var client = new TcpClient(Address, Port);
            var skynet = new SkynetClient("Skynet Command Line Interface", client);

            try
            {
                skynet.Connect(true, true, TimeSpan.FromSeconds(10));
            }
            catch (Exception ex)
            {
                log.Error("Failed to connect", ex);
            }
            var commands = typeof(Program).Assembly.GetTypes().Where(x => typeof(IHostCommand).IsAssignableFrom(x));

            while (true)
            {
                Console.WriteLine();
                Console.Write("Skynet|>");
                var message = Console.ReadLine();
                Console.WriteLine();
                var cmdLine = message.Split(';');
                foreach (var command in cmdLine)
                {
                    try
                    {
                        var result = Parser.Default.ParseArguments(command.Split(' '), commands.ToArray());


                        result.WithParsed(x => (x as IHostCommand).Execute(skynet));
                    }
                    catch (Exception ex)
                    {
                        log.Fatal("Failed to execute command", ex);
                    }
                }
            }
        }
コード例 #4
0
ファイル: SkynetModuleClient.cs プロジェクト: Elders/Skynet
        public void Execute()
        {
            try
            {
                var assembly   = Assembly.LoadFrom(File);
                var moduleType = typeof(Models.T800);
                var module     = assembly.GetTypes().SingleOrDefault(x => moduleType.IsAssignableFrom(x));
                var terminator = (Activator.CreateInstance(module) as Models.T800);
                var tcpClient  = new TcpClient(ServerLocation, ServerPort);
                var skynet     = new SkynetClient("Client", tcpClient, terminator);
                skynet.Connect(true, false, TimeSpan.FromSeconds(60));
                terminator.PowerUp("nqkuv film");
                new ManualResetEvent(false).WaitOne(1000);
            }
            catch (Exception ex)
            {
                log.Error("Failed to start process", ex);

                Environment.Exit(0);
            }

            Environment.Exit(1);
        }
コード例 #5
0
ファイル: Connect.cs プロジェクト: Elders/Skynet
        public void Execute()
        {
            var client = new TcpClient(Address, Port);
            var skynet = new SkynetClient("Skynet Command Line Interface", client);

            try
            {
                skynet.Connect(true, true, TimeSpan.FromSeconds(10));
            }
            catch (Exception ex)
            {
                log.Error("Failed to connect", ex);
            }
            var commands = typeof(Program).Assembly.GetTypes().Where(x => typeof(IHostCommand).IsAssignableFrom(x));

            while (true)
            {
                Console.WriteLine();
                Console.Write("Skynet|>");
                var message = Console.ReadLine();
                Console.WriteLine();
                var cmdLine = message.Split(';');
                foreach (var command in cmdLine)
                {
                    try
                    {
                        var result = Parser.Default.ParseArguments(command.Split(' '), commands.ToArray());

                        result.WithParsed(x => (x as IHostCommand).Execute(skynet));
                    }
                    catch (Exception ex)
                    {
                        log.Fatal("Failed to execute command", ex);
                    }
                }
            }
        }