public static ExtendedPocketItem Extend(this PocketItem item) { var extendedItem = new ExtendedPocketItem(); item.CopyItem(extendedItem); //var json = JsonConvert.SerializeObject(item); //var extended = JsonConvert.DeserializeObject<ExtendedPocketItem>(json); ////extended.Excerpt = string.Empty; return(extendedItem); }
public static ReaderItem ToReaderItem(this ExtendedPocketItem article) { var result = new ReaderItem { Id = article.ResolvedId ?? string.Empty, Source = SourceProvider.Pocket, Author = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty, Title = article.DisplayTitle ?? string.Empty, Text = string.Empty, Url = article.Uri.ToString() ?? string.Empty, Excerpt = article.Excerpt ?? string.Empty, CreatedDate = article.UpdateTime ?? DateTime.Now }; result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] { ' ' }).Length; return(result); }