示例#1
0
        private void processReply(object sender, LineReceivedEventArgs e)
        {
            string reply = e.line;

            System.Diagnostics.Debug.WriteLine(reply);
            Match match = rEVT.Match(reply);

            if (match.Success)
            {
                int line      = Convert.ToInt16(match.Groups[1].Value);
                int lineState = match.Groups[2].Value == "0" ? 0 : 1;
                Task.Factory.StartNew(() =>
                                      lineStateChanged?.Invoke(this, new LineStateChangedEventArgs {
                    line = line, state = lineState
                }));
            }
            else if (!reply.StartsWith("#SLINF") && !reply.Contains("FLAGS") && !reply.Contains("JConfig"))
            {
                replyTimer.Change(Timeout.Infinite, Timeout.Infinite);
                if (currentCmd != null && currentCmd.cb != null)
                {
                    Action <string> cb = currentCmd.cb;
                    Task.Factory.StartNew(() => cb.Invoke(reply));
                }
                lock (cmdQuee)
                {
                    currentCmd = null;
                }
                processQuee();
            }
        }
 public void FireErrorLineReceivedEvent(LineReceivedEventArgs e)
 {
     if (ErrorLineReceived != null)
     {
         ErrorLineReceived(this, e);
     }
 }
示例#3
0
 /// <summary>
 /// Raises the <see cref="OutputLineReceived"/> event.
 /// </summary>
 /// <param name="sender">The event source.</param>
 /// <param name="e">The event arguments.</param>
 protected void OnOutputLineReceived(object sender, LineReceivedEventArgs e)
 {
     if (OutputLineReceived != null)
     {
         OutputLineReceived(this, e);
     }
 }
 /// <summary>
 /// Handles Event of a Line being Received.
 /// </summary>
 /// <param name="connection">User connection.</param>
 protected void OnLineReceived(Connection connection)
 {
     if (LineReceived != null)
     {
         int index = 0;
         int start = 0;
         while ((index = connection.ReceiveBuffer.IndexOf('\n', index)) != -1)
         {
             string s = connection.ReceiveBuffer.GetString(start, index - start - 1);
             s = s.Backspace();
             LineReceivedEventArgs args      = new LineReceivedEventArgs(connection, s);
             Delegate[]            delegates = LineReceived.GetInvocationList();
             foreach (Delegate d in delegates)
             {
                 d.DynamicInvoke(new object[] { this, args });
                 if (args.Handled == true)
                 {
                     break;
                 }
             }
             if (args.Handled == false)
             {
                 connection.CommandBuffer.Enqueue(s);
             }
             start = index;
             index++;
         }
         if (start > 0)
         {
             connection.ReceiveBuffer.Reset(0, start + 1);
         }
     }
 }
 public void FireOutputLineReceivedEvent(LineReceivedEventArgs e)
 {
     if (OutputLineReceived != null)
     {
         OutputLineReceived(this, e);
     }
 }
示例#6
0
        private void SerialPort_LineReceived(object sender, LineReceivedEventArgs e)
        {
            this._counter++;
            if (this._counter == 29) // skip 29 lines
            {
                this._counter = 0;

                this.SendData(sender, e);
            }
        }
示例#7
0
        private void connector_LineReceived(object sender, LineReceivedEventArgs e)
        {
#warning ограничить кол-во текста в контроле консоли
            _consoleTextBox.BeginInvoke(new Action(() =>
            {
                _consoleTextBox.AppendText(e.Line);
                if (e.Type == LineReceivedEventArgs.LineType.General)
                {
                    _consoleTextBox.AppendText("\r\n");
                }
            }));
        }
