private void ReadResponse()
{
string buf;
messages = "";
while (true)
{
//buf = main_sock_LineReader.ReadLine();
buf = main_sock_LineReader.ReadUntilString((byte)'\n', Encoding.ASCII, IncludeExpectedByte:false);
#if (FTP_DEBUG)
Console.WriteLine(buf);
#endif
// the server will respond with "000-Foo bar" on multi line responses
// "000 Foo bar" would be the last line it sent for that response.
// Better example:
// "000-This is a multiline response"
// "000-Foo bar"
// "000 This is the end of the response"
if (Regex.Match(buf, "^[0-9]+ ").Success)
{
responseStr = buf;
response = int.Parse(buf.Substring(0, 3));
break;
}
else
messages += Regex.Replace(buf, "^[0-9]+-", "") + "\n";
}
}