private ParameterDescription(string name, Section section, string definition, string multiplicity, IList<string> example, FieldType fieldType) { Name = name; Section = section; Definition = definition; Multiplicity = multiplicity; Example = example; _fieldType = fieldType; }
private static IList<ParameterDescription> Read(StreamReader reader) { string line; IList<ParameterDescription> result = new List<ParameterDescription>(); string name = null; Section section = null; string definition = null; string multiplicity = null; FieldType fieldType = new FieldType(); List<string> example = new List<string>(); string key = null; while ((line = reader.ReadLine()) != null){ if (string.IsNullOrEmpty(line)){ if (!string.IsNullOrEmpty(name) && section != null && !string.IsNullOrEmpty(definition)){ ParameterDescription parameterDescription = new ParameterDescription(name, section, definition, multiplicity, example, fieldType); result.Add(parameterDescription); } name = null; section = null; definition = null; multiplicity = null; example = new List<string>(); fieldType = new FieldType(); continue; } string value; if (line.Contains(":")){ key = line.Substring(0, line.IndexOf(':')); value = line.Substring(line.IndexOf(':') + 1).Trim(); } else{ value = line; } if (key == null){ continue; } if (key.StartsWith("name")){ name += value.Trim(); } else if (key.StartsWith("section")){ section = Section.findSection(value.Trim()); } else if (key.StartsWith("def")){ definition += value.Trim(); } else if (key.StartsWith("multiplicity")){ multiplicity += value.Trim(); } else if (key.StartsWith("example")){ example.Add(value.Trim()); } else if (key.StartsWith("quantification")){ string[] split = value.Split('|'); if (split.Length == 2){ fieldType.Add(MzTabType.Quantification, MzTabMode.Summary, split[0]); fieldType.Add(MzTabType.Quantification, MzTabMode.Complete, split[1]); } } else if (key.StartsWith("identification")){ string[] split = value.Split('|'); if (split.Length == 2){ fieldType.Add(MzTabType.Identification, MzTabMode.Summary, split[0]); fieldType.Add(MzTabType.Identification, MzTabMode.Complete, split[1]); } } } return result; }