Ryujinx/src/Ryujinx.Ui.Common
SamusAranX 623604c391
Overhaul of string formatting/parsing/sorting logic for TimeSpans, DateTimes, and file sizes (#4956)
* Fixed formatting/parsing issues with ApplicationData properties TimePlayed, LastPlayed, and FileSize

Replaced double-based TimePlayed property with TimeSpan?-based one in ApplicationData and ApplicationMetadata
Added a migration for TimePlayed, just like in #4861
Consolidated ApplicationData's FileSize* properties into one FileSize property
Added a formatting/parsing helper class ValueFormatUtils for TimeSpans, DateTimes, and file sizes
Added new value converters for TimeSpans and file sizes for the Avalonia UI
Added TimePlayedSortComparer
Fixed sort order in LastPlayedSortComparer
Fixed sort order for ApplicationData fields TimePlayed, LastPlayed, and FileSize
Fixed crashes caused by SortHelper
Replaced SystemInfo.ToMiBString with ToGiBString backed by ValueFormatUtils
Replaced SaveModel.GetSizeString() with ValueFormatUtils

* Additional ApplicationLibrary changes that got lost in the last commit

* Removed unneeded usings

* Removed converters as they are no longer needed

* Updated comment on FormatDateTime

* Removed base10 parameter from ValueFormatUtils

FormatFileSize now always returns base 2 values with base 10 units
Made ParseFileSize capable of parsing both base 2 and base 10 units

* Removed nullable attribute from TimePlayed property

Centralized TimePlayed update code into ApplicationMetadata

* Changed UpdateTimePlayed() to use TimeSpan logic

* Removed JsonIgnore attributes from ApplicationData

* Implemented requested format changes

* Fixed mistakes in method documentation comments

* Made it so the Last Played value "Never" is localized in the Avalonia UI

* Implemented suggestions

* Remove unused import

* Did a comment refinement pass in ValueFormatUtils.cs

* Reordered ValueFormatUtils methods and sorted them into #regions

* Integrated functionality from #5056

Also removed Logger print from last_played migration code

* Implemented suggestions

* Moved ValueFormatUtils and SystemInfo to namespace Ryujinx.Ui.Common

* common: Respect proper value format convention and use base10 by default

This could be discuss again in another issue/PR, for now revert to the previous behavior.

Signed-off-by: Mary Guillemard <mary@mary.zone>

---------

Signed-off-by: Mary Guillemard <mary@mary.zone>
Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
Co-authored-by: Mary Guillemard <mary@mary.zone>
2023-11-06 22:47:44 +01:00
..
App Overhaul of string formatting/parsing/sorting logic for TimeSpans, DateTimes, and file sizes (#4956) 2023-11-06 22:47:44 +01:00
Configuration Add ldn_mitm as a network client for LDN (#5656) 2023-10-26 00:32:13 +02:00
Extensions [Ryujinx.Ui.Common] Address dotnet-format issues (#5392) 2023-06-29 02:39:22 +02:00
Helper Overhaul of string formatting/parsing/sorting logic for TimeSpans, DateTimes, and file sizes (#4956) 2023-11-06 22:47:44 +01:00
Models [Ryujinx.Ui.Common] Address dotnet-format issues (#5392) 2023-06-29 02:39:22 +02:00
Resources Ava UI: Input Menu Redesign (#4990) 2023-05-22 01:16:20 +02:00
SystemInfo Overhaul of string formatting/parsing/sorting logic for TimeSpans, DateTimes, and file sizes (#4956) 2023-11-06 22:47:44 +01:00
DiscordIntegrationModule.cs [Ryujinx.Ui.Common] Address dotnet-format issues (#5392) 2023-06-29 02:39:22 +02:00
Ryujinx.Ui.Common.csproj Add "Create Shortcut" To app context menu (#4734) 2023-10-20 20:51:15 +02:00
UserError.cs [Ryujinx.Ui.Common] Address dotnet-format issues (#5392) 2023-06-29 02:39:22 +02:00