Ejemplo n.º 1
0
		/// <summary>
		/// Used to fire the new data event.
		/// </summary>
		/// <param name="e">E.</param>
		protected virtual void OnNewData(NewDataEventArgs e)
		{
			if (NewData != null)
			{
				NewData(this, e);
			}
		}
Ejemplo n.º 2
0
 private void c_NewData(object sender, NewDataEventArgs e)
 {
     if (Active)
     {
         this.Icon = appIcon;
     }
     else
     {
         this.Icon = dataIcon;
     }
 }
Ejemplo n.º 3
0
		private void timer_Tick(object sender, EventArgs e)
		{
			if (socket.Connected && socket.Poll(1, SelectMode.SelectRead))
			{
				byte[] buffer = new byte[client.ReceiveBufferSize];

				int recieved = 0;

				try
				{
					recieved = stream.Read(buffer, 0, client.ReceiveBufferSize);

					if (recieved == 0)
					{
						Disconnect();
						OnDisconnected(EventArgs.Empty);
						return;
					}

					buffer = telnet.ProcessTelnet(buffer);
					string data = Encoding.UTF8.GetString(buffer);
					data = data.Trim(new char[1] {'\0'});

					log.Write(data);

					ansi.AppendText(data, AnsiEdit.MessageType.ANSI);

					//Tell everyone there's new data
					NewDataEventArgs dataEvent = new NewDataEventArgs(data);

					OnNewData(dataEvent);

					if (((TabControl) tabPage.Parent).SelectedTab != tabPage)
					{
						tabPage.ImageIndex = 1;
					}
				}
				catch (SocketException se)
				{
					this.Ansi.AppendText("\nRead Error: " + se.Message + "\n", AnsiEdit.MessageType.Error);
					Disconnect();
					OnDisconnected(EventArgs.Empty);
				}
				catch (IOException ioE)
				{
					this.Ansi.AppendText("\nRead Error: " + ioE.Message + "\n", AnsiEdit.MessageType.Error);
					Disconnect();
					OnDisconnected(EventArgs.Empty);
				}
			}
		}
Ejemplo n.º 4
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (socket.Connected && socket.Poll(1, SelectMode.SelectRead))
            {
                byte[] buffer = new byte[client.ReceiveBufferSize];

                int recieved = 0;

                try
                {
                    recieved = stream.Read(buffer, 0, client.ReceiveBufferSize);

                    if (recieved == 0)
                    {
                        Disconnect();
                        OnDisconnected(EventArgs.Empty);
                        return;
                    }

                    buffer = telnet.ProcessTelnet(buffer);
                    string data = Encoding.UTF8.GetString(buffer);
                    data = data.Trim(new char[1] {'\0'});

                    log.Write(data);

                    ansi.AppendText(data, AnsiEdit.MessageType.ANSI);

                    //Tell everyone there's new data
                    NewDataEventArgs dataEvent = new NewDataEventArgs(data);

                    OnNewData(dataEvent);

                    if (((TabControl) tabPage.Parent).SelectedTab != tabPage)
                    {
                        tabPage.ImageIndex = 1;
                    }
                }
                catch (SocketException se)
                {
                    this.Ansi.AppendText("\nRead Error: " + se.Message + "\n", AnsiEdit.MessageType.Error);
                    Disconnect();
                    OnDisconnected(EventArgs.Empty);
                }
                catch (IOException ioE)
                {
                    this.Ansi.AppendText("\nRead Error: " + ioE.Message + "\n", AnsiEdit.MessageType.Error);
                    Disconnect();
                    OnDisconnected(EventArgs.Empty);
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Used to fire the new data event.
 /// </summary>
 /// <param name="e">E.</param>
 protected virtual void OnNewData(NewDataEventArgs e)
 {
     if (NewData != null)
     {
         NewData(this, e);
     }
 }
Ejemplo n.º 6
0
 private void c_NewData(object sender, NewDataEventArgs e)
 {
     if (Active)
     {
         this.Icon = appIcon;
     }
     else
     {
         this.Icon = dataIcon;
     }
 }