From 7a019877818fc3ae6b2be71baef74a8b6a409ecf Mon Sep 17 00:00:00 2001 From: AdAstra-LD <76622070+AdAstra-LD@users.noreply.github.com> Date: Mon, 2 Aug 2021 17:19:49 +0200 Subject: [PATCH] Removed useless references to toolStripProgressBar in NARC unpack methods --- DS_Map/DSUtils.cs | 17 ++--------------- DS_Map/Main Window.cs | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/DS_Map/DSUtils.cs b/DS_Map/DSUtils.cs index 01fd8af..550f4e1 100644 --- a/DS_Map/DSUtils.cs +++ b/DS_Map/DSUtils.cs @@ -269,7 +269,7 @@ namespace DSPRE { return b; } - public static void TryUnpackNarcs(List IDs, ToolStripProgressBar progress = null) { + public static void TryUnpackNarcs(List IDs) { Parallel.ForEach(IDs, id => { if (gameDirs.TryGetValue(id, out (string packedPath, string unpackedPath) paths)) { DirectoryInfo di = new DirectoryInfo(paths.unpackedPath); @@ -282,17 +282,10 @@ namespace DSPRE { opened.ExtractToFolder(paths.unpackedPath); } - - //if (progress != null) { - // try { - // progress.Value++; - // - // } catch (ArgumentOutOfRangeException) { } - //} } }); } - public static void ForceUnpackNarcs(List IDs, ToolStripProgressBar progress = null) { + public static void ForceUnpackNarcs(List IDs) { Parallel.ForEach(IDs, id => { if (gameDirs.TryGetValue(id, out (string packedPath, string unpackedPath) paths)) { Narc opened = Narc.Open(paths.packedPath); @@ -301,12 +294,6 @@ namespace DSPRE { throw new NullReferenceException(); opened.ExtractToFolder(paths.unpackedPath); - - //if (progress != null) { - // try { - // progress.Value++; - // } catch (ArgumentOutOfRangeException) { } - //} } }); } diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index a119555..ea7ed8a 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -441,19 +441,20 @@ namespace DSPRE { DirNames.exteriorBuildingModels, DirNames.buildingConfigFiles, DirNames.buildingTextures, + DirNames.areaData }; if (forceUnpack) { - DSUtils.ForceUnpackNarcs(toUnpack, toolStripProgressBar); + DSUtils.ForceUnpackNarcs(toUnpack); if (RomInfo.gameFamily == gFamEnum.HGSS) { - DSUtils.ForceUnpackNarcs(new List { DirNames.interiorBuildingModels }, toolStripProgressBar);// Last = interior buildings dir + DSUtils.ForceUnpackNarcs(new List { DirNames.interiorBuildingModels });// Last = interior buildings dir } } else { - DSUtils.TryUnpackNarcs(toUnpack, toolStripProgressBar); + DSUtils.TryUnpackNarcs(toUnpack); if (RomInfo.gameFamily == gFamEnum.HGSS) { - DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }, toolStripProgressBar); + DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }); } } @@ -687,7 +688,7 @@ namespace DSPRE { statusLabel.Text = "Attempting to unpack all NARCs... Be patient. This might take a while..."; Update(); - DSUtils.ForceUnpackNarcs(Enum.GetValues(typeof(DirNames)).Cast().ToList(), toolStripProgressBar); + DSUtils.ForceUnpackNarcs(Enum.GetValues(typeof(DirNames)).Cast().ToList()); MessageBox.Show("Operation completed.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -857,7 +858,7 @@ namespace DSPRE { statusLabel.Text = "Attempting to unpack Header Editor NARCs... Please wait."; Update(); - DSUtils.TryUnpackNarcs(new List { DirNames.synthOverlay, DirNames.textArchives, DirNames.dynamicHeaders }, toolStripProgressBar); + DSUtils.TryUnpackNarcs(new List { DirNames.synthOverlay, DirNames.textArchives, DirNames.dynamicHeaders }); statusLabel.Text = "Reading internal names... Please wait."; Update(); @@ -2758,7 +2759,7 @@ namespace DSPRE { }); if (RomInfo.gameFamily == gFamEnum.HGSS) { - DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }, toolStripProgressBar); + DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }); } disableHandlers = true; @@ -4535,13 +4536,13 @@ namespace DSPRE { DirNames.trainerProperties, DirNames.OWSprites, - DirNames.scripts, }, toolStripProgressBar); + DirNames.scripts, }); RomInfo.SetOWtable(); RomInfo.Set3DOverworldsDict(); if (RomInfo.gameFamily == gFamEnum.HGSS) { - DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }, toolStripProgressBar); + DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }); } disableHandlers = true; @@ -6228,9 +6229,9 @@ namespace DSPRE { DSUtils.TryUnpackNarcs(new List { DirNames.buildingTextures, DirNames.mapTextures, - DirNames.areaData, - DirNames.buildingConfigFiles - }, toolStripProgressBar); + DirNames.buildingConfigFiles, + DirNames.areaData + }); /* Fill Tileset ListBox */ FillTilesetBox();