This commit is contained in:
Paddy Xu
2017-04-30 02:27:07 +03:00
parent f5d9dc3e14
commit f11c59be01
30 changed files with 807 additions and 48 deletions

View File

@@ -15,9 +15,16 @@ namespace QuickLook.Plugin.ArchiveViewer
public void Dispose()
{
GC.SuppressFinalize(this);
IconManager.ClearCache();
}
~ArchiveFileListView()
{
Dispose();
}
public void SetDataContext(object context)
{
treeGrid.DataContext = context;

View File

@@ -28,9 +28,16 @@ namespace QuickLook.Plugin.ArchiveViewer
public void Dispose()
{
GC.SuppressFinalize(this);
fileListView.Dispose();
}
~ArchiveInfoPanel()
{
Dispose();
}
private void LoadArchive(string path)
{
LoadItemsFromArchive(path);

View File

@@ -16,10 +16,9 @@ namespace QuickLook.Plugin.ArchiveViewer
if (Directory.Exists(path))
return false;
SevenZipExtractor archive = null;
try
{
using (archive = new SevenZipExtractor(path))
using (var archive = new SevenZipExtractor(path))
{
// dummy access to the data. If it throws exception, return false
if (archive.ArchiveFileData == null)
@@ -42,10 +41,6 @@ namespace QuickLook.Plugin.ArchiveViewer
{
return false;
}
finally
{
archive?.Dispose();
}
return true;
}
@@ -63,9 +58,16 @@ namespace QuickLook.Plugin.ArchiveViewer
container.Title = $"{Path.GetFileName(path)}";
}
public void Close()
public void Dispose()
{
_panel.Dispose();
GC.SuppressFinalize(this);
_panel?.Dispose();
}
~Plugin()
{
Dispose();
}
}
}

View File

@@ -36,6 +36,7 @@
<Reference Include="PresentationFramework" />
<Reference Include="SevenZipSharp">
<HintPath>References\SevenZipSharp.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />