public static GradeOption Parse(Parser parser, int startindent) { if (parser.curr.kw != Parser.RegKeywords.None) { throw parser.GetException("expected description only"); } var option = new GradeOption(); option.Description = parser.GetLine(); if (parser.curr.indent <= startindent) { throw parser.GetException("expected greater indent"); } if (parser.curr.kw != Parser.RegKeywords.Code) { throw parser.GetException("expected Code"); } var code = parser.GetNullInt(); if (!code.HasValue) { parser.lineno--; throw parser.GetException("expected integer code"); } option.Code = code.Value; return(option); }
// ReSharper disable once MemberHidesStaticFromOuterClass public static GradeOption ReadXml(XElement e) { var option = new GradeOption { Description = e.Value, Code = e.Attribute("Code")?.Value.ToInt2() ?? 0 }; return option; }
// ReSharper disable once MemberHidesStaticFromOuterClass public static GradeOption ReadXml(XElement e) { var option = new GradeOption { Description = e.Value, Code = e.Attribute("Code")?.Value.ToInt2() ?? 0 }; return(option); }
public new static AskGradeOptions ReadXml(XElement e) { var go = new AskGradeOptions(); go.Label = e.Element("Label")?.Value; foreach (var ele in e.Elements("GradeOption")) { go.list.Add(GradeOption.ReadXml(ele)); } return(go); }
public static AskGradeOptions Parse(Parser parser) { var go = new AskGradeOptions(); go.Label = parser.GetString("AskGradeOptions"); if (parser.curr.indent == 0) { throw parser.GetException("expected indented Options"); } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var option = GradeOption.Parse(parser, startindent); if (go.list.All(gg => gg.Code != option.Code)) { go.list.Add(option); } } return(go); }
public static GradeOption Parse(Parser parser, int startindent) { if (parser.curr.kw != Parser.RegKeywords.None) throw parser.GetException("expected description only"); var option = new GradeOption(); option.Description = parser.GetLine(); if (parser.curr.indent <= startindent) throw parser.GetException("expected greater indent"); if (parser.curr.kw != Parser.RegKeywords.Code) throw parser.GetException("expected Code"); var code = parser.GetNullInt(); if (!code.HasValue) { parser.lineno--; throw parser.GetException("expected integer code"); } option.Code = code.Value; return option; }