示例#8
0
        private void login()
        {
            using (FLogin lf = new FLogin(Application.StartupPath + "\\clusters.txt"))
            {
                lf.tbCallsign.Text = settings.cs;
                lf.tbHost.Text     = settings.host;
                if (settings.port != 0)
                {
                    lf.tbPort.Text = settings.port.ToString();
                }
                if (lf.ShowDialog() == DialogResult.OK)
                {
                    string host     = lf.tbHost.Text;
                    int    port     = Convert.ToInt32(lf.tbPort.Text);
                    string callsign = lf.tbCallsign.Text;
                    if (!callsign.Equals(settings.cs))
                    {
                        settings.cs = callsign;
                    }
                    if (!host.Equals(settings.host))
                    {
                        settings.host = host;
                    }
                    if (port != settings.port)
                    {
                        settings.port = port;
                    }
                    writeConfig();

                    if (host == "test")
                    {
                        using (StreamReader sr = new StreamReader(Application.StartupPath + "\\test.txt"))
                            do
                            {
                                LineReceivedEventArgs e = new LineReceivedEventArgs();
                                e.line = sr.ReadLine();
                                lineReceived(this, e);
                            } while (sr.Peek() >= 0);
                    }
                    else
                    {
                        clusterCn = new AsyncConnection();
                        clusterCn.lineReceived += lineReceived;
                        if (clusterCn.connect(host, port))
                        {
                            clusterCn.sendCommand(callsign);
                            this.Text += " connected to " + host + ":" + port.ToString();
                        }
                    }
                }
            }
        }
示例#9
0
        private void GpsShare_lineReceived(object sender, LineReceivedEventArgs e)
        {
#if DEBUG
#if LOG_GPS
            System.Diagnostics.Trace.TraceInformation(e.line);
#endif
#endif
            if (e.line.StartsWith("$GPGGA") || e.line.StartsWith("$GNGGA"))
            {
                System.Diagnostics.Trace.TraceInformation(e.line);
                parse(e.line);
            }
        }
        public void FireErrorLineReceivedEventFiresEventAndReturnsExpectedLine()
        {
            LineReceivedEventArgs expectedEventArgs = null;

            processRunner.ErrorLineReceived += delegate(object o, LineReceivedEventArgs e) {
                expectedEventArgs = e;
            };
            string line = "test";
            LineReceivedEventArgs eventArgs = new LineReceivedEventArgs(line);

            processRunner.FireErrorLineReceivedEvent(eventArgs);

            Assert.AreEqual(line, expectedEventArgs.Line);
        }
示例#11
0
        private void SendData(object sender, LineReceivedEventArgs e)
        {
            try
            {
                var measurement    = JsonConvert.DeserializeObject <Measurement>(e.line);
                var measurementDto = new[]
                {
                    new MeasurementDto
                    {
                        DateTimeUtc = DateTime.UtcNow,
                        Temperature = measurement.Temperature,
                        Pressure    = measurement.Pressure,
                        Humidity    = measurement.Humidity,
                        Device      = new DeviceDto
                        {
                            GlobalId = this._services.GetService <IConfiguration>()
                                       .GetSection("AppSettings")["DeviceGlobalId"]
                        },
                        UpdateStatus = UpdateStatus.Inserted,
                        GlobalId     = Guid.NewGuid().ToString()
                    }
                };

                Console.WriteLine(
                    $"{DateTime.UtcNow.ToString()}: {measurement.Temperature}°C, {measurement.Pressure}hpa, {measurement.Humidity}%");

                var _tokenSource = new CancellationTokenSource();
                _tokenSource.CancelAfter(30000);

                var cancellationToken = _tokenSource.Token;

                Task.Run(() =>
                {
                    using (var client = this._services.GetService <IClient>())
                    {
                        var result = client.PostAsync <string>(@"/api/generic/Measurement/Insert", measurementDto,
                                                               cancellationToken).Result;
                    }
                }, cancellationToken);
            }
            catch (Exception)
            {
            }
        }
        public void OutputLineTextReceivedFromProcessRunnerIsAddedToMessageCategoryText()
        {
            runCommand.Run();
            buildProject.FireBuildCompleteEvent();
            context.UnitTestCategory.ClearText();

            LineReceivedEventArgs firstLineReceived = new LineReceivedEventArgs("first");

            processRunner.FireOutputLineReceivedEvent(firstLineReceived);
            LineReceivedEventArgs secondLineReceived = new LineReceivedEventArgs("second");

            processRunner.FireOutputLineReceivedEvent(secondLineReceived);

            string expectedCategoryText =
                "first\r\n" +
                "second\r\n";

            Assert.AreEqual(expectedCategoryText, context.UnitTestCategory.Text);
        }
		void OutputLineReceived(object source, LineReceivedEventArgs e)
		{
			TestRunnerCategory.AppendLine(e.Line);
		}
