- [Core] bug fixes.

This commit is contained in:
Razmoth
2024-02-19 17:15:16 +04:00
parent 2d1e5a076e
commit b5d54ce318
3 changed files with 8 additions and 9 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using AssetStudio.CLI.Properties; using AssetStudio.CLI.Properties;
using Newtonsoft.Json; using Newtonsoft.Json;
using static AssetStudio.CLI.Studio; using static AssetStudio.CLI.Studio;
@@ -155,12 +156,12 @@ namespace AssetStudio.CLI
{ {
throw new Exception("Unable to build AssetMap with input_path as a file !!"); throw new Exception("Unable to build AssetMap with input_path as a file !!");
} }
AssetsHelper.BuildAssetMap(files, o.MapName, game, o.Output.FullName, o.MapType, classTypeFilter, o.NameFilter, o.ContainerFilter); Task.Run(() => AssetsHelper.BuildAssetMap(files, o.MapName, game, o.Output.FullName, o.MapType, classTypeFilter, o.NameFilter, o.ContainerFilter)).Wait();
} }
} }
if (o.MapOp.HasFlag(MapOpType.Both)) if (o.MapOp.HasFlag(MapOpType.Both))
{ {
AssetsHelper.BuildBoth(files, o.MapName, o.Input.FullName, game, o.Output.FullName, o.MapType, classTypeFilter, o.NameFilter, o.ContainerFilter); Task.Run(() => AssetsHelper.BuildBoth(files, o.MapName, o.Input.FullName, game, o.Output.FullName, o.MapType, classTypeFilter, o.NameFilter, o.ContainerFilter)).Wait();
} }
if (o.MapOp.Equals(MapOpType.None) || o.MapOp.HasFlag(MapOpType.Load)) if (o.MapOp.Equals(MapOpType.None) || o.MapOp.HasFlag(MapOpType.Load))
{ {

View File

@@ -2218,7 +2218,7 @@ namespace AssetStudio.GUI
InvokeUpdate(miscToolStripMenuItem, true); InvokeUpdate(miscToolStripMenuItem, true);
} }
private async void buildBothToolStripMenuItem_Click(object sender, EventArgs e) private async Task buildBothToolStripMenuItem_Click(object sender, EventArgs e)
{ {
miscToolStripMenuItem.DropDown.Visible = false; miscToolStripMenuItem.DropDown.Visible = false;
InvokeUpdate(miscToolStripMenuItem, false); InvokeUpdate(miscToolStripMenuItem, false);
@@ -2406,7 +2406,7 @@ namespace AssetStudio.GUI
Console.Clear(); Console.Clear();
} }
private async void buildAssetMapToolStripMenuItem_Click(object sender, EventArgs e) private async Task buildAssetMapToolStripMenuItem_Click(object sender, EventArgs e)
{ {
miscToolStripMenuItem.DropDown.Visible = false; miscToolStripMenuItem.DropDown.Visible = false;
InvokeUpdate(miscToolStripMenuItem, false); InvokeUpdate(miscToolStripMenuItem, false);

View File

@@ -313,7 +313,7 @@ namespace AssetStudio
} }
} }
public static async void BuildAssetMap(string[] files, string mapName, Game game, string savePath, ExportListType exportListType, ClassIDType[] typeFilters = null, Regex[] nameFilters = null, Regex[] containerFilters = null) public static async Task BuildAssetMap(string[] files, string mapName, Game game, string savePath, ExportListType exportListType, ClassIDType[] typeFilters = null, Regex[] nameFilters = null, Regex[] containerFilters = null)
{ {
Logger.Info("Building AssetMap..."); Logger.Info("Building AssetMap...");
try try
@@ -629,7 +629,7 @@ namespace AssetStudio
} }
} }
private static Task ExportAssetsMap(List<AssetEntry> toExportAssets, Game game, string name, string savePath, ExportListType exportListType, ManualResetEvent resetEvent = null) private static Task ExportAssetsMap(List<AssetEntry> toExportAssets, Game game, string name, string savePath, ExportListType exportListType)
{ {
return Task.Run(() => return Task.Run(() =>
{ {
@@ -691,11 +691,9 @@ namespace AssetStudio
Logger.Info($"Finished buidling AssetMap with {toExportAssets.Count} assets."); Logger.Info($"Finished buidling AssetMap with {toExportAssets.Count} assets.");
} }
resetEvent?.Set();
}); });
} }
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) 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)
{ {
Logger.Info($"Building Both..."); Logger.Info($"Building Both...");
CABMap.Clear(); CABMap.Clear();