Skip to content
This repository has been archived by the owner on Apr 21, 2020. It is now read-only.

Support IE #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions source/IEBookmarks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Wox.Plugin.BrowserBookmark
{
class IEBookmarks
{
public static List<Bookmark> GetBookmarks()
{
List<Bookmark> bookmarks = new List<Bookmark>();
string path = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
foreach (var enumerateFile in Directory.GetFiles(path, "*", SearchOption.AllDirectories))
{
Bookmark bookmark = GetBookmark(enumerateFile);
if (bookmark != null)
{
bookmarks.Add(bookmark);
}
}

return bookmarks;
}

private static Bookmark GetBookmark(string path)
{
FileInfo fileInfo = new FileInfo(path);
const string keyName = "URL=";
foreach (var readLine in File.ReadLines(path))
{
if (readLine.StartsWith(keyName))
{
string url = readLine.Substring(keyName.Length);
if (string.IsNullOrEmpty(url))
{
continue;
}

return new Bookmark()
{
Name = fileInfo.Name,
Url = readLine.Substring(keyName.Length),
};
}
}

return null;
}

}
}
4 changes: 3 additions & 1 deletion source/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public void Init(PluginInitContext context)
cachedBookmarks.AddRange(mozBookmarks.GetBookmarks());
// Add Chrome bookmarks
cachedBookmarks.AddRange(chromeBookmarks.GetBookmarks());

// Add IE bookmarks
cachedBookmarks.AddRange(IEBookmarks.GetBookmarks());

cachedBookmarks = cachedBookmarks.Distinct().ToList();
}

Expand Down
1 change: 1 addition & 0 deletions source/Wox.Plugin.BrowserBookmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<Compile Include="Bookmark.cs" />
<Compile Include="ChromeBookmarks.cs" />
<Compile Include="FirefoxBookmarks.cs" />
<Compile Include="IEBookmarks.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand Down