/// <summary>
        /// Creates a new writer given a stream
        /// </summary>
        /// <param name="s">the stream to write to</param>
        public ConsoleBitmapStreamWriter(Stream s)
        {
            this.outputStream = s;
            this.serializer   = new ConsoleBitmapFrameSerializer();
            this.writer       = new StreamWriter(s);

            if (s.CanSeek == false)
            {
                throw new ArgumentOutOfRangeException("Stream must be able to seek");
            }
            s.Write(new byte[sizeof(long)], 0, sizeof(long)); // write an empty space for the total time


            this.LifetimeManager.Manage(this.WriteEnd);
        }
예제 #2
0
        /// <summary>
        /// Creates a new writer given a stream
        /// </summary>
        /// <param name="s">the stream to write to</param>
        public ConsoleBitmapStreamWriter(Stream s)
        {
            this.outputStream = s;
            this.serializer   = new ConsoleBitmapFrameSerializer();
            this.writer       = new StreamWriter(s);

            if (s.CanSeek == false)
            {
                throw new ArgumentOutOfRangeException("Stream must be able to seek");
            }
            s.Write(new byte[DurationLineLength], 0, DurationLineLength); // write an empty space for the total time + newline


            this.OnDisposed(this.WriteEnd);
        }
예제 #3
0
 /// <summary>
 /// Creates a new reader from a given stream
 /// </summary>
 /// <param name="s">a stream to read</param>
 public ConsoleBitmapStreamReader(Stream s)
 {
     this.inputStream = s;
     this.reader      = new StreamReader(inputStream);
     this.serializer  = new ConsoleBitmapFrameSerializer();
 }