Ryujinx/src/Ryujinx.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
..
Collections GPU: Don't create tracking handles for buffer textures (#5727) 2023-09-26 12:37:10 -03:00
Configuration Add ldn_mitm as a network client for LDN (#5656) 2023-10-26 00:32:13 +02:00
Extensions [Ryujinx.Common] Address dotnet-format issues (#5358) 2023-06-28 18:41:38 +02:00
GraphicsDriver Add workflow to automatically check code style issues for PRs (#4670) 2023-07-24 18:35:04 +02:00
Logging Add workflow to automatically check code style issues for PRs (#4670) 2023-07-24 18:35:04 +02:00
Memory HLE: Fix Mii crc generation and minor issues (#5766) 2023-10-06 19:23:39 -03:00
Pools [Ryujinx.Common] Address dotnet-format issues (#5358) 2023-06-28 18:41:38 +02:00
SystemInterop "static readonly" constants should be "const" instead (#5560) 2023-08-13 19:07:57 -03:00
Utilities Add ldn_mitm as a network client for LDN (#5656) 2023-10-26 00:32:13 +02:00
AsyncWorkQueue.cs Add workflow to automatically check code style issues for PRs (#4670) 2023-07-24 18:35:04 +02:00
Hash128.cs [Ryujinx.Common] Address dotnet-format issues (#5358) 2023-06-28 18:41:38 +02:00
PerformanceCounter.cs [Ryujinx.Common] Address dotnet-format issues (#5358) 2023-06-28 18:41:38 +02:00
ReactiveObject.cs Replace ReaderWriterLock with ReaderWriterLockSlim (#5785) 2023-10-12 18:11:15 +02:00
ReferenceEqualityComparer.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
ReleaseInformation.cs [Ryujinx.Common] Address dotnet-format issues (#5358) 2023-06-28 18:41:38 +02:00
Ryujinx.Common.csproj Move solution and projects to src 2023-04-27 23:51:14 +02:00
XXHash128.cs [Ryujinx.Common] Address dotnet-format issues (#5358) 2023-06-28 18:41:38 +02:00