/// <summary> /// Loads the blog posts. /// </summary> private void LoadBlogPosts() { var bi = new BlogImporter(); Utils.Log("BlogReader.LoadBlogPosts: Start importing posts"); foreach (BlogMlExtendedPost extPost in blogsExtended) { try { BlogMlExtendedPost post = extPost; if (extPost.BlogPost.Categories.Count > 0) { for (var i = 0; i < extPost.BlogPost.Categories.Count; i++) { int i2 = i; var cId = new Guid(post.BlogPost.Categories[i2].Ref); foreach (var category in categoryLookup) { if (category.Id == cId) { if (extPost.Categories == null) { extPost.Categories = new StateList <Category>(); } extPost.Categories.Add(category); } } } } if (!string.IsNullOrEmpty(bi.AddPost(extPost))) { PostCount++; } else { Utils.Log("Post '{0}' has been skipped" + extPost.BlogPost.Title); } } catch (Exception ex) { Utils.Log("BlogReader.LoadBlogPosts: " + ex.Message); } } bi.ForceReload(); Utils.Log(string.Format("BlogReader.LoadBlogPosts: Completed importing {0} posts", PostCount)); }
/// <summary> /// Loads the blog posts. /// </summary> private void LoadBlogPosts() { var bi = new BlogImporter(); Utils.Log("BlogReader.LoadBlogPosts: Start importing posts"); foreach (BlogMlExtendedPost extPost in blogsExtended) { try { BlogMlExtendedPost post = extPost; if (extPost.BlogPost.Categories.Count > 0) { for (var i = 0; i < extPost.BlogPost.Categories.Count; i++) { int i2 = i; var cId = new Guid(post.BlogPost.Categories[i2].Ref); foreach (var category in categoryLookup) { if (category.Id == cId) { if (extPost.Categories == null) extPost.Categories = new StateList<Category>(); extPost.Categories.Add(category); } } } } if (!string.IsNullOrEmpty(bi.AddPost(extPost))) { PostCount++; } else { Utils.Log("Post '{0}' has been skipped" + extPost.BlogPost.Title); } } catch (Exception ex) { Utils.Log("BlogReader.LoadBlogPosts: " + ex.Message); } } bi.ForceReload(); Utils.Log(string.Format("BlogReader.LoadBlogPosts: Completed importing {0} posts", PostCount)); }