public static TermLink FromPosting ( [NotNull] TermPosting posting ) { Sure.NotNull(posting, "posting"); TermLink result = new TermLink { Mfn = posting.Mfn, Tag = posting.Tag, Occurrence = posting.Occurrence, Index = posting.Count }; return(result); }
public static TermPosting[] Parse ( [NotNull] ServerResponse response ) { Sure.NotNull(response, nameof(response)); // Example return: // 169#1510#1#2#Пожаровзрывобезопасность : Науч.- техн. журн. - Журнал List <TermPosting> result = new List <TermPosting>(); while (true) { string line = response.GetUtfString(); if (string.IsNullOrEmpty(line)) { break; } string[] parts = line.Split(CommonSeparators.NumberSign, 5); if (parts.Length < 4) { break; } TermPosting item = new TermPosting { Mfn = int.Parse(parts[0]), Tag = int.Parse(parts[1]), Occurrence = int.Parse(parts[2]), Count = int.Parse(parts[3]), Text = parts.GetItem(4) }; result.Add(item); } return(result.ToArray()); }