mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
restore VFS after extraction if needed.
This commit is contained in:
parent
ee14a418c0
commit
23b2970fa8
@ -111,7 +111,7 @@ namespace GARbro.GUI
|
|||||||
private MainWindow m_main;
|
private MainWindow m_main;
|
||||||
private string m_arc_name;
|
private string m_arc_name;
|
||||||
private ArchiveFileSystem m_fs;
|
private ArchiveFileSystem m_fs;
|
||||||
private readonly bool m_should_dispose;
|
private readonly bool m_should_ascend;
|
||||||
private bool m_skip_images = false;
|
private bool m_skip_images = false;
|
||||||
private bool m_skip_script = false;
|
private bool m_skip_script = false;
|
||||||
private bool m_skip_audio = false;
|
private bool m_skip_audio = false;
|
||||||
@ -127,21 +127,18 @@ namespace GARbro.GUI
|
|||||||
|
|
||||||
public GarExtract (MainWindow parent, string source)
|
public GarExtract (MainWindow parent, string source)
|
||||||
{
|
{
|
||||||
m_main = parent;
|
|
||||||
m_arc_name = Path.GetFileName (source);
|
m_arc_name = Path.GetFileName (source);
|
||||||
FormatCatalog.Instance.LastError = null;
|
try
|
||||||
var arc = ArcFile.TryOpen (source);
|
|
||||||
if (null == arc)
|
|
||||||
{
|
{
|
||||||
string error_message;
|
VFS.ChDir (source);
|
||||||
if (FormatCatalog.Instance.LastError != null)
|
m_should_ascend = true;
|
||||||
error_message = FormatCatalog.Instance.LastError.Message;
|
|
||||||
else
|
|
||||||
error_message = garStrings.MsgUnknownFormat;
|
|
||||||
throw new OperationCanceledException (string.Format ("{1}: {0}", error_message, m_arc_name));
|
|
||||||
}
|
}
|
||||||
m_fs = arc.CreateFileSystem();
|
catch (Exception X)
|
||||||
m_should_dispose = true;
|
{
|
||||||
|
throw new OperationCanceledException (string.Format ("{1}: {0}", X.Message, m_arc_name));
|
||||||
|
}
|
||||||
|
m_fs = VFS.Top as ArchiveFileSystem;
|
||||||
|
m_main = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GarExtract (MainWindow parent, string source, ArchiveFileSystem fs)
|
public GarExtract (MainWindow parent, string source, ArchiveFileSystem fs)
|
||||||
@ -151,7 +148,7 @@ namespace GARbro.GUI
|
|||||||
m_fs = fs;
|
m_fs = fs;
|
||||||
m_main = parent;
|
m_main = parent;
|
||||||
m_arc_name = Path.GetFileName (source);
|
m_arc_name = Path.GetFileName (source);
|
||||||
m_should_dispose = false;
|
m_should_ascend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrepareDestination (string destination)
|
private void PrepareDestination (string destination)
|
||||||
@ -443,8 +440,10 @@ namespace GARbro.GUI
|
|||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
{
|
{
|
||||||
if (m_should_dispose)
|
if (m_should_ascend)
|
||||||
m_fs.Dispose();
|
{
|
||||||
|
VFS.ChDir ("..");
|
||||||
|
}
|
||||||
disposed = true;
|
disposed = true;
|
||||||
}
|
}
|
||||||
GC.SuppressFinalize (this);
|
GC.SuppressFinalize (this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user