Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Compress/ZipFile/Zip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ public void BreakTrrntZip(string filename)

~Zip()
{
ZipFileClose();
try
{
ZipFileCloseFailed();
}
catch
{
}
}


Expand Down
47 changes: 26 additions & 21 deletions Compress/ZipFile/ZipOpenWrite.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Compress.Support.Utils;
using Compress.Support.Utils;
using System.IO;
using FileInfo = RVIO.FileInfo;
using FileStream = RVIO.FileStream;
Expand Down Expand Up @@ -98,28 +98,33 @@ internal void EndOfCentralDirectoryWrite(ulong fileOffset = 0)

public void ZipFileCloseFailed()
{
switch (ZipOpen)
try
{
case ZipOpenType.Closed:
return;
case ZipOpenType.OpenRead:
if (_zipFs != null)
{
_zipFs.Close();
_zipFs.Dispose();
}
break;
case ZipOpenType.OpenWrite:
_zipFs.Flush();
_zipFs.Close();
_zipFs.Dispose();
if (_zipFileInfo != null)
RVIO.File.Delete(_zipFileInfo.FullName);
_zipFileInfo = null;
break;
switch (ZipOpen)
{
case ZipOpenType.Closed:
return;
case ZipOpenType.OpenRead:
try { _zipFs?.Close(); } catch { }
try { _zipFs?.Dispose(); } catch { }
break;
case ZipOpenType.OpenWrite:
try { _zipFs?.Flush(); } catch { }
try { _zipFs?.Close(); } catch { }
try { _zipFs?.Dispose(); } catch { }
if (_zipFileInfo != null)
{
try { RVIO.File.Delete(_zipFileInfo.FullName); } catch { }
}
_zipFileInfo = null;
break;
}
}
finally
{
_zipFs = null;
ZipOpen = ZipOpenType.Closed;
}

ZipOpen = ZipOpenType.Closed;
}

}
Expand Down
9 changes: 8 additions & 1 deletion RomVaultCore/FixFile/FixAZip.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand Down Expand Up @@ -509,6 +509,13 @@ public static ReturnCode FixZip(RvFile fixZip, List<RvFile> fileProcessQueue, re
ReportError.procLog($"FixAZip: Error Exception, nulling out.");

errorMessage = "In Fix Zip:\n" + ex.Message + "\nat\n:" + ex.StackTrace;
Exception checkEx = ex;
while (checkEx != null)
{
if (checkEx is System.IO.IOException)
return ReturnCode.FileSystemError;
checkEx = checkEx.InnerException;
}
return ReturnCode.LogicError;
}
finally
Expand Down