private Clipping ParseClipping(List<string> rawClipping) { if (rawClipping.Count != 3) { return null; } Clipping clipping = new Clipping(); clipping.Content = rawClipping[0]; Match lineOne = Regex.Match(rawClipping[1], @"^(.+) \((.+)\)"); if (lineOne.Groups.Count < 2) { return clipping; } Tuple<string, string> bookAndAuthor = ParseLineOne(lineOne,rawClipping[1]); clipping.BookTitle = bookAndAuthor.Item1; clipping.Author = bookAndAuthor.Item2; Match lineTwo = Regex.Match(rawClipping[2], @"^- (.+?) Loc. ([0-9-]*?) +\| Added on (.+)"); if (lineTwo.Groups.Count < 3) { return clipping; } Tuple<Clipping.ClippingType, string, string> clippingTypeAndLocationAndDate = ParseLineTwo(lineTwo, rawClipping[2]); clipping.Type = clippingTypeAndLocationAndDate.Item1; clipping.Location = clippingTypeAndLocationAndDate.Item2; clipping.AddedOn = clippingTypeAndLocationAndDate.Item3; return clipping; }
public void AddClipping(Clipping clipping) { clippings.Add(clipping); }