Esempio n. 1
0
        public static BookmarkCollection Retrive()
        {
            string appdata  = Environment.GetEnvironmentVariable("appdata");
            string filepath = Path.Combine(appdata, @"..\local\Google\Chrome\User Data\Default\Bookmarks");

            if (!File.Exists(filepath))
            {
                return(CreateEmpty());
            }

            Stream    stream = File.OpenRead(filepath);
            SetRecord record = Hake.Extension.ValueRecord.Json.Converter.ReadJson(stream) as SetRecord;

            stream.Dispose();
            if (record == null)
            {
                return(CreateEmpty());
            }
            SetRecord bookmarkbar = record.FromPath("roots.bookmark_bar") as SetRecord;
            SetRecord others      = record.FromPath("roots.other") as SetRecord;

            return(new BookmarkCollection()
            {
                BookmarkBar = RetriveFolder(bookmarkbar),
                Others = RetriveFolder(others)
            });
        }