mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
mistake ...
This commit is contained in:
@@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user