public override void Parse(XElement element) { var pairs = element.Descendants("series_work"); if (pairs.Any()) { var dict = new Dictionary <long, SeriesResource>(); foreach (var pair in pairs) { var series = new SeriesResource(); series.Parse(pair.Element("series")); if (!dict.TryGetValue(series.Id, out var cached)) { dict[series.Id] = series; cached = series; } var work = new WorkResource(); work.Parse(pair.Element("work")); work.SetSeriesInfo(pair); cached.Works.Add(work); } List = dict.Values.ToList(); } else { List = new List <SeriesResource>(); } }
public override void Parse(XElement element) { Series = new SeriesResource(); Series.Parse(element); Series.Works = element.ParseChildren <WorkResource>("series_works", "series_work"); }