Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.

Commit b5d54ce

Browse files
committed
- [Core] bug fixes.
1 parent 2d1e5a0 commit b5d54ce

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

AssetStudio.CLI/Program.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5+
using System.Threading.Tasks;
56
using AssetStudio.CLI.Properties;
67
using Newtonsoft.Json;
78
using static AssetStudio.CLI.Studio;
@@ -155,12 +156,12 @@ public static void Run(Options o)
155156
{
156157
throw new Exception("Unable to build AssetMap with input_path as a file !!");
157158
}
158-
AssetsHelper.BuildAssetMap(files, o.MapName, game, o.Output.FullName, o.MapType, classTypeFilter, o.NameFilter, o.ContainerFilter);
159+
Task.Run(() => AssetsHelper.BuildAssetMap(files, o.MapName, game, o.Output.FullName, o.MapType, classTypeFilter, o.NameFilter, o.ContainerFilter)).Wait();
159160
}
160161
}
161162
if (o.MapOp.HasFlag(MapOpType.Both))
162163
{
163-
AssetsHelper.BuildBoth(files, o.MapName, o.Input.FullName, game, o.Output.FullName, o.MapType, classTypeFilter, o.NameFilter, o.ContainerFilter);
164+
Task.Run(() => AssetsHelper.BuildBoth(files, o.MapName, o.Input.FullName, game, o.Output.FullName, o.MapType, classTypeFilter, o.NameFilter, o.ContainerFilter)).Wait();
164165
}
165166
if (o.MapOp.Equals(MapOpType.None) || o.MapOp.HasFlag(MapOpType.Load))
166167
{

AssetStudio.GUI/MainForm.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2218,7 +2218,7 @@ private async void buildMapToolStripMenuItem_Click(object sender, EventArgs e)
22182218
InvokeUpdate(miscToolStripMenuItem, true);
22192219
}
22202220

2221-
private async void buildBothToolStripMenuItem_Click(object sender, EventArgs e)
2221+
private async Task buildBothToolStripMenuItem_Click(object sender, EventArgs e)
22222222
{
22232223
miscToolStripMenuItem.DropDown.Visible = false;
22242224
InvokeUpdate(miscToolStripMenuItem, false);
@@ -2406,7 +2406,7 @@ private void clearConsoleToolStripMenuItem_Click(object sender, EventArgs e)
24062406
Console.Clear();
24072407
}
24082408

2409-
private async void buildAssetMapToolStripMenuItem_Click(object sender, EventArgs e)
2409+
private async Task buildAssetMapToolStripMenuItem_Click(object sender, EventArgs e)
24102410
{
24112411
miscToolStripMenuItem.DropDown.Visible = false;
24122412
InvokeUpdate(miscToolStripMenuItem, false);

AssetStudio/AssetsHelper.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private static void ParseCABMap(BinaryReader reader)
313313
}
314314
}
315315

316-
public static async void BuildAssetMap(string[] files, string mapName, Game game, string savePath, ExportListType exportListType, ClassIDType[] typeFilters = null, Regex[] nameFilters = null, Regex[] containerFilters = null)
316+
public static async Task BuildAssetMap(string[] files, string mapName, Game game, string savePath, ExportListType exportListType, ClassIDType[] typeFilters = null, Regex[] nameFilters = null, Regex[] containerFilters = null)
317317
{
318318
Logger.Info("Building AssetMap...");
319319
try
@@ -629,7 +629,7 @@ private static void UpdateContainers(List<AssetEntry> assets, Game game)
629629
}
630630
}
631631

632-
private static Task ExportAssetsMap(List<AssetEntry> toExportAssets, Game game, string name, string savePath, ExportListType exportListType, ManualResetEvent resetEvent = null)
632+
private static Task ExportAssetsMap(List<AssetEntry> toExportAssets, Game game, string name, string savePath, ExportListType exportListType)
633633
{
634634
return Task.Run(() =>
635635
{
@@ -691,11 +691,9 @@ private static Task ExportAssetsMap(List<AssetEntry> toExportAssets, Game game,
691691

692692
Logger.Info($"Finished buidling AssetMap with {toExportAssets.Count} assets.");
693693
}
694-
695-
resetEvent?.Set();
696694
});
697695
}
698-
public static async void BuildBoth(string[] files, string mapName, string baseFolder, Game game, string savePath, ExportListType exportListType, ClassIDType[] typeFilters = null, Regex[] nameFilters = null, Regex[] containerFilters = null)
696+
public static async Task BuildBoth(string[] files, string mapName, string baseFolder, Game game, string savePath, ExportListType exportListType, ClassIDType[] typeFilters = null, Regex[] nameFilters = null, Regex[] containerFilters = null)
699697
{
700698
Logger.Info($"Building Both...");
701699
CABMap.Clear();

0 commit comments

Comments
 (0)