0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-13 03:10:44 -05:00

udpate launcher base models

This commit is contained in:
IsWaffle 2024-01-26 21:46:39 -05:00
parent 750b4d841d
commit 3d5a3064be
2 changed files with 12 additions and 25 deletions

View File

@ -7,5 +7,6 @@
public string Author { get; set; } public string Author { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Version { get; set; } public string Version { get; set; }
public string Url { get; set; }
} }
} }

View File

@ -35,20 +35,6 @@ namespace Aki.Launcher.Models.Launcher
} }
} }
private bool _hasProfileOnlyMods;
public bool HasProfileOnlyMods
{
get => _hasProfileOnlyMods;
set
{
if (_hasProfileOnlyMods != value)
{
_hasProfileOnlyMods = value;
RaisePropertyChanged(nameof(HasProfileOnlyMods));
}
}
}
private bool _hasMods; private bool _hasMods;
public bool HasMods public bool HasMods
{ {
@ -63,7 +49,8 @@ namespace Aki.Launcher.Models.Launcher
} }
} }
public ObservableCollection<AkiMod> Mods { get; private set; } = new ObservableCollection<AkiMod>(); public ObservableCollection<AkiMod> ActiveMods { get; private set; } = new ObservableCollection<AkiMod>();
public ObservableCollection<AkiMod> InactiveMods { get; private set; } = new ObservableCollection<AkiMod>();
public ModInfoCollection() public ModInfoCollection()
{ {
@ -73,15 +60,15 @@ namespace Aki.Launcher.Models.Launcher
ServerModsCount = serverMods?.Count() ?? 0; ServerModsCount = serverMods?.Count() ?? 0;
ProfileModsCount = profileMods?.Count() ?? 0; ProfileModsCount = profileMods?.Count() ?? 0;
foreach (var serverMod in serverMods) foreach (var activeMod in serverMods)
{ {
serverMod.InServer = true; activeMod.InServer = true;
Mods.Add(serverMod); ActiveMods.Add(activeMod);
} }
foreach (var profileMod in profileMods) foreach (var inactiveMod in profileMods)
{ {
var existingMod = Mods.Where(x => x.Name == profileMod.Name && x.Version == profileMod.Version && x.Author == profileMod.Author).FirstOrDefault(); var existingMod = ActiveMods.Where(x => x.Name == inactiveMod.Name && x.Version == inactiveMod.Version && x.Author == inactiveMod.Author).FirstOrDefault();
if (existingMod != null) if (existingMod != null)
{ {
@ -89,12 +76,11 @@ namespace Aki.Launcher.Models.Launcher
continue; continue;
} }
profileMod.InProfile = true; inactiveMod.InProfile = true;
Mods.Add(profileMod); InactiveMods.Add(inactiveMod);
} }
HasMods = Mods.Count() > 0; HasMods = ActiveMods.Count > 0 || InactiveMods.Count > 0;
HasProfileOnlyMods = Mods.Where(x => x.InProfile && !x.InServer).Count() > 0;
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;