コード例 #1
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            var repo      = new BookmarkRepository("peter");
            var Bookmarks = repo.GetBookmarks("AAA");

            return(View(Bookmarks));
        }
コード例 #2
0
        public List <Bookmark> GetBookmarks()
        {
            var user = GetCurrentUser();
            var repo = new BookmarkRepository(_connectionString);

            return(repo.GetBookmarks(user.Id));
        }
コード例 #3
0
        public void ReScanBookmarkThumbnails()
        {
            var repo      = new BookmarkRepository("peter");
            var bookmarks = repo.GetBookmarks("AAA");

            var thumbNailService = new ThumbnailExtractor();

            int count = 0;

            foreach (var section in bookmarks.Sections)
            {
                foreach (var link in section.links)
                {
                    try
                    {
                        if (String.IsNullOrEmpty(link.imgUrl) && count < 200)
                        {
                            count++;

                            var thumbnailLink = thumbNailService.GetSiteIconUrl(link.linkUrl);
                            if (!String.IsNullOrEmpty(thumbnailLink))
                            {
                                if (!thumbnailLink.StartsWith("http"))
                                {
                                    var linkUrl = new Uri(link.linkUrl);
                                    thumbnailLink = linkUrl.OriginalString.Replace(linkUrl.AbsolutePath, "") + thumbnailLink;
                                }

                                link.imgUrl = thumbnailLink;
                            }
                        }
                    }
                    catch { }
                }
            }


            repo.UpdateBookmarks(bookmarks);
        }