Example #1
0
        private FirefoxBookmarkLink RowToLink(FirefoxBookmarkRow row)
        {
            var link = new FirefoxBookmarkLink()
            {
                Id              = row.Id,
                Title           = row.Title,
                LastModified    = DateTimeHelper.FromUnixTimeStamp(row.LastModified),
                Added           = DateTimeHelper.FromUnixTimeStamp(row.DateAdded),
                Url             = row.Url ?? string.Empty,
                LastVisit       = DateTimeHelper.FromUnixTimeStamp(row.LastVisit),
                VisitCount      = (int?)row.VisitCount,
                IconContentType = row.FaviconContentType,
                IconData        = row.FaviconData,
                IconUrl         = row.FaviconUrl,
            };

            if (link.Url.StartsWith("places:", StringComparison.CurrentCultureIgnoreCase))
            {
                link.Internal = true;
            }
            if (row.Attributes != null)
            {
                foreach (var attr in row.Attributes)
                {
                    var attrName = attr.AttributeName.ToLower();
                    switch (attrName)
                    {
                    case "livemark/feeduri":
                        link.FeedUrl = attr.AttributeValue;
                        break;

                    case "livemark/siteuri":
                        link.Url = attr.AttributeValue;
                        break;

                    case "bookmarkproperties/description":
                        link.Description = attr.AttributeValue;
                        break;

                    case "places/excludefrombackup":
                        link.ExcludeFromBackup = attr.AttributeValue == "1";
                        break;
                    }
                    if (attrName.StartsWith("places/", StringComparison.CurrentCultureIgnoreCase))
                    {
                        link.Internal = true;
                    }
                }
            }

            return(link);
        }
        private FirefoxBookmarkLink RowToLink(FirefoxBookmarkRow row)
        {
            var link = new FirefoxBookmarkLink()
            {
                Id = row.Id,
                Title = row.Title,
                LastModified = DateTimeHelper.FromUnixTimeStamp(row.LastModified),
                Added = DateTimeHelper.FromUnixTimeStamp(row.DateAdded),
                Url = row.Url??string.Empty,
                LastVisit = DateTimeHelper.FromUnixTimeStamp(row.LastVisit),
                VisitCount = (int?)row.VisitCount,
                IconContentType = row.FaviconContentType,
                IconData = row.FaviconData,
                IconUrl = row.FaviconUrl,
            };
            if (link.Url.StartsWith("places:", StringComparison.CurrentCultureIgnoreCase))
                link.Internal = true;
            if (row.Attributes != null)
            {
                foreach (var attr in row.Attributes)
                {
                    var attrName = attr.AttributeName.ToLower();
                    switch (attrName)
                    {
                        case "livemark/feeduri":
                            link.FeedUrl = attr.AttributeValue;
                            break;
                        case "livemark/siteuri":
                            link.Url = attr.AttributeValue;
                            break;
                        case "bookmarkproperties/description":
                            link.Description = attr.AttributeValue;
                            break;
                        case "places/excludefrombackup":
                            link.ExcludeFromBackup = attr.AttributeValue == "1";
                            break;
                    }
                    if (attrName.StartsWith("places/", StringComparison.CurrentCultureIgnoreCase))
                        link.Internal = true;
                }
            }

            return link;
        }