Skip to content

Commit

Permalink
fix: look up updates in several cats
Browse files Browse the repository at this point in the history
  • Loading branch information
Rast1234 committed Jul 28, 2023
1 parent 0fd3e2d commit 1a3d816
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/backlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Ideas, notes about features, testing, release process, etc
## Release

* ~~implement transfer savegames/settings/profile steam to gog~~
* mention local folders as installable mods in docs
* add WC to glossary
* fix TODOs left from debugging
* rename FF categories as MM/legacy/something, add new for SF mods
* remove stuff from news page: links dont work, formatting is bad, a lot of content is bad
Expand Down
3 changes: 1 addition & 2 deletions src/SyncFaction.Core/Models/FactionFiles/Category.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ namespace SyncFaction.Core.Models.FactionFiles;

public enum Category
{
// TODO rename FF cats, rename enum
None = 0,
Artwork = 37,
MapsStandalone = 44,
MapsPatches = 45,
MapPacks = 46,
ModsClassic = 16,
ModsRemaster = 30,
ModsScriptLoader = 29,
Expand Down
2 changes: 0 additions & 2 deletions src/SyncFaction/Converters/CategoryHumanReadableConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
{
Category.Artwork => "Artwork",
Category.MapsStandalone => "Standalone Maps",
Category.MapsPatches => "Patched Maps",
Category.MapPacks => "Map Packs",
Category.ModsClassic => "Mods for Classic Edition",
Category.ModsRemaster => "Mods for Re-Mars-tered",
Category.ModsScriptLoader => "ScriptLoader Mods",
Expand Down
23 changes: 19 additions & 4 deletions src/SyncFaction/Services/UiCommands.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
Expand Down Expand Up @@ -353,9 +354,6 @@ private async Task<bool> RefreshOnline(ViewModel viewModel, bool isInit, Cancell
else
{
// add categories to query
categories.Add(Category.MapPacks);
categories.Add(Category.MapsStandalone);
categories.Add(Category.MapsPatches);
categories.Add(Category.ModsRemaster);

// upd text
Expand Down Expand Up @@ -405,7 +403,24 @@ internal async Task<bool> RefreshLocal(ViewModel viewModel, CancellationToken to
internal async Task<bool> Update(ViewModel viewModel, CancellationToken token)
{
var gameStorage = viewModel.Model.GetGameStorage(fileSystem, log);
var mods = (await modLoader.GetMods(Category.ModsStandalone, gameStorage, token)).ToList();
var mods = new ConcurrentBag<IMod>();
// find Terraform in mods or standalone, RSL2 in tools. TODO remove standalone after moving FF cats
var cats = new List<Category>
{
Category.ModsStandalone,
Category.Tools,
Category.ModsRemaster
};
await Task.WhenAll(cats.Select(async c =>
{
var result = await modLoader.GetMods(c, gameStorage, token);
foreach (var mod in result)
{
mods.Add(mod);
}
})
.ToArray());

var updates = viewModel.LockCollections(() => viewModel.Model.RemoteTerraformUpdates.Concat(viewModel.Model.RemoteRslUpdates).Select(x => mods.Single(y => y.Id == x)).ToList());

var installed = viewModel.LockCollections(() => viewModel.Model.TerraformUpdates.Concat(viewModel.Model.RslUpdates).ToList());
Expand Down

0 comments on commit 1a3d816

Please sign in to comment.