Exemple #1
0
 public void AddServer(PBUCONServer server)
 {
     server.Active = true;
     this.client.AddServer(server);
     ServerAddedEventArgs e = new ServerAddedEventArgs(server);
     EventArgExtensions.Raise <ServerAddedEventArgs>(e, this, ref ServerAdded);
 }
Exemple #2
0
        public ServerTab(ServerManager manager, PBUCONServer server)
        {
            this.manager = manager;
            this.server = server;

            // Create console box
            rtb = new RichTextBox();
            rtb.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right)));
            rtb.BackColor = SystemColors.ControlLight;
            rtb.Font = new Font("Consolas", 9F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
            rtb.ForeColor = SystemColors.WindowText;
            rtb.Location = new Point(7, 7);
            rtb.ReadOnly = true;
            rtb.ScrollBars = RichTextBoxScrollBars.Vertical;
            rtb.Size = new Size(839, 354);
            rtb.TabIndex = 0;

            // Create send button
            sendButton = new Button();
            sendButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
            sendButton.Font = new Font("Segoe UI", 9F);
            sendButton.Location = new Point(771, 367);
            sendButton.Size = new Size(75, 23);
            sendButton.TabIndex = 2;
            sendButton.Text = "Send";
            sendButton.UseVisualStyleBackColor = true;
            sendButton.Click += new EventHandler(sendButton_Click);

            // Create command bar
            commandBox = new TextBox();
            commandBox.Anchor = ((AnchorStyles)(((AnchorStyles.Bottom | AnchorStyles.Left) | AnchorStyles.Right)));
            commandBox.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            commandBox.Location = new Point(7, 367);
            commandBox.Size = new Size(758, 23);
            commandBox.TabIndex = 1;
            commandBox.KeyPress += new KeyPressEventHandler(commandBox_KeyPress);

            // Create tab page that holds everything
            tab = new TabPage();
            tab.ImageIndex = 0;
            tab.Location = new Point(4, 23);
            tab.Name = server.Name;
            tab.Padding = new Padding(3);
            tab.Size = new Size(852, 396);
            tab.TabIndex = 0;
            tab.Text = server.Name;
            tab.UseVisualStyleBackColor = true;

            tab.Controls.Add(rtb);
            tab.Controls.Add(commandBox);
            tab.Controls.Add(sendButton);

            // Add events to the server
            server.NewMessage += NewMessage;
            server.ServerChallengeChanged += ChallengeChange;

            // Show the client challenge
            rtb.AppendText("Client challenge: " + server.ClientChallenge.ToString("X8") + "\n");
        }
Exemple #3
0
 public void SendCommand(PBUCONServer server, string command)
 {
     if (server.Active) // Only send the heartbeat if the server is meant to be connected
     {
         byte[] data = server.GetCommandPacket(command, this.listenIP, this.listenPort);
         client.Send(data, data.Length, server.EndPoint);
     }
 }
Exemple #4
0
 public void SendHeartbeat(PBUCONServer server)
 {
     if (server.Active) // Only send the heartbeat if the server is meant to be connected
     {
         //Console.WriteLine("Sending heartbeat");
         byte[] data = server.GetHeartbeatPacket(this.listenIP, this.listenPort);
         client.Send(data, data.Length, server.EndPoint);
     }
 }
Exemple #5
0
 public void SendCommand(PBUCONServer server, string command)
 {
     this.client.SendCommand(server, command);
 }
Exemple #6
0
 public void AddServer(string name, string ip, int port, string username, string password)
 {
     PBUCONServer server = new PBUCONServer(name, ip, port, username, password);
     AddServer(server);
 }
Exemple #7
0
 public ServerAddedEventArgs(PBUCONServer server)
 {
     this.server = server;
 }
Exemple #8
0
 public void AddServer(PBUCONServer server)
 {
     server.ServerChallengeChanged += ServerChallengeChange;
     this.servers.Add(server);
     SendHeartbeat(server);
 }