private bool get_line( out byte[] line ) {
List<byte> ret = new List<byte>();
if ( !m_stream.CanRead ) {
line = ret.ToArray();
return false;
}
if ( !m_stream.CanSeek ) {
line = ret.ToArray();
return false;
}
int ch = m_stream.ReadByte();
if ( ch < 0 ) {
line = ret.ToArray();
return false;
}
while ( ch >= 0 ) {
if ( ch == 0x0d ) {
ch = m_stream.ReadByte();
if ( ch < 0 ) {
break;
} else if ( ch != 0x0a ) {
m_stream.Seek( -1, SeekOrigin.Current );
}
break;
} else if ( ch == 0x0a ) {
break;
}
ret.Add( (byte)ch );
ch = m_stream.ReadByte();
}
line = ret.ToArray();
return true;
}
}