Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CheckValid()

override bool System.Net.FtpControlStream.CheckValid ( ResponseDescription response,
ref int validThrough,
ref int completeLength )
inlineprotectedvirtual

Reimplemented from System.Net.CommandStream.

Definition at line 871 of file FtpControlStream.cs.

872 {
873 if (System.Net.NetEventSource.Log.IsEnabled())
874 {
875 System.Net.NetEventSource.Info(this, $"CheckValid({response.StatusBuffer})", "CheckValid");
876 }
877 if (response.StatusBuffer.Length < 4)
878 {
879 return true;
880 }
881 string text = response.StatusBuffer.ToString();
882 if (response.Status == -1)
883 {
884 if (!char.IsDigit(text[0]) || !char.IsDigit(text[1]) || !char.IsDigit(text[2]) || (text[3] != ' ' && text[3] != '-'))
885 {
886 return false;
887 }
888 response.StatusCodeString = text.Substring(0, 3);
889 response.Status = Convert.ToInt16(response.StatusCodeString, NumberFormatInfo.InvariantInfo);
890 if (text[3] == '-')
891 {
892 response.Multiline = true;
893 }
894 }
895 int num = 0;
896 while ((num = text.IndexOf("\r\n", validThrough, StringComparison.Ordinal)) != -1)
897 {
898 int num2 = validThrough;
899 validThrough = num + 2;
900 if (!response.Multiline)
901 {
903 return true;
904 }
905 if (text.Length > num2 + 4 && text.Substring(num2, 3) == response.StatusCodeString && text[num2 + 3] == ' ')
906 {
908 return true;
909 }
910 }
911 return true;
912 }
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)

References System.Net.NetEventSource.Info(), System.Globalization.NumberFormatInfo.InvariantInfo, System.Net.NetEventSource.Log, System.text, and System.Convert.ToInt16().