private static bool ParseResponseArray(List <string> lines, out string[] result)
        {
            result = null;
            if (lines == null || lines.Count == 0)
            {
                return(false);
            }
            if (!SmtpResponseParser.IsValidStatusCode(lines[0]))
            {
                return(false);
            }
            string text = lines[0].Substring(0, 3);
            EnhancedStatusCodeImpl enhancedStatusCodeImpl;
            string text2 = EnhancedStatusCodeImpl.TryParse(lines[0], 4, out enhancedStatusCodeImpl) ? enhancedStatusCodeImpl.Value : string.Empty;

            if (!SmtpResponseParser.ValidateLines(lines, text, ref text2))
            {
                return(false);
            }
            int num = 4;

            if (!string.IsNullOrEmpty(text2))
            {
                num += text2.Length;
                if (num < lines[0].Length && lines[0][num] == ' ')
                {
                    num++;
                }
            }
            List <string> list = new List <string>(lines.Count);

            for (int i = 0; i < lines.Count; i++)
            {
                string text3 = (lines[i].Length > num) ? lines[i].Substring(num) : string.Empty;
                if (!string.IsNullOrEmpty(text3))
                {
                    list.Add(text3);
                }
            }
            if (list.Count == 0 && lines.Count > 1)
            {
                return(false);
            }
            result    = new string[list.Count + 2];
            result[0] = text;
            result[1] = text2;
            list.CopyTo(result, 2);
            return(true);
        }
        public static bool Split(string text, out string[] result)
        {
            result = null;
            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }
            if (text.Length < 3)
            {
                return(false);
            }
            List <string> lines = SmtpResponseParser.SplitLines(text);

            return(SmtpResponseParser.Split(lines, out result));
        }
 private static bool ValidateLines(List <string> lines, string statusCode, ref string enhancedStatusCode)
 {
     for (int i = 0; i < lines.Count; i++)
     {
         SmtpResponseParser.ValidationResult validationResult = SmtpResponseParser.ValidateLine(lines[i], statusCode, ref enhancedStatusCode);
         if (validationResult == SmtpResponseParser.ValidationResult.Error)
         {
             return(false);
         }
         if (validationResult == SmtpResponseParser.ValidationResult.LastLine && i != lines.Count - 1)
         {
             return(false);
         }
         if (validationResult == SmtpResponseParser.ValidationResult.HasMoreLines && i == lines.Count - 1)
         {
             return(false);
         }
     }
     return(true);
 }
 public static bool Split(List <string> lines, out string[] result)
 {
     return(SmtpResponseParser.ParseResponseArray(lines, out result));
 }