Skip to content
代码片段 群组 项目
提交 eae3e300 编辑于 作者: Paddy Xu's avatar Paddy Xu
浏览文件

mistake ...

上级 30c0c29d
No related branches found
No related tags found
无相关合并请求
......@@ -19,6 +19,7 @@ using System;
using System.IO;
using System.Linq;
using System.Windows;
using QuickLook.Common.ExtensionMethods;
using QuickLook.Common.Plugin;
namespace QuickLook.Plugin.PluginInstaller
......@@ -29,6 +30,7 @@ namespace QuickLook.Plugin.PluginInstaller
public void Init()
{
CleanupOldPlugins(App.UserPluginPath);
}
public bool CanHandle(string path)
......@@ -58,5 +60,23 @@ namespace QuickLook.Plugin.PluginInstaller
public void Cleanup()
{
}
private static void CleanupOldPlugins(string folder)
{
if (!Directory.Exists(folder))
return;
Directory.GetFiles(folder, "*.to_be_deleted", SearchOption.AllDirectories).ForEach(file =>
{
try
{
File.Delete(file);
}
catch (Exception)
{
// ignored
}
});
}
}
}
\ No newline at end of file
......@@ -52,7 +52,7 @@ namespace QuickLook.Plugin.PluginInstaller
btnInstall.Content = "Installing ...";
btnInstall.IsEnabled = false;
var t=DoInstall();
var t = DoInstall();
t.ContinueWith(_ =>
Dispatcher.BeginInvoke(new Action(() => btnInstall.Content = "Done! Please restart QuickLook.")));
t.Start();
......@@ -72,6 +72,7 @@ namespace QuickLook.Plugin.PluginInstaller
catch (Exception ex)
{
Dispatcher.BeginInvoke(new Action(() => description.Text = ex.Message));
Dispatcher.BeginInvoke(new Action(() => btnInstall.Content = "Installation failed."));
CleanUp();
}
});
......@@ -87,11 +88,13 @@ namespace QuickLook.Plugin.PluginInstaller
try
{
Directory.GetFiles(targetFolder, "*", SearchOption.AllDirectories)
.ForEach(file => File.Move(file, new Guid() + ".to_be_deleted"));
.ForEach(file => File.Move(file,
Path.Combine(Path.GetDirectoryName(file), Guid.NewGuid() + ".to_be_deleted")));
}
catch (Exception ex)
{
Dispatcher.BeginInvoke(new Action(() => description.Text = ex.Message));
Dispatcher.BeginInvoke(new Action(() => btnInstall.Content = "Installation failed."));
}
}
}
......
......@@ -81,7 +81,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\QuickLook.Common\QuickLook.Common.csproj">
<Project>{85FDD6BA-871D-46C8-BD64-F6BB0CB5EA95}</Project>
<Project>{85fdd6ba-871d-46c8-bd64-f6bb0cb5ea95}</Project>
<Name>QuickLook.Common</Name>
<Private>False</Private>
</ProjectReference>
......
......@@ -33,7 +33,6 @@ namespace QuickLook
private PluginManager()
{
CleanupOldPlugins(App.UserPluginPath);
LoadPlugins(App.UserPluginPath);
LoadPlugins(Path.Combine(App.AppPath, "QuickLook.Plugin\\"));
InitLoadedPlugins();
......@@ -113,23 +112,5 @@ namespace QuickLook
}
});
}
private static void CleanupOldPlugins(string folder)
{
if (!Directory.Exists(folder))
return;
Directory.GetFiles(folder, "*.to_be_deleted", SearchOption.AllDirectories).ForEach(file =>
{
try
{
File.Delete(file);
}
catch (Exception)
{
// ignored
}
});
}
}
}
\ No newline at end of file
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册