将浏览器的所有书签传输到文本文件 [英] Transferring all Bookmarks of my Browser to a Text File

查看:136
本文介绍了将浏览器的所有书签传输到文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#Windows窗体应用程序(包括所有父文件夹)对如何将所有书签从浏览器传输到文本文件进行编码.我没有测试过)
http://stackoverflow.com/questions/945537/read-firefox-bookmarks-using-c [^ ]

对于下面的IE代码,应该做的工作

 字符串 folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
            字符串 []书签= Directory.GetFiles(folderPath);
             foreach (字符串 书签中的字符串)
            {
                Console.WriteLine(" ,s);
            }
            字符串 [] folderList = Directory.GetDirectories(folderPath);
            如果(folderList!= )
            {
                 foreach (( folderList中的字符串 f  stringList))
                {
                    书签= Directory.GetFiles(f);
                }
                 foreach (字符串 书签中的字符串)
                {
                    Console.WriteLine(" ,s);
                }
            } 



它将为您提供.url链接.如果您希望将确切的网站链接存储在此处,则可以阅读URL文件并查找 BASEURL ="http://somethinglikethis.com"
[更新]
chrome中的书签存储在 .. \ Local Settings \ Application Data \ Google \ Chrome \ User Data \ Default 中,称为书签.您可以通过解析文件来获取信息.您可以使用JSON库反序列化读取的数据.
您可以从 http://json.codeplex.com/releases/view/64935 [ ^ ],并使用以下程序作为参考
http://studioshorts.com/blog/2011/06/reading -google-chrome-bookmarks-with-c-net/ [ 解决方案

For FF try following Link(i have not tested it)
http://stackoverflow.com/questions/945537/read-firefox-bookmarks-using-c[^]

For IE code below should do the work

string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
            string[] bookmark = Directory.GetFiles(folderPath);
            foreach (string s in bookmark)
            {
                Console.WriteLine("Bookmark Address:={0}", s);
            }
            string[] folderList = Directory.GetDirectories(folderPath);
            if (folderList != null)
            {
                foreach (string f in folderList)
                {
                    bookmark = Directory.GetFiles(f);
                }
                foreach (string s in bookmark)
                {
                    Console.WriteLine("Bookmark Address:={0}", s);
                }
            }



It will give you the .url links. if you want the exact link to website stored there you can read the URL files and look for BASEURL="http://somethinglikethis.com"
[Update]
The Bookmark in chrome is stored @ ..\Local Settings\Application Data\Google\Chrome\User Data\Default in a file called bookmark.And you can get the information by parsing the file. You can use the JSON lib for deserializing the data read.
You can download JSON from http://json.codeplex.com/releases/view/64935[^] and use the following program as reference
http://studioshorts.com/blog/2011/06/reading-google-chrome-bookmarks-with-c-net/[^]
[/Update]
Hope this helps.


This is strictly application-dependent. Each browser has its own ways which are usually documented. Please address the Web site of the browser(s) you want to use.

—SA


这篇关于将浏览器的所有书签传输到文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