mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Replace JSON.NET with System.Text.json (#840)
This commit is contained in:
1 parent
e112ca9da8
commit
a340f8822e
63 files changed
+466
-584
No files matched your search
@@ -31,12 +31,24 @@ internal class ProfileCategoryRepository : IProfileCategoryRepository
|
||||
|
||||
public List<ProfileCategoryEntity> GetAll()
|
||||
{
|
||||
return _repository.Query<ProfileCategoryEntity>().ToList();
|
||||
List<ProfileCategoryEntity> categories = _repository.Query<ProfileCategoryEntity>().ToList();
|
||||
|
||||
// Update all profile versions to the current version, profile migrations don't apply to LiteDB so anything loadable is assumed to be up to date
|
||||
foreach (ProfileCategoryEntity profileCategoryEntity in categories)
|
||||
UpdateProfileVersions(profileCategoryEntity);
|
||||
|
||||
return categories;
|
||||
}
|
||||
|
||||
public ProfileCategoryEntity? Get(Guid id)
|
||||
{
|
||||
return _repository.FirstOrDefault<ProfileCategoryEntity>(p => p.Id == id);
|
||||
ProfileCategoryEntity? result = _repository.FirstOrDefault<ProfileCategoryEntity>(p => p.Id == id);
|
||||
if (result == null)
|
||||
return null;
|
||||
|
||||
// Update all profile versions to the current version, profile migrations don't apply to LiteDB so anything loadable is assumed to be up to date
|
||||
UpdateProfileVersions(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public ProfileCategoryEntity IsUnique(string name, Guid? id)
|
||||
@@ -72,4 +84,10 @@ internal class ProfileCategoryRepository : IProfileCategoryRepository
|
||||
|
||||
_profileIcons.Upload(profileConfigurationEntity.FileIconId, profileConfigurationEntity.FileIconId + ".png", stream);
|
||||
}
|
||||
|
||||
private static void UpdateProfileVersions(ProfileCategoryEntity profileCategoryEntity)
|
||||
{
|
||||
foreach (ProfileConfigurationEntity profileConfigurationEntity in profileCategoryEntity.ProfileConfigurations)
|
||||
profileConfigurationEntity.Version = StorageMigrationService.PROFILE_VERSION;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user