private static void ProcessMagazine ( [NotNull] MagazineInfo magazine ) { Console.WriteLine(magazine); MagazineIssueInfo[] issues = _manager.GetIssues(magazine, _year); List <string> registered = new List <string>(issues.Length); foreach (MagazineIssueInfo issue in issues) { ExemplarInfo[] exemplars = issue.Exemplars; if (!ReferenceEquals(exemplars, null)) { foreach (ExemplarInfo exemplar in exemplars) { string number = issue.Number; if (!ReferenceEquals(number, null) && exemplar.KsuNumber1.SameString(_period)) { registered.Add(issue.Number); break; } } } } registered = NumberText.Sort(registered).Distinct().ToList(); if (registered.Count == 0) { Console.WriteLine(Resources.T0, string.Empty); } else { PeriodInfo info = new PeriodInfo { Title = magazine.ExtendedTitle, Registered = CompressIfPossible(registered) }; _list.Add(info); Console.WriteLine(Resources.T0, info.Registered); } }
private static void ProcessMagazine ( [NotNull] MagazineInfo magazine ) { Console.WriteLine(magazine); if (ReferenceEquals(magazine.QuarterlyOrders, null)) { Console.WriteLine(Resources.HaventOrders); return; } QuarterlyOrderInfo order = magazine.QuarterlyOrders.FirstOrDefault ( o => o.Period.SameString(_period) ); if (ReferenceEquals(order, null) || string.IsNullOrEmpty(order.FirstIssue) || string.IsNullOrEmpty(order.LastIssue)) { Console.WriteLine(Resources.NoOrderInfoFor, _period); return; } MagazineIssueInfo[] issues = _manager.GetIssues(magazine, _year); string[] registered = issues.Select(i => i.Number).ToArray(); registered = NumberText.Sort(registered).ToArray(); NumberText first = order.FirstIssue; NumberText current = first.Clone(); NumberText last = order.LastIssue; PeriodInfo info = new PeriodInfo { Title = magazine.ExtendedTitle, Expected = first + "-" + last, Registered = CompressIfPossible(registered) }; _list.Add(info); List <string> missingIssues = new List <string>(); while (current <= last) { MagazineIssueInfo found = issues.FirstOrDefault ( i => Match(i.Number, current) ); if (ReferenceEquals(found, null)) { missingIssues.Add(current.ToString()); } current = current.Increment(); } info.Missing = CompressIfPossible(missingIssues); Console.WriteLine(Resources.Present, info.Registered); Console.WriteLine(Resources.Missing, info.Missing); }