From a0f3931257820843077a83db6b56ca6077107e88 Mon Sep 17 00:00:00 2001 From: nattthebear Date: Tue, 30 Jun 2015 23:28:26 -0400 Subject: [PATCH] Blah --- BizHawk.Client.Common/BinarySaveStates.cs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/BizHawk.Client.Common/BinarySaveStates.cs b/BizHawk.Client.Common/BinarySaveStates.cs index 6ab20315c6..50d05af7ac 100644 --- a/BizHawk.Client.Common/BinarySaveStates.cs +++ b/BizHawk.Client.Common/BinarySaveStates.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using ICSharpCode.SharpZipLib.Zip; //using Ionic.Zip; @@ -135,25 +136,19 @@ namespace BizHawk.Client.Common } } + private static byte[] zipheader = new byte[] { 0x50, 0x4b, 0x03, 0x04 }; public static BinaryStateLoader LoadAndDetect(string filename, bool isMovieLoad = false) { var ret = new BinaryStateLoader(); - // PORTABLE TODO - SKIP THIS.. FOR NOW - // check whether its an archive before we try opening it - bool isArchive; - using (var archiveChecker = new SevenZipSharpArchiveHandler()) + using (var fs = new FileStream(filename, FileMode.Open, FileAccess.Read)) { - int offset; - bool isExecutable; - isArchive = archiveChecker.CheckSignature(filename, out offset, out isExecutable); + byte[] data = new byte[4]; + fs.Read(data, 0, 4); + if (!data.SequenceEqual(zipheader)) + return null; } - - if (!isArchive) - { - return null; - } - + try { ret._zip = new ZipFile(filename);