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

udpate launcher base models

This commit is contained in:
IsWaffle 2024-01-26 21:46:39 -05:00
parent 5d3b453ded
commit 5a7ff85a5c
2 changed files with 12 additions and 25 deletions

View File

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

View File

@ -20,7 +20,7 @@ namespace Aki.Launcher.Models.Launcher
}
}
}
private int _profileModsCount;
public int ProfileModsCount
{
@ -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;
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()
{
@ -73,15 +60,15 @@ namespace Aki.Launcher.Models.Launcher
ServerModsCount = serverMods?.Count() ?? 0;
ProfileModsCount = profileMods?.Count() ?? 0;
foreach (var serverMod in serverMods)
foreach (var activeMod in serverMods)
{
serverMod.InServer = true;
Mods.Add(serverMod);
activeMod.InServer = true;
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)
{
@ -89,12 +76,11 @@ namespace Aki.Launcher.Models.Launcher
continue;
}
profileMod.InProfile = true;
Mods.Add(profileMod);
inactiveMod.InProfile = true;
InactiveMods.Add(inactiveMod);
}
HasMods = Mods.Count() > 0;
HasProfileOnlyMods = Mods.Where(x => x.InProfile && !x.InServer).Count() > 0;
HasMods = ActiveMods.Count > 0 || InactiveMods.Count > 0;
}
public event PropertyChangedEventHandler PropertyChanged;