mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
update stuff that needs to be updated
This commit is contained in:
parent
f8e929b347
commit
0be44a37b2
|
|
@ -18,10 +18,9 @@ public enum EErrorKind
|
|||
|
||||
public enum SettingsOut
|
||||
{
|
||||
Restart,
|
||||
ReloadLocres,
|
||||
CheckForUpdates,
|
||||
Nothing
|
||||
ReloadMappings,
|
||||
CheckForUpdates
|
||||
}
|
||||
|
||||
public enum EStatusKind
|
||||
|
|
|
|||
|
|
@ -182,6 +182,8 @@ public class SettingsViewModel : ViewModel
|
|||
private ELodFormat _lodExportFormatSnapshot;
|
||||
private ETextureFormat _textureExportFormatSnapshot;
|
||||
|
||||
private bool _mappingsUpdate = false;
|
||||
|
||||
public SettingsViewModel(FGame game)
|
||||
{
|
||||
_game = game;
|
||||
|
|
@ -216,6 +218,11 @@ public class SettingsViewModel : ViewModel
|
|||
{
|
||||
AesEndpoint = endpoints[0];
|
||||
MappingEndpoint = endpoints[1];
|
||||
MappingEndpoint.PropertyChanged += (sender, args) =>
|
||||
{
|
||||
if (sender is FEndpoint endpoint && !_mappingsUpdate)
|
||||
_mappingsUpdate = args.PropertyName is "Overwrite" or "FilePath" && endpoint.IsValid;
|
||||
};
|
||||
}
|
||||
|
||||
_assetLanguageSnapshot = UserSettings.Default.AssetLanguage;
|
||||
|
|
@ -294,9 +301,17 @@ public class SettingsViewModel : ViewModel
|
|||
SelectedOptions = _optionsSnapshot;
|
||||
}
|
||||
|
||||
public SettingsOut Save()
|
||||
public bool Save(out List<SettingsOut> whatShouldIDo)
|
||||
{
|
||||
var ret = SettingsOut.Nothing;
|
||||
var restart = false;
|
||||
whatShouldIDo = new List<SettingsOut>();
|
||||
|
||||
if (_assetLanguageSnapshot != SelectedAssetLanguage)
|
||||
whatShouldIDo.Add(SettingsOut.ReloadLocres);
|
||||
if (_mappingsUpdate)
|
||||
whatShouldIDo.Add(SettingsOut.ReloadMappings);
|
||||
if (_updateModeSnapshot != SelectedUpdateMode)
|
||||
whatShouldIDo.Add(SettingsOut.CheckForUpdates);
|
||||
|
||||
if (_ueGameSnapshot != SelectedUeGame || _customVersionsSnapshot != SelectedCustomVersions ||
|
||||
_uePlatformSnapshot != SelectedUePlatform || _optionsSnapshot != SelectedOptions || // combobox
|
||||
|
|
@ -307,13 +322,7 @@ public class SettingsViewModel : ViewModel
|
|||
_audioSnapshot != UserSettings.Default.AudioDirectory || // textbox
|
||||
_modelSnapshot != UserSettings.Default.ModelDirectory || // textbox
|
||||
_gameSnapshot != UserSettings.Default.GameDirectory) // textbox
|
||||
ret = SettingsOut.Restart;
|
||||
|
||||
if (_assetLanguageSnapshot != SelectedAssetLanguage)
|
||||
ret = SettingsOut.ReloadLocres;
|
||||
|
||||
if (_updateModeSnapshot != SelectedUpdateMode)
|
||||
ret = SettingsOut.CheckForUpdates;
|
||||
restart = true;
|
||||
|
||||
UserSettings.Default.UpdateMode = SelectedUpdateMode;
|
||||
UserSettings.Default.Presets[_game] = SelectedPreset;
|
||||
|
|
@ -343,7 +352,7 @@ public class SettingsViewModel : ViewModel
|
|||
if (SelectedDiscordRpc == EDiscordRpc.Never)
|
||||
_discordHandler.Shutdown();
|
||||
|
||||
return ret;
|
||||
return restart;
|
||||
}
|
||||
|
||||
private IEnumerable<EUpdateMode> EnumerateUpdateModes() => Enum.GetValues<EUpdateMode>();
|
||||
|
|
|
|||
|
|
@ -37,21 +37,27 @@ public partial class SettingsView
|
|||
|
||||
private async void OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var whatShouldIDo = _applicationView.SettingsView.Save();
|
||||
if (whatShouldIDo == SettingsOut.Restart)
|
||||
var restart = _applicationView.SettingsView.Save(out var whatShouldIDo);
|
||||
if (restart)
|
||||
_applicationView.RestartWithWarning();
|
||||
|
||||
Close();
|
||||
|
||||
switch (whatShouldIDo)
|
||||
foreach (var dOut in whatShouldIDo)
|
||||
{
|
||||
case SettingsOut.ReloadLocres:
|
||||
_applicationView.CUE4Parse.LocalizedResourcesCount = 0;
|
||||
await _applicationView.CUE4Parse.LoadLocalizedResources();
|
||||
break;
|
||||
case SettingsOut.CheckForUpdates:
|
||||
ApplicationService.ApiEndpointView.FModelApi.CheckForUpdates(UserSettings.Default.UpdateMode);
|
||||
break;
|
||||
switch (dOut)
|
||||
{
|
||||
case SettingsOut.ReloadLocres:
|
||||
_applicationView.CUE4Parse.LocalizedResourcesCount = 0;
|
||||
await _applicationView.CUE4Parse.LoadLocalizedResources();
|
||||
break;
|
||||
case SettingsOut.ReloadMappings:
|
||||
await _applicationView.CUE4Parse.InitBenMappings();
|
||||
break;
|
||||
case SettingsOut.CheckForUpdates:
|
||||
ApplicationService.ApiEndpointView.FModelApi.CheckForUpdates(UserSettings.Default.UpdateMode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +104,7 @@ public partial class SettingsView
|
|||
if (TryBrowse(out var path)) UserSettings.Default.ModelDirectory = path;
|
||||
}
|
||||
|
||||
private async void OnBrowseMappings(object sender, RoutedEventArgs e)
|
||||
private void OnBrowseMappings(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
|
|
@ -111,7 +117,6 @@ public partial class SettingsView
|
|||
return;
|
||||
|
||||
_applicationView.SettingsView.MappingEndpoint.FilePath = openFileDialog.FileName;
|
||||
await _applicationView.CUE4Parse.InitBenMappings();
|
||||
}
|
||||
|
||||
private bool TryBrowse(out string path)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user