Fixed issues with language selection
Fixed game name field not resetting properly
This commit is contained in:
parent
933e84cdaa
commit
a5ca4ceb33
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace auto_creamapi.Models
|
namespace auto_creamapi.Models
|
||||||
{
|
{
|
||||||
@ -15,6 +16,20 @@ namespace auto_creamapi.Models
|
|||||||
public bool ExtraProtection { get; set; }
|
public bool ExtraProtection { get; set; }
|
||||||
public bool ForceOffline { get; set; }
|
public bool ForceOffline { get; set; }
|
||||||
public List<SteamApp> DlcList { get; set; }
|
public List<SteamApp> DlcList { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
var value = $"AppID: {AppId}\n" +
|
||||||
|
$"Language: {Language}\n" +
|
||||||
|
$"UnlockAll: {UnlockAll}\n" +
|
||||||
|
$"ExtraProtection: {ExtraProtection}\n" +
|
||||||
|
$"ForceOffline: {ForceOffline}\n" +
|
||||||
|
$"DLC ({DlcList.Count}):\n[\n";
|
||||||
|
if (DlcList.Count > 0)
|
||||||
|
value = DlcList.Aggregate(value, (current, x) => current + $" {x.AppId}={x.Name},\n");
|
||||||
|
value += "]";
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class CreamConfigModel
|
public sealed class CreamConfigModel
|
||||||
|
@ -17,8 +17,6 @@ namespace auto_creamapi.Services
|
|||||||
{
|
{
|
||||||
public interface ICacheService
|
public interface ICacheService
|
||||||
{
|
{
|
||||||
public List<string> Languages { get; }
|
|
||||||
|
|
||||||
public Task Initialize();
|
public Task Initialize();
|
||||||
|
|
||||||
//public Task UpdateCache();
|
//public Task UpdateCache();
|
||||||
@ -48,7 +46,6 @@ namespace auto_creamapi.Services
|
|||||||
|
|
||||||
public CacheService()
|
public CacheService()
|
||||||
{
|
{
|
||||||
Languages = Misc.DefaultLanguages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public async void Initialize()
|
/*public async void Initialize()
|
||||||
@ -57,8 +54,6 @@ namespace auto_creamapi.Services
|
|||||||
await UpdateCache();
|
await UpdateCache();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public List<string> Languages { get; }
|
|
||||||
|
|
||||||
public async Task Initialize()
|
public async Task Initialize()
|
||||||
{
|
{
|
||||||
MyLogger.Log.Information("Updating cache...");
|
MyLogger.Log.Information("Updating cache...");
|
||||||
|
@ -162,7 +162,7 @@ namespace auto_creamapi.Services
|
|||||||
private void ResetConfigData()
|
private void ResetConfigData()
|
||||||
{
|
{
|
||||||
Config.AppId = -1;
|
Config.AppId = -1;
|
||||||
Config.Language = "";
|
Config.Language = Misc.DefaultLanguageSelection;
|
||||||
Config.UnlockAll = false;
|
Config.UnlockAll = false;
|
||||||
Config.ExtraProtection = false;
|
Config.ExtraProtection = false;
|
||||||
Config.ForceOffline = false;
|
Config.ForceOffline = false;
|
||||||
@ -191,21 +191,7 @@ namespace auto_creamapi.Services
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
var str = $"INI file: {_configFilePath}, " +
|
var str = $"INI file: {_configFilePath}\n{Config}";
|
||||||
$"AppID: {Config.AppId}, " +
|
|
||||||
$"Language: {Config.Language}, " +
|
|
||||||
$"UnlockAll: {Config.UnlockAll}, " +
|
|
||||||
$"ExtraProtection: {Config.ExtraProtection}, " +
|
|
||||||
$"ForceOffline: {Config.ForceOffline}, " +
|
|
||||||
$"DLC ({Config.DlcList.Count}):\n[\n";
|
|
||||||
if (Config.DlcList.Count > 0)
|
|
||||||
str = Config.DlcList.Aggregate(str, (current, x) => current + $" {x.AppId}={x.Name},\n");
|
|
||||||
/*foreach (var (key, value) in Config.DlcList)
|
|
||||||
{
|
|
||||||
str += $" {key}={value},\n";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
str += "]";
|
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace auto_creamapi.Utils
|
namespace auto_creamapi.Utils
|
||||||
{
|
{
|
||||||
public class Misc
|
public class Misc
|
||||||
{
|
{
|
||||||
public static readonly List<string> DefaultLanguages = new List<string>(new[]
|
|
||||||
|
public const string DefaultLanguageSelection = "english";
|
||||||
|
public static readonly ObservableCollection<string> DefaultLanguages = new ObservableCollection<string>(new[]
|
||||||
{
|
{
|
||||||
"arabic",
|
"arabic",
|
||||||
"bulgarian",
|
"bulgarian",
|
||||||
|
@ -16,7 +16,6 @@ namespace auto_creamapi.ViewModels
|
|||||||
{
|
{
|
||||||
public class MainViewModel : MvxViewModel
|
public class MainViewModel : MvxViewModel
|
||||||
{
|
{
|
||||||
private const string DefaultLanguageSelection = "english";
|
|
||||||
private readonly ICacheService _cache;
|
private readonly ICacheService _cache;
|
||||||
private readonly ICreamConfigService _config;
|
private readonly ICreamConfigService _config;
|
||||||
|
|
||||||
@ -51,6 +50,21 @@ namespace auto_creamapi.ViewModels
|
|||||||
//_download = download;
|
//_download = download;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override async Task Initialize()
|
||||||
|
{
|
||||||
|
_config.Initialize();
|
||||||
|
var tasks = new List<Task> {base.Initialize(), _cache.Initialize()};
|
||||||
|
if (!File.Exists("steam_api.dll") | !File.Exists("steam_api64.dll"))
|
||||||
|
tasks.Add(_navigationService.Navigate<DownloadViewModel>());
|
||||||
|
tasks.Add(_dll.Initialize());
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
|
Languages = new ObservableCollection<string>(Misc.DefaultLanguages);
|
||||||
|
ResetForm();
|
||||||
|
UseSteamDb = true;
|
||||||
|
MainWindowEnabled = true;
|
||||||
|
Status = "Ready.";
|
||||||
|
}
|
||||||
|
|
||||||
// // COMMANDS // //
|
// // COMMANDS // //
|
||||||
|
|
||||||
public IMvxCommand OpenFileCommand => new MvxCommand(OpenFile);
|
public IMvxCommand OpenFileCommand => new MvxCommand(OpenFile);
|
||||||
@ -105,7 +119,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
{
|
{
|
||||||
_appId = value;
|
_appId = value;
|
||||||
RaisePropertyChanged(() => AppId);
|
RaisePropertyChanged(() => AppId);
|
||||||
if (value > 0) SetNameById();
|
SetNameById();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,27 +224,6 @@ namespace auto_creamapi.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task Initialize()
|
|
||||||
{
|
|
||||||
_config.Initialize();
|
|
||||||
/*await base.Initialize();
|
|
||||||
await _cache.Initialize();
|
|
||||||
if (!File.Exists("steam_api.dll") | !File.Exists("steam_api64.dll"))
|
|
||||||
await _navigationService.Navigate<DownloadViewModel>();
|
|
||||||
await _dll.Initialize();*/
|
|
||||||
var tasks = new List<Task> {base.Initialize(), _cache.Initialize()};
|
|
||||||
if (!File.Exists("steam_api.dll") | !File.Exists("steam_api64.dll"))
|
|
||||||
tasks.Add(_navigationService.Navigate<DownloadViewModel>());
|
|
||||||
tasks.Add(_dll.Initialize());
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
Languages = new ObservableCollection<string>(_cache.Languages);
|
|
||||||
ResetForm();
|
|
||||||
Lang = DefaultLanguageSelection;
|
|
||||||
UseSteamDb = true;
|
|
||||||
MainWindowEnabled = true;
|
|
||||||
Status = "Ready.";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenFile()
|
private void OpenFile()
|
||||||
{
|
{
|
||||||
Status = "Waiting for file...";
|
Status = "Waiting for file...";
|
||||||
@ -379,9 +372,13 @@ namespace auto_creamapi.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SetNameById()
|
private void SetNameById()
|
||||||
|
{
|
||||||
|
if (_appId > 0)
|
||||||
{
|
{
|
||||||
var appById = _cache.GetAppById(_appId);
|
var appById = _cache.GetAppById(_appId);
|
||||||
GameName = appById != null ? appById.Name : "";
|
GameName = appById != null ? appById.Name : "";
|
||||||
}
|
}
|
||||||
|
else GameName = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user