TryParse() 공개 정적인 메소드

public static TryParse ( string line, SseEvent &sseEvent ) : bool
line string
sseEvent SseEvent
리턴 bool
예제 #1
0
        private void ProcessBuffer(int read)
        {
            lock (_lockObj)
            {
                _buffer.Add(_readBuffer, read);

                while (_buffer.HasChunks)
                {
                    string line = _buffer.ReadLine();

                    // No new lines in the buffer so stop processing
                    if (line == null)
                    {
                        break;
                    }

                    SseEvent sseEvent;
                    if (!SseEvent.TryParse(line, out sseEvent))
                    {
                        continue;
                    }

                    Debug.WriteLine("SSE READ: " + sseEvent);

                    OnMessage(sseEvent);
                }
            }
        }
예제 #2
0
        private void ProcessBuffer(ArraySegment <byte> readBuffer)
        {
            lock (BufferLock)
            {
                _buffer.Add(readBuffer);

                while (_buffer.HasChunks)
                {
                    string line = _buffer.ReadLine();

                    // No new lines in the buffer so stop processing
                    if (line == null)
                    {
                        break;
                    }

                    SseEvent sseEvent;
                    if (!SseEvent.TryParse(line, out sseEvent))
                    {
                        continue;
                    }

                    _connection.Trace(TraceLevels.Messages, "SSE: OnMessage({0})", sseEvent);

                    OnMessage(sseEvent);
                }
            }
        }