示例#1
0
        private MessageParser ParseGroup(string line, ref Group group)
        {
            var message = new MessageParser(true);

            foreach (var subject in ConfigurationModel.Subjects)
            {
                if (!line.Contains(subject))
                {
                    message.Success = false;
                    message.AddParseError($"Line missing subject:{subject}");
                }
            }

            var lineParts = line.Split(ConfigurationModel.PartingChar);

            if (lineParts.Length != ConfigurationModel.Subjects.Count() + 1)
            {
                message.Success = false;
                message.AddParseError($"Line has wrong number of items. Expected:{ConfigurationModel.Subjects.Count() + 1} Current:{lineParts.Length}");
                return(message);
            }

            if (message.Success)
            {
                ParseLine(ref group, ref message, lineParts);
            }


            if (!message.Success)
            {
                message.AddErrorData(line);
            }

            return(message);
        }