diff options
| author | Ac_K <Acoustik666@gmail.com> | 2023-01-22 01:42:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-22 01:42:55 +0100 |
| commit | c14844d12c199894ba3ad75ff48802ad09f2b498 (patch) | |
| tree | 6f20b11104b97fb8bbeaa156331c2171e78266a2 /Ryujinx.Ava/UI/ViewModels | |
| parent | 7fea26e97e74e7ec0a5fa27921aa40c31b2c1dd9 (diff) | |
Ava UI: Various Fixes (#4326)
* Ava UI: Various Fixes
* use WriteAllBytes
Diffstat (limited to 'Ryujinx.Ava/UI/ViewModels')
| -rw-r--r-- | Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs b/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs index 1bac9424..3d0b20f7 100644 --- a/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs +++ b/Ryujinx.Ava/UI/ViewModels/TitleUpdateViewModel.cs @@ -21,8 +21,9 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using SpanHelpers = LibHac.Common.SpanHelpers; +using System.Text; using Path = System.IO.Path; +using SpanHelpers = LibHac.Common.SpanHelpers; namespace Ryujinx.Ava.UI.ViewModels; @@ -90,6 +91,8 @@ public class TitleUpdateViewModel : BaseModel Selected = "", Paths = new List<string>() }; + + Save(); } LoadUpdates(); @@ -102,6 +105,9 @@ public class TitleUpdateViewModel : BaseModel AddUpdate(path); } + // NOTE: Save the list again to remove leftovers. + Save(); + TitleUpdateModel selected = TitleUpdates.FirstOrDefault(x => x.Path == _titleUpdateWindowData.Selected, null); SelectedUpdate = selected; @@ -223,4 +229,22 @@ public class TitleUpdateViewModel : BaseModel SortUpdates(); } + + public void Save() + { + _titleUpdateWindowData.Paths.Clear(); + _titleUpdateWindowData.Selected = ""; + + foreach (TitleUpdateModel update in TitleUpdates) + { + _titleUpdateWindowData.Paths.Add(update.Path); + + if (update == SelectedUpdate) + { + _titleUpdateWindowData.Selected = update.Path; + } + } + + File.WriteAllBytes(_titleUpdateJsonPath, Encoding.UTF8.GetBytes(JsonHelper.Serialize(_titleUpdateWindowData, true))); + } }
\ No newline at end of file |
