Add browse more plugin and theme link to setting dialog.

This commit is contained in:
qianlifeng
2014-07-16 20:17:51 +08:00
parent 088c3984d8
commit 5c373f0d25
12 changed files with 117 additions and 112 deletions

View File

@@ -55,28 +55,28 @@ namespace Wox.Helper
public static ImageSource Load(string path)
{
ImageSource img = null;
if (path == null) return null;
if (string.IsNullOrEmpty(path)) return null;
if (imageCache.ContainsKey(path))
{
return imageCache[path];
}
ImageSource img = null;
string ext = Path.GetExtension(path).ToLower();
string resolvedPath = string.Empty;
if (!string.IsNullOrEmpty(path) && path.Contains(":\\") && File.Exists(path))
if (path.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
{
resolvedPath = path;
img = new BitmapImage(new Uri(path));
}
else if (selfExts.Contains(ext))
{
img = GetIcon(path);
}
else if (!string.IsNullOrEmpty(path) && imageExts.Contains(ext) && File.Exists(path))
{
img = new BitmapImage(new Uri(path));
}
if (selfExts.Contains(ext))
{
img = GetIcon(resolvedPath);
}
else if (!string.IsNullOrEmpty(resolvedPath) && imageExts.Contains(ext) && File.Exists(resolvedPath))
{
img = new BitmapImage(new Uri(resolvedPath));
}
if (img != null)
{

View File

@@ -60,9 +60,9 @@ namespace Wox.Helper
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
if (existingPlugin != null && Directory.Exists(existingPlugin.Metadata.PluginDirecotry))
if (existingPlugin != null && Directory.Exists(existingPlugin.Metadata.PluginDirectory))
{
File.Create(Path.Combine(existingPlugin.Metadata.PluginDirecotry, "NeedDelete.txt")).Close();
File.Create(Path.Combine(existingPlugin.Metadata.PluginDirectory, "NeedDelete.txt")).Close();
}
UnZip(path, newPluginPath, true);
@@ -106,7 +106,7 @@ namespace Wox.Helper
{
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
metadata.PluginType = PluginType.ThirdParty;
metadata.PluginDirecotry = pluginDirectory;
metadata.PluginDirectory = pluginDirectory;
}
catch (Exception)
{