mirror of
https://github.com/Maassoft/ColorControl.git
synced 2026-10-21 16:12:18 -05:00
fix issues with new UI, add color profiles, add sdr brightness for AMD
This commit is contained in:
1 parent
4d2ca8a552
commit
f42a46e53f
95 files changed
+12129
-10005
No files matched your search
@@ -0,0 +1,23 @@
|
||||
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace ColorControl.UI.Generics;
|
||||
|
||||
public static class GeneralExtensions
|
||||
{
|
||||
public static async ValueTask<TValue?> TryGet<TValue>(this ProtectedBrowserStorage storage, string key, TValue? def = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await storage.GetAsync<TValue>(key);
|
||||
var value = result.Success ? result.Value : def;
|
||||
|
||||
return value;
|
||||
}
|
||||
catch (CryptographicException)
|
||||
{
|
||||
await storage.DeleteAsync(key);
|
||||
return def;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user