Ejemplo n.º 1
0
 private void Rdp_OnResponse(RdpClient sender, ResponseType response)
 {
     //if (L.X(sender,response)) return;
     Message(sender, response);
     UpdateInfo();
     SaveHost(sender, response);
 }
Ejemplo n.º 2
0
 private void ConnectNext(RdpClient sender)
 {
     if (hosts.Count != 0)
     {
         rdp.Connect(hosts[0].Item1, hosts[0].Item2, hosts[0].Item3);
         hosts.RemoveAt(0);
     }
 }
Ejemplo n.º 3
0
        private void Message(RdpClient client, ResponseType type)
        {
            Color color = Color.WhiteSmoke;

            string text = String.Format("[{0}] [{1}] {2}" + Environment.NewLine,
                                        DateTime.Now.ToString("h:mm:ss tt"), client.Server, type);

            switch (type)
            {
            case ResponseType.Connecting:
                color = Color.DodgerBlue;
                break;

            case ResponseType.Connected:
                connected++;
                color = Color.Gold;
                break;

            case ResponseType.LoggedIn:
                loggedIn++;
                color = Color.LawnGreen;
                break;

            case ResponseType.Disconnected:
                disconnected++;
                color = Color.Red;
                break;

            case ResponseType.Error:
                error++;
                color = Color.Red;
                break;

            case ResponseType.LoginFailed:
                loginFail++;
                color = Color.Orange;
                break;

            case ResponseType.Finished:
                color = Color.WhiteSmoke;
                break;

            case ResponseType.TimedOut:
                color = Color.Red;
                break;
            }

            console.Focus();
            int length = console.TextLength;

            console.SelectionStart = length;
            console.SelectionColor = color;
            console.AppendText(text);
            //console.SelectionLength = text.Length;

            console.SelectionStart = console.Text.Length;
            console.ScrollToCaret();
        }
Ejemplo n.º 4
0
 private void Rdp_OnReady(RdpClient sender)
 {
     if (hosts.Count == 0)
     {
         Message(sender, ResponseType.Finished);
     }
     else
     {
         ConnectNext(sender);
     }
 }
Ejemplo n.º 5
0
 public Form1()
 {
     CheckForIllegalCrossThreadCalls = false;
     InitializeComponent();
     Controls.Add(panel);
     rdp = new RdpClient();
     panel.Controls.Add(rdp);
     panel.Size      = new Size(1, 1);
     rdp.Size        = new Size(1, 1);
     rdp.OnResponse += Rdp_OnResponse;
     rdp.OnReady    += Rdp_OnReady;
     start.Enabled   = false;
     UpdateInfo();
     console.ReadOnly = true;
     //L.X();
 }
Ejemplo n.º 6
0
 private void SaveHost(RdpClient sender, ResponseType response)
 {
     if (lastSaved == sender.Server)
     {
         return;
     }
     if ((response == ResponseType.LoggedIn & check1.Checked) |
         (response == ResponseType.Connected & check2.Checked))
     {
         lastSaved = sender.Server;
         using (StreamWriter w = File.AppendText("good.txt"))
         {
             w.WriteAsync(string.Format("{0}@{1};{2}", sender.Server, sender.UserName, sender.Password));
             w.Flush();
         }
     }
 }