private bool ParseResponseLine(string line)
        {
            if (line == null)
            {
                return(false);
            }

            string[] parts = line.Split(' ');

            if (parts.Length < 3)
            {
                return(false);
            }

            Version = parts[0];

            if (!int.TryParse(parts[1], out var code))
            {
                return(false);
            }
            else if (NetwrkHttpStatusCode.TryParse(code, out var statusCode))
            {
                StatusCode = statusCode;
            }
            else
            {
                StatusCode = new NetwrkHttpStatusCode(code, string.Join(" ", parts, 2, parts.Length - 2));
            }

            return(true);
        }
Exemple #2
0
 public static bool TryParse(int code, out NetwrkHttpStatusCode statusCode) => codes.TryGetValue(code, out statusCode);