Пример #1
0
        public void TestMultipleWrites()
        {
            var encoding = Encoding.UTF8;

            CircularBufferStream stream = new CircularBufferStream(0x10000);
            var reader = new SafeLineReader(new StreamReader(stream, encoding));

            byte[] bytes = encoding.GetBytes(m_line1);
            stream.Write(bytes, 0, bytes.Length);


            bytes = encoding.GetBytes(m_line2);
            stream.Write(bytes, 0, bytes.Length);

            string[] lines = m_line2.Split('\n');

            Assert.AreEqual(m_line1.TrimEnd('\n'), reader.ReadLine());
            foreach (var line in lines.Take(lines.Length - 1))
            {
                var actual = reader.ReadLine();
                Assert.AreEqual(line.TrimEnd('\r'), actual);
            }


             //:tmi.twitch.tv 001 darkautumn :Welcome, GLHF!

        }
Пример #2
0
        public void TestFullRead()
        {
            var encoding = Encoding.UTF8;

            CircularBufferStream stream = new CircularBufferStream(0x10000);
            var reader = new SafeLineReader(new StreamReader(stream, encoding));

            byte[] bytes = encoding.GetBytes("one\ntwo\nthree\n");
            stream.Write(bytes, 0, bytes.Length);

            Assert.AreEqual("one", reader.ReadLine());
            Assert.AreEqual("two", reader.ReadLine());
            Assert.AreEqual("three", reader.ReadLine());
        }
Пример #3
0
 public IrcConnection(ClientType clientType)
 {
     m_reader = new SafeLineReader(new StreamReader(m_stream, m_encoding));
     m_clientType = clientType;
 }