From fa8371696b1c7877e001fd040d65c55bc115db8b Mon Sep 17 00:00:00 2001 From: Xanfre Date: Sun, 21 Feb 2021 02:51:37 -0600 Subject: [PATCH] Use the encoding for the OEM CP when reading zips --- AngelLoader/FMBackupAndRestore.cs | 5 +++-- AngelLoader/FMCache.cs | 8 ++++++-- AngelLoader/FMInstallAndPlay.cs | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/AngelLoader/FMBackupAndRestore.cs b/AngelLoader/FMBackupAndRestore.cs index d050f1031..b13376083 100644 --- a/AngelLoader/FMBackupAndRestore.cs +++ b/AngelLoader/FMBackupAndRestore.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; @@ -278,7 +279,7 @@ void AddBakFilesFrom(string path) string fmInstalledPath = Path.Combine(thisFMInstallsBasePath, fm.InstalledDir); using (var archive = new ZipArchive(new FileStream(fileToUse.Name, FileMode.Open, FileAccess.Read), - ZipArchiveMode.Read, leaveOpen: false)) + ZipArchiveMode.Read, leaveOpen: false, Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage))) { int filesCount = archive.Entries.Count; if (fileToUse.DarkLoader) @@ -490,7 +491,7 @@ private static (List ChangedList, List AddedList, List F if (fmIsZip) { using var archive = new ZipArchive(new FileStream(fmArchivePath, FileMode.Open, FileAccess.Read), - ZipArchiveMode.Read, leaveOpen: false); + ZipArchiveMode.Read, leaveOpen: false, Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage)); for (int i = 0; i < archive.Entries.Count; i++) { diff --git a/AngelLoader/FMCache.cs b/AngelLoader/FMCache.cs index dd2942829..02d3f1fe1 100644 --- a/AngelLoader/FMCache.cs +++ b/AngelLoader/FMCache.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; +using System.Text; using System.Threading.Tasks; using AngelLoader.DataClasses; using AngelLoader.WinAPI; @@ -214,7 +216,8 @@ private static void ExtractHTMLRefFiles(string fmArchivePath, string fmCachePath var htmlRefFiles = new List(); using var archive = new ZipArchive(new FileStream(fmArchivePath, FileMode.Open, FileAccess.Read), - ZipArchiveMode.Read, leaveOpen: false); + ZipArchiveMode.Read, leaveOpen: false, + Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage)); foreach (string f in Directory.GetFiles(fmCachePath, "*", SearchOption.AllDirectories)) { @@ -300,7 +303,8 @@ private static void ZipExtract(string fmArchivePath, string fmCachePath, List