forked from TASEmulators/BizHawk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to framework 4.6.2. Since Windows XP 64 was very rarely used, …
…there's no loss in switching to this if we're going to 64 bit. Add `FrameworkZipWriter` based on the 4.5 framework's built in zip writer. It shaves a decent amount of time off savestate save time, but rolling our own off of DeflateStream would be even faster.
- Loading branch information
1 parent
37dc990
commit 76022f6
Showing
23 changed files
with
2,754 additions
and
2,628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.IO.Compression; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace BizHawk.Client.Common | ||
{ | ||
public class FrameworkZipWriter : IZipWriter | ||
{ | ||
private ZipArchive _archive; | ||
private readonly CompressionLevel _level; | ||
|
||
public FrameworkZipWriter(string path, int compressionlevel) | ||
{ | ||
_archive = new ZipArchive(new FileStream(path, FileMode.Create, FileAccess.Write), | ||
ZipArchiveMode.Create, false); | ||
if (compressionlevel == 0) | ||
_level = CompressionLevel.NoCompression; | ||
else if (compressionlevel < 5) | ||
_level = CompressionLevel.Fastest; | ||
else | ||
_level = CompressionLevel.Optimal; | ||
} | ||
|
||
public void WriteItem(string name, Action<Stream> callback) | ||
{ | ||
using (var stream = _archive.CreateEntry(name, _level).Open()) | ||
{ | ||
callback(stream); | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
if (_archive != null) | ||
{ | ||
_archive.Dispose(); | ||
_archive = null; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.