示例#14
0
		void LineReceived(object sender, LineReceivedEventArgs e)
		{
			SvcUtilMessageView.AppendLine(e.Line);
		}
示例#15
0
        /// <summary>
        /// Handles a received line from the server.
        /// </summary>
        /// <param name="sender">The client, the message was received from.</param>
        /// <param name="e">The event argument, holding the received line.</param>
        private void HandleLine(object sender, LineReceivedEventArgs e)
        {
            if (!e.Line.IsNumeric)
            {
                return;
            }

            switch (e.Line.Numeric)
            {
                case 371:
                    infoLines.Add(e.Line);
                    if (!IsReading)
                    {
                        isReading = true;
                        if (InfoBegin != null)
                        {
                            InfoBegin(this, new InfoBeginEventArgs(e.Line));
                        }
                    }

                    break;

                case 374:
                    infoLines.Add(e.Line);
                    if (InfoEnd != null)
                    {
                        InfoEnd(this, new InfoEndEventArgs(e.Line, InfoLines));
                    }

                    isReading = false;
                    break;
            }
        }
示例#16
0
        private void HandleLine(Object sender, LineReceivedEventArgs args)
        {
            if (!args.Line.IsNumeric)
                return;

            switch (args.Line.Numeric)
            {
                case 352:
                    whoLines.Add(new WhoLine(args.Line));
                    if (!IsReading)
                    {
                        isReading = true;
                        if (WhoBegin != null)
                            WhoBegin(this, new WhoBeginEventArgs(args.Line));
                    }
                    break;

                case 315:
                    if (WhoEnd != null)
                        WhoEnd(this, new WhoEndEventArgs(args.Line, WhoLines));
                    isReading = false;
                    break;
            }
        }
示例#17
0
 private void UsartConnection_lineReceived(object sender, LineReceivedEventArgs e)
 {
     throw new NotImplementedException();
 }
示例#18
0
        /// <summary>
        /// Handles a line received from server.
        /// </summary>
        private void HandleLine(LineReceivedEventArgs e)
        {
            if (e.Line.IsNumeric)
            {
                if (NumericReceived != null) NumericReceived(this, new NumericReceivedEventArgs(e.Line));
                switch (e.Line.Numeric)
                {
                    case 1: // Parse the Server Info
                        currentNick = e.Line.Parameters[0];
                        networkName = e.Line.Parameters[1].Split(' ')[3];
                        myUserInfo = new UserInfo(e.Line.Parameters[1].Split(' ')[6], this);
                        break;

                    case 3: // Parse Welcome-Message
                        loggedIn = true;
                        if (Login != null)
                            Login(this, new LoginEventArgs(NetworkName, CurrentNick, this));
                        break;

                    case 376: // End of MOTD message
                        loggedIn = true;
                        if (Login != null)
                            Login(this, new LoginEventArgs(NetworkName, CurrentNick, this));
                        break;
                }
            }
            else
            {
                e.Handled = true;
                switch (e.Line.Command)
                {
                    case "PING": // Handle the Ping here
                        PingReceivedEventArgs pingArgs = new PingReceivedEventArgs(e.Line);
                        if (PingReceived != null)
                            PingReceived(this, pingArgs);
                        if (!pingArgs.Handled)
                            if (e.Line.Parameters.Length > 0)
                                SendLine("PONG :" + e.Line.Parameters[0]);
                            else
                                SendLine("PONG");
                        break;

                    case "JOIN": //Parse Join-Message
                        JoinReceivedEventArgs joinArgs = new JoinReceivedEventArgs(e.Line);
                        if (JoinReceived != null)
                            JoinReceived(this, joinArgs);
                        break;

                    case "PART": //Parse Part-Message
                        PartReceivedEventArgs partArgs = new PartReceivedEventArgs(e.Line);
                        if (PartReceived != null)
                            PartReceived(this, partArgs);
                        break;

                    case "QUIT": //Parse Quit-Message
                        QuitReceivedEventArgs quitArgs = new QuitReceivedEventArgs(e.Line);
                        if (QuitReceived != null)
                            QuitReceived(this, quitArgs);
                        break;

                    case "NICK": //Parse Nick-Message
                        if(e.Line.Client.ToString() == this.ToString())
                            this.currentNick = e.Line.Parameters[0];

                        NickChangeReceivedEventArgs nickChangeArgs = new NickChangeReceivedEventArgs(e.Line);
                        if (NickChangeReceived != null)
                            NickChangeReceived(this, nickChangeArgs);
                        break;

                    case "MODE": //Parse Mode-Message
                        ModeReceivedEventArgs modeArgs = new ModeReceivedEventArgs(e.Line);
                        if (ModeReceived != null)
                            ModeReceived(this, modeArgs);
                        break;

                    case "NOTICE": //Parse Notice-Message
                        NoticeReceivedEventArgs noticeArgs = new NoticeReceivedEventArgs(e.Line);
                        if (NoticeReceived != null)
                            NoticeReceived(this, noticeArgs);
                        break;

                    case "PRIVMSG": //Parse Private-Message
                        PrivateMessageReceivedEventArgs privmsgArgs = new PrivateMessageReceivedEventArgs(e.Line);
                        if (PrivateMessageReceived != null)
                            PrivateMessageReceived(this, privmsgArgs);
                        break;

                    case "KICK": //Parse Kick-Message
                        KickReceivedEventArgs kickArgs = new KickReceivedEventArgs(e.Line);
                        if (KickReceived != null)
                            KickReceived(this, kickArgs);
                        break;

                    default:
                        e.Handled = false;
                        break;
                }
            }
        }
 void OutputLineReceived(object sender, LineReceivedEventArgs e)
 {
     CategoryWriteLine(e.Line);
 }
