Skip to content

Commit d9cfbdb

Browse files
committed
catches for weird stuff.
1 parent a759447 commit d9cfbdb

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

xivModdingFramework/Helpers/IOUtil.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,23 @@ public static async Task UnzipFiles(string zipLocation, string destination, IEn
668668
var toUnzip = zip.Entries.Where(x => ReplaceSlashes(x.FileName).ToLower() == taskFile);
669669
foreach (var e in toUnzip)
670670
{
671-
e.Extract(destination, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently);
671+
var pathSafe = IOUtil.MakePathSafe(Path.GetFileName(e.FileName), false);
672+
var def = Path.GetFileName(e.FileName);
673+
var illegal = def != pathSafe;
674+
if (illegal)
675+
{
676+
try
677+
{
678+
e.Extract(destination, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently);
679+
}
680+
catch(Exception ex)
681+
{
682+
Trace.WriteLine(ex);
683+
}
684+
} else
685+
{
686+
e.Extract(destination, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently);
687+
}
672688
}
673689
}
674690
}));

xivModdingFramework/Mods/FileTypes/PmpManipulation.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,11 @@ public void ApplyToMetadata(ItemMetadata metadata)
548548

549549
public EquipmentParameter ToEquipmentParameter()
550550
{
551-
var slot = PMPExtensions.PenumbraSlotToGameSlot[Slot];
551+
string slot = "top";
552+
if (PMPExtensions.PenumbraSlotToGameSlot.ContainsKey(Slot))
553+
{
554+
slot = PMPExtensions.PenumbraSlotToGameSlot[Slot];
555+
}
552556
var offset = EquipmentParameterSet.EntryOffsets[slot];
553557
var size = EquipmentParameterSet.EntrySizes[slot];
554558

xivModdingFramework/Mods/FileTypes/TTMP.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,7 @@ public static async Task<ModPackJson> GetLegacyModpackMpl(string modpackPath)
493493

494494
if (mpdName == null)
495495
{
496-
using (var zf = ZipFile.Read(path))
497-
{
498-
zf.ExtractAll(targetPath);
499-
}
496+
await IOUtil.UnzipFiles(path, targetPath);
500497
}
501498
else
502499
{

0 commit comments

Comments
 (0)