Exemplo n.º 1
0
		public MultipartDecoder(Stream InputStream, String Boundary)
		{
			this.InputStream = InputStream;
			this.StreamChunker = new StreamChunker(InputStream, 4096);
			this.Boundary = Boundary;
			this.BoundarySequence1 = Encoding.ASCII.GetBytes(Boundary);
			this.BoundarySequence2 = Encoding.ASCII.GetBytes("\r\n" + Boundary);
			this.EndHeadersSequence = Encoding.ASCII.GetBytes("\r\n\r\n");
		}
Exemplo n.º 2
0
        public void TestMethod1()
        {
            var InputStream = new MemoryStream(Encoding.UTF8.GetBytes("A-//-BCD::E"));
            MemoryStream TempStream;

            StreamChunker test = new StreamChunker(InputStream);

            TempStream = new MemoryStream();
            test.CopyUpToSequence(TempStream, Encoding.UTF8.GetBytes("-//-"));
            Assert.AreEqual("A", Encoding.UTF8.GetString(TempStream.ToArray()));

            TempStream = new MemoryStream();
            test.CopyUpToSequence(TempStream, Encoding.UTF8.GetBytes("::"));
            Assert.AreEqual("BCD", Encoding.UTF8.GetString(TempStream.ToArray()));

            TempStream = new MemoryStream();
            test.CopyUpToSequence(TempStream, Encoding.UTF8.GetBytes("**"));
            Assert.AreEqual("E", Encoding.UTF8.GetString(TempStream.ToArray()));
        }