示例#20
0
        /// <summary>
        /// Handles a received line from the server.
        /// </summary>
        /// <param name="sender">The client, the message was received from.</param>
        /// <param name="e">The event argument, holding the received line.</param>
        private void HandleLine(object sender, LineReceivedEventArgs e)
        {
            if (!e.Line.IsNumeric)
            {
                return;
            }

            switch (e.Line.Numeric)
            {
                case 352:
                    whoLines.Add(new WhoLine(e.Line));
                    if (!IsReading)
                    {
                        isReading = true;
                        if (WhoBegin != null)
                        {
                            WhoBegin(this, new WhoBeginEventArgs(e.Line));
                        }
                    }

                    break;

                case 315:
                    if (WhoEnd != null)
                    {
                        WhoEnd(this, new WhoEndEventArgs(e.Line, WhoLines));
                    }

                    isReading = false;
                    break;
            }
        }
示例#21
0
 void LineReceived(object sender, LineReceivedEventArgs e)
 {
     SvcUtilMessageView.AppendLine(e.Line);
 }
示例#22
0
        /// <summary>
        /// Handles a received line from the server.
        /// </summary>
        /// <param name="sender">The client, the message was received from.</param>
        /// <param name="e">The event argument, holding the received line.</param>
        private void HandleLine(object sender, LineReceivedEventArgs e)
        {
            if (!e.Line.IsNumeric)
            {
                return;
            }

            switch (e.Line.Numeric)
            {
                case 364:
                    linksLines.Add(e.Line);
                    if (!IsReading)
                    {
                        isReading = true;
                        if (LinksBegin != null)
                        {
                            LinksBegin(this, new LinksBeginEventArgs(e.Line));
                        }
                    }

                    break;

                case 365:
                    linksLines.Add(e.Line);
                    if (LinksEnd != null)
                    {
                        LinksEnd(this, new LinksEndEventArgs(e.Line, LinksLines));
                    }

                    isReading = false;
                    break;
            }
        }
示例#23
0
            private void OnLineReceived(object o,
						     LineReceivedEventArgs
						     args)
            {
                if (args.LineType != LineType.Normal
                    && args.LineType != LineType.Talk)
                    return;
                string line = args.Line;
                  AddLineToBuffer (line);
            }
示例#24
0
            void OnLineReceived(object o,
					     LineReceivedEventArgs args)
            {
                if (!start_parsing)
                  {
                      return;
                  }
                string line = args.Line.Trim ();

                if (first_colon_seen)
                  {
                      if (line.Length > 0
                          && line[0] != ':')
                          HandleCompletion ();
                      else
                          ProcessLine (line);
                      return;
                  }

                if (!first_colon_seen && line.Length > 0
                    && line[0] == ':')
                    first_colon_seen = true;
            }
 void OutputLineReceived(object sender, LineReceivedEventArgs e)
 {
 	CategoryWriteLine(e.Line);
 }
 void OutputLineReceived(object source, LineReceivedEventArgs e)
 {
     OnMessageReceived(e.Line);
 }
 void OutputLineReceived(object source, LineReceivedEventArgs e)
 {
     TestRunnerCategory.AppendLine(e.Line);
 }
示例#28
0
 private void HandleLine(Object sender, LineReceivedEventArgs args)
 {
     if (!args.Line.IsNumeric) return;
     if (!IsReading && args.Line.Numeric != 321) return;
     switch (args.Line.Numeric)
     {
         case 321:
             isReading = true;
             if (ChannelListBegin != null)
                 ChannelListBegin(this, new ChannelListBeginEventArgs(args.Line));
             break;
         case 322:
             channelListLines.Add(new ChannelListLine(args.Line));
             break;
         case 323:
             if (ChannelListEnd != null)
                 ChannelListEnd(this, new ChannelListEndEventArgs(args.Line, ChannelListLines));
             isReading = false;
             break;
     }
 }
示例#29
0
        private void HandleLine(Object sender, LineReceivedEventArgs args)
        {
            if (!args.Line.IsNumeric) return;
            switch (args.Line.Numeric)
            {
                case 353:
                    ChannelNameValue = args.Line.Parameters[2];

                    foreach (String s in args.Line.Parameters[3].Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
                    {
                        names.Add(s);
                    }

                    if (!IsReading)
                    {
                        isReading = true;
                        if (NamesBegin != null)
                            NamesBegin(this, new NamesBeginEventArgs(args.Line));
                    }
                    break;

                case 366:
                    if (NamesEnd != null)
                        NamesEnd(this, new NamesEndEventArgs(args.Line, Names, ChannelNameValue));

                    isReading = false;
                    break;
            }
        }
示例#30
0
        private void HandleLine(Object sender, LineReceivedEventArgs args)
        {
            if (!args.Line.IsNumeric) return;
            if (!IsReading && args.Line.Numeric != 375) return;
            switch (args.Line.Numeric)
            {
                case 375:
                    isReading = true;
                    motdLines.Clear();
                    motdLines.Add(args.Line);
                    if (MotdBegin != null)
                        MotdBegin(this, new MotdBeginEventArgs(args.Line));
                    break;

                case 372:
                    motdLines.Add(args.Line);
                    break;

                case 376:
                    motdLines.Add(args.Line);
                    if (MotdEnd != null)
                        MotdEnd(this, new MotdEndEventArgs(args.Line, MotdLines));
                    isReading = false;
                    break;
            }
        }
示例#31
0
        /// <summary>
        /// Handles a received line from the server.
        /// </summary>
        /// <param name="sender">The client, the message was received from.</param>
        /// <param name="e">The event argument, holding the received line.</param>
        private void HandleLine(object sender, LineReceivedEventArgs e)
        {
            if (!e.Line.IsNumeric)
            {
                return;
            }

            if (!IsReading && e.Line.Numeric != 321)
            {
                return;
            }

            switch (e.Line.Numeric)
            {
                case 321:
                    isReading = true;
                    if (ChannelListBegin != null)
                    {
                        ChannelListBegin(this, new ChannelListBeginEventArgs(e.Line));
                    }

                    break;
                case 322:
                    channelListLines.Add(new ChannelListLine(e.Line));
                    break;
                case 323:
                    if (ChannelListEnd != null)
                    {
                        ChannelListEnd(this, new ChannelListEndEventArgs(e.Line, ChannelListLines));
                    }

                    isReading = false;
                    break;
            }
        }
示例#32
0
        private void lineReceived(object obj, LineReceivedEventArgs ea)
        {
            string line = ea.line.TrimEnd('\r', '\n');

            this.Invoke((MethodInvoker) delegate {
                tbCluster.AppendText(line + Environment.NewLine);
            });
            string country = "";
            Match  mtchDX  = rgxDX.Match(line);

            if (mtchDX.Success)
            {
                string cs = mtchDX.Groups[3].Value;
                if (prefixes[1].ContainsKey(cs))
                {
                    country = prefixes[1][cs];
                }
                else
                {
                    for (int c = 1; c <= cs.Length; c++)
                    {
                        if (prefixes[0].ContainsKey(cs.Substring(0, c)))
                        {
                            country = prefixes[0][cs.Substring(0, c)];
                        }
                    }
                }
                double freq  = Convert.ToDouble(mtchDX.Groups[2].Value.Replace(".", CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator));
                string mode  = "";
                string textU = mtchDX.Groups[4].Value.ToUpper();
                foreach (Mode modeI in DxConsts.Modes)
                {
                    if (!modeI.isCategory)
                    {
                        mode = testMode(textU, modeI);
                        if (mode != "")
                        {
                            break;
                        }
                    }
                }
                if (mode == "")
                {
                    mode = getDiap(modes, freq);
                }
                if (mode != "" && modesDict.ContainsKey(mode) && modesDict[mode].dxGridViewName != null)
                {
                    mode = modesDict[mode].dxGridViewName;
                }
                string band = getDiap(DxConsts.Bands, freq);
                try
                {
                    if (!closed)
                    {
                        Invoke((MethodInvoker) delegate
                        {
                            if (!closed)
                            {
                                lock (dxDataLock)
                                {
                                    int pos     = dgvDxData.FirstDisplayedScrollingRowIndex;
                                    DxItem prev = blDxData.FirstOrDefault(x => x.cs == cs && (freq - x.nFreq < 0.3 && x.nFreq - freq < 0.3));
                                    if (prev != null)
                                    {
                                        int idx = blDxData.IndexOf(prev);
                                        blDxData.RemoveAt(idx);
                                        dgvDxData.ClearSelection();
                                        dgvDxData.CurrentCell = null;
                                        for (int c = idx; c >= 0; c--)
                                        {
                                            if (c < dgvDxData.RowCount)
                                            {
                                                dgvDxDrawRow(c);
                                            }
                                        }
                                    }
                                    blDxData.Insert(0, new DxItem
                                    {
                                        cs     = cs,
                                        l      = lotw1.Contains(cs) ? "+" : "",
                                        prefix = country,
                                        de     = mtchDX.Groups[1].Value,
                                        freq   = mtchDX.Groups[2].Value,
                                        mode   = mode,
                                        band   = band,
                                        text   = mtchDX.Groups[4].Value,
                                        time   = mtchDX.Groups[5].Value,
                                        dt     = DateTime.Now,
                                        nFreq  = freq
                                    });
                                    List <DxItem> old = blDxData.Where(x => x.dt < DateTime.Now.Subtract(new TimeSpan(0, 30, 0))).ToList();
                                    if (old.Count > 0)
                                    {
                                        old.ForEach(x => blDxData.Remove(x));
                                    }
                                    dgvDxData.ClearSelection();
                                    dgvDxData.CurrentCell = null;
                                    dgvDxDrawRow(0);
                                    int nPos = pos;
                                    if (nPos > dgvDxData.RowCount)
                                    {
                                        nPos--;
                                    }
                                    while (nPos > -1 && !dgvDxData.Rows[nPos].Visible)
                                    {
                                        nPos--;
                                    }
                                    if (nPos > -1)
                                    {
                                        dgvDxData.FirstDisplayedScrollingRowIndex = nPos;
                                        Trace.WriteLine("Scroll from " + pos.ToString() + " to " + nPos.ToString());
                                    }
                                    else
                                    {
                                        nPos = pos;
                                        if (nPos < 0)
                                        {
                                            nPos = 0;
                                        }
                                        while (nPos < dgvDxData.RowCount && !dgvDxData.Rows[nPos].Visible)
                                        {
                                            nPos++;
                                        }
                                        if (nPos < dgvDxData.RowCount)
                                        {
                                            dgvDxData.FirstDisplayedScrollingRowIndex = nPos;
                                            Trace.WriteLine("Scroll from " + pos.ToString() + " to " + nPos.ToString());
                                        }
                                        else
                                        {
                                            Trace.WriteLine("scroll canceled");
                                        }
                                    }
                                }
                            }
                        });
                    }
                } catch (Exception e)
                {
                    dxDataLock = false;
                    Debug.WriteLine(e.ToString());
                    Debug.WriteLine("line recived: " + line);
                }
            }
        }
 void OutputLineReceived(object sender, LineReceivedEventArgs e)
 {
     lines.Add(e.Line);
 }
示例#34
0
 void Item_LineReceived(object sender, LineReceivedEventArgs e)
 {
     IrcShark.Logger.Log(LogLevels.Verbose, e.Line.ToString(), ((IrcSharp.Extended.IrcConnection)sender).ConnectionID.ToString());
 }
示例#35
0
        private void HandleLine(Object sender, LineReceivedEventArgs args)
        {
            if (!args.Line.IsNumeric) return;
            switch (args.Line.Numeric)
            {
                case 364:
                    linksLines.Add(args.Line);
                    if (!IsReading)
                    {
                        isReading = true;
                        if (LinksBegin != null)
                            LinksBegin(this, new LinksBeginEventArgs(args.Line));
                    }
                    break;

                case 365:
                    linksLines.Add(args.Line);
                    if (LinksEnd != null)
                        LinksEnd(this, new LinksEndEventArgs(args.Line, LinksLines));
                    isReading = false;
                    break;
            }
        }
 PortaSerial sp1 = new PortaSerial();     // like this command passed LineReceivedEvent or LineReceived
 // event handler method
 void sp1_LineReceived(object sender, LineReceivedEventArgs Args)
 {
     //do things with line
     MessageBox.ShowDialog(Args.LineData);
 }
示例#37
0
 /// <summary>
 /// Reads lines from server and parses them to an IrcLine.
 /// </summary>
 private void ReadLines()
 {
     String Line;
     while (IsConnected)
     {
         try
         {
             if (inReader == null) return;
             Line = inReader.ReadLine();
             if (Line != null)
             {
                 LineReceivedEventArgs args = new LineReceivedEventArgs(new IrcLine(this, Line));
                 if (LineReceived != null)
                     LineReceived(this, args);
            		if (!args.Handled)
            			HandleLine(args);
             }
         }
         catch (InvalidLineFormatException ex)
         {
             OnError(new ErrorEventArgs(this, ex.Message, ex));
             return;
         }
         catch (Exception ex)
         {
             OnError(new ErrorEventArgs(this, "Couldn't receive line", ex));
             return;
         }
     }
 }
示例#38
0
 void process_OutputLineReceived(object sender, LineReceivedEventArgs e)
 {
     TaskService.BuildMessageViewCategory.AppendLine(e.Line);
 }
示例#39
0
        private void HandleLine(Object sender, LineReceivedEventArgs args)
        {
            if (!args.Line.IsNumeric) return;
            switch (args.Line.Numeric)
            {
                case 371:
                    infoLines.Add(args.Line);
                    if (!IsReading)
                    {
                        isReading = true;
                        if (InfoBegin != null)
                            InfoBegin(this, new InfoBeginEventArgs(args.Line));
                    }
                    break;

                case 374:
                    infoLines.Add(args.Line);
                    if (InfoEnd != null)
                        InfoEnd(this, new InfoEndEventArgs(args.Line, InfoLines));
                    isReading = false;
                    break;
            }
        }
示例#40
0
        /// <summary>
        /// Handles a received line from the server.
        /// </summary>
        /// <param name="sender">The client, the message was received from.</param>
        /// <param name="e">The event argument, holding the received line.</param>
        private void HandleLine(object sender, LineReceivedEventArgs e)
        {
            if (!e.Line.IsNumeric)
            {
                return;
            }

            if (!IsReading && e.Line.Numeric != 375)
            {
                return;
            }

            switch (e.Line.Numeric)
            {
                case 375:
                    isReading = true;
                    motdLines.Clear();
                    motdLines.Add(e.Line);
                    if (MotdBegin != null)
                    {
                        MotdBegin(this, new MotdBeginEventArgs(e.Line));
                    }

                    break;

                case 372:
                    motdLines.Add(e.Line);
                    break;

                case 376:
                    motdLines.Add(e.Line);
                    if (MotdEnd != null)
                    {
                        MotdEnd(this, new MotdEndEventArgs(e.Line, MotdLines));
                    }

                    isReading = false;
                    break;
            }
        }