mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 10:19:07 +00:00
mistake ...
This commit is contained in:
@@ -19,6 +19,7 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using QuickLook.Common.ExtensionMethods;
|
||||||
using QuickLook.Common.Plugin;
|
using QuickLook.Common.Plugin;
|
||||||
|
|
||||||
namespace QuickLook.Plugin.PluginInstaller
|
namespace QuickLook.Plugin.PluginInstaller
|
||||||
@@ -29,6 +30,7 @@ namespace QuickLook.Plugin.PluginInstaller
|
|||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
|
CleanupOldPlugins(App.UserPluginPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanHandle(string path)
|
public bool CanHandle(string path)
|
||||||
@@ -58,5 +60,23 @@ namespace QuickLook.Plugin.PluginInstaller
|
|||||||
public void Cleanup()
|
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.Content = "Installing ...";
|
||||||
btnInstall.IsEnabled = false;
|
btnInstall.IsEnabled = false;
|
||||||
|
|
||||||
var t=DoInstall();
|
var t = DoInstall();
|
||||||
t.ContinueWith(_ =>
|
t.ContinueWith(_ =>
|
||||||
Dispatcher.BeginInvoke(new Action(() => btnInstall.Content = "Done! Please restart QuickLook.")));
|
Dispatcher.BeginInvoke(new Action(() => btnInstall.Content = "Done! Please restart QuickLook.")));
|
||||||
t.Start();
|
t.Start();
|
||||||
@@ -72,6 +72,7 @@ namespace QuickLook.Plugin.PluginInstaller
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Dispatcher.BeginInvoke(new Action(() => description.Text = ex.Message));
|
Dispatcher.BeginInvoke(new Action(() => description.Text = ex.Message));
|
||||||
|
Dispatcher.BeginInvoke(new Action(() => btnInstall.Content = "Installation failed."));
|
||||||
CleanUp();
|
CleanUp();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -87,11 +88,13 @@ namespace QuickLook.Plugin.PluginInstaller
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Directory.GetFiles(targetFolder, "*", SearchOption.AllDirectories)
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Dispatcher.BeginInvoke(new Action(() => description.Text = ex.Message));
|
Dispatcher.BeginInvoke(new Action(() => description.Text = ex.Message));
|
||||||
|
Dispatcher.BeginInvoke(new Action(() => btnInstall.Content = "Installation failed."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\QuickLook.Common\QuickLook.Common.csproj">
|
<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>
|
<Name>QuickLook.Common</Name>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
@@ -33,7 +33,6 @@ namespace QuickLook
|
|||||||
|
|
||||||
private PluginManager()
|
private PluginManager()
|
||||||
{
|
{
|
||||||
CleanupOldPlugins(App.UserPluginPath);
|
|
||||||
LoadPlugins(App.UserPluginPath);
|
LoadPlugins(App.UserPluginPath);
|
||||||
LoadPlugins(Path.Combine(App.AppPath, "QuickLook.Plugin\\"));
|
LoadPlugins(Path.Combine(App.AppPath, "QuickLook.Plugin\\"));
|
||||||
InitLoadedPlugins();
|
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