private ContentItem CreateContentItem(string pageURL, string source, int startIndex, ContentList contentList)
        {
            if (source == null) throw new Exception("Unable to get content, source is blank.");

            source = source.Substring(startIndex);

            var content = new ContentItem();
            content.SetParams(pageURL, source, contentDir, contentList, DownloadStartedCallback, DownloadCompletedCallback);
            return content;
        }
 public CreateListOfContentItems(string htmlDirectory, ContentList contentListToDisplay)
     : base(htmlDirectory, PATH_TO_INCLUDE_FILES, contentListToDisplay.Name, true)
 {
     this.contentList = contentListToDisplay;
 }
 public static void SetParams(this ContentItem content, string pageURL, string source, string contentDir, ContentList contentList, EventHandler<AsyncCompletedEventArgs> downloadStartedCallback, EventHandler<AsyncCompletedEventArgs> downloadCompletedCallback)
 {
     string nameAndArtist = content.SetContentNameAndArtist(source);
     content.SetContentTagsAndOwnership(source);
     content.SetProductURL(source);
     content.SetEditURL(source);
     content.DeleteURL = pageURL;    // no way to delete except to load list page and click delete button there
     content.SetAndRetrieveImage(source, contentDir + @"\" + contentList.DirectoryName, downloadStartedCallback, downloadCompletedCallback );
     content.SetRating(source);
 }
        private ContentList GetListInfo(string source, int startIndex)
        {
            if (source == null) throw new Exception("Unable to get list, source is blank.");

            source = source.Substring(startIndex);

            var contentList = new ContentList();
            contentList.SetParams(source);
            return contentList;
        }
        private List<ContentItem> GetContentItemsOnPage(string pageURL, string sourceCode, ContentList contentList)
        {
            var contentItems = new List<ContentItem>();
            if (sourceCode == null) return contentItems;

            int startIndex = 0;
            while (true)
            {
                // New Item
                startIndex = sourceCode.IndexOf(EACH_ITEM_BEGINS, startIndex);
                if (startIndex < 0) break;
                startIndex += EACH_ITEM_BEGINS.Length;

                try
                {
                    contentItems.Add(CreateContentItem(pageURL, sourceCode, startIndex, contentList));
                }
                catch (Exception ex)
                {
                    Console.Beep();
                    Console.WriteLine("Caught exception: " + ex.ToString().Substring(0, 160));
                    Console.WriteLine(ex.StackTrace);
                    Console.WriteLine("Press any key to continue...");
                    Console.Read();
                }
            }

            return contentItems;
        }