Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1747 #1923

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@
{
UndertaleResourceReferenceMethodsMap.data = data;

var ver = (data.GeneralInfo.Major, data.GeneralInfo.Minor, data.GeneralInfo.Release);

Check warning on line 1445 in UndertaleModTool/Windows/FindReferencesTypesDialog/UndertaleResourceReferenceMethodsMap.cs

View workflow job for this annotation

GitHub Actions / build_gui (windows-latest, Debug, false, true)

The variable 'ver' is assigned but its value is never used

Check warning on line 1445 in UndertaleModTool/Windows/FindReferencesTypesDialog/UndertaleResourceReferenceMethodsMap.cs

View workflow job for this annotation

GitHub Actions / build_gui (windows-latest, Debug, false, true)

The variable 'ver' is assigned but its value is never used

Check warning on line 1445 in UndertaleModTool/Windows/FindReferencesTypesDialog/UndertaleResourceReferenceMethodsMap.cs

View workflow job for this annotation

GitHub Actions / build_gui (windows-latest, Debug, false, false)

The variable 'ver' is assigned but its value is never used

Check warning on line 1445 in UndertaleModTool/Windows/FindReferencesTypesDialog/UndertaleResourceReferenceMethodsMap.cs

View workflow job for this annotation

GitHub Actions / build_gui (windows-latest, Debug, false, false)

The variable 'ver' is assigned but its value is never used

Dictionary<string, List<object>> outDict = new();

Expand Down Expand Up @@ -1498,39 +1498,42 @@
mainWindow.SetProgressBar(null, "Assets", 0, assets.Count);
mainWindow.StartProgressBarUpdater();

var assetsPart = Partitioner.Create(0, assets.Count);

List<Dictionary<string, List<object>>> dicts = new();

await Task.Run(() =>
if (assets.Count > 0) // A Partitioner can't be created on an empty list.
{
Parallel.ForEach(assetsPart, (range) =>
{
var resultDict = new Dictionary<string, List<object>>();
var assetsPart = Partitioner.Create(0, assets.Count);

for (int i = range.Item1; i < range.Item2; i++)
await Task.Run(() =>
{
Parallel.ForEach(assetsPart, (range) =>
{
var asset = assets[i];
var assetReferences = GetReferencesOfObject(asset.Item1, data,
new HashSetTypesOverride(true, data.Code is null), true);
if (assetReferences is null)
var resultDict = new Dictionary<string, List<object>>();

for (int i = range.Item1; i < range.Item2; i++)
{
if (resultDict.TryGetValue(asset.Item2, out var list))
var asset = assets[i];
var assetReferences = GetReferencesOfObject(asset.Item1, data,
new HashSetTypesOverride(true, data.Code is null), true);
if (assetReferences is null)
{
list.Add(asset.Item1);
}
else
{
resultDict[asset.Item2] = new() { asset.Item1 };
if (resultDict.TryGetValue(asset.Item2, out var list))
{
list.Add(asset.Item1);
}
else
{
resultDict[asset.Item2] = new() { asset.Item1 };
}
}
}

mainWindow.IncrementProgressParallel();
}
mainWindow.IncrementProgressParallel();
}

dicts.Add(resultDict);
dicts.Add(resultDict);
});
});
});
}

Dictionary<string, int> outArrSizes = new();
foreach (var dict in dicts)
Expand Down
Loading