Skip to content

Commit 6adc1b3

Browse files
authored
Merge pull request #453 from ghost/fix/mods-list
fixed lag & breaking changes for bulk mods edit
2 parents 0c994b0 + ffa55c0 commit 6adc1b3

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

‎Torch.Server/Views/ModListControl.xaml.cs‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,10 @@ private void BulkButton_OnClick(object sender, RoutedEventArgs e)
269269
modList.RemoveAll(m =>
270270
{
271271
var mod = m.ToString();
272-
return idList.Any(mod.Equals);
272+
return idList.Any(id =>
273+
id.IndexOf('-') > 0
274+
? mod.Equals(id, StringComparison.Ordinal)
275+
: m.PublishedFileId.Equals(ulong.Parse(id)));
273276
});
274277
modList.AddRange(idList.Select(id =>
275278
{
@@ -282,13 +285,8 @@ private void BulkButton_OnClick(object sender, RoutedEventArgs e)
282285
_instanceManager.DedicatedConfig.Mods.Add(mod);
283286

284287
if (tasks.Any())
285-
Task.WaitAll(tasks.ToArray());
286-
287-
Dispatcher.Invoke(() =>
288-
{
289-
_instanceManager.DedicatedConfig.Save();
290-
});
291-
288+
Task.WhenAll(tasks.ToArray())
289+
.ContinueWith(_ => Dispatcher.Invoke(() => _instanceManager.DedicatedConfig.Save()));
292290
}
293291

294292
private void UgcServiceTypeBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)

‎Torch/Utils/ModItemUtils.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public static MyObjectBuilder_Checkpoint.ModItem Create(ulong modId, string serv
1616
public static MyObjectBuilder_Checkpoint.ModItem Create(string str)
1717
{
1818
var arr = str.Split('-');
19-
return new MyObjectBuilder_Checkpoint.ModItem(ulong.Parse(arr[0]), arr[1]);
19+
// backward compat
20+
return new MyObjectBuilder_Checkpoint.ModItem(ulong.Parse(arr[0]), arr.Length > 1 ? arr[1] : GetDefaultServiceName());
2021
}
2122

2223
//because KEEEN!

0 commit comments

Comments
 (0)