mirror of
https://github.com/4sval/FModel.git
synced 2026-08-28 12:24:44 -05:00
fixed a few aes problems
This commit is contained in:
@@ -64,28 +64,35 @@ namespace FModel.ViewModels
|
||||
|
||||
_keysFromSettings.MainKey = key;
|
||||
}
|
||||
else if (!_keysFromSettings.HasDynamicKeys)
|
||||
{
|
||||
HasChange = true;
|
||||
_keysFromSettings.DynamicKeys = new List<DynamicKey>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Key = key,
|
||||
FileName = collection[e.CollectionIndex].Name,
|
||||
Guid = collection[e.CollectionIndex].Guid.ToString()
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (_keysFromSettings.DynamicKeys.FirstOrDefault(x => x.Guid == collection[e.CollectionIndex].Guid.ToString()) is { } d)
|
||||
{
|
||||
if (!HasChange)
|
||||
HasChange = FixKey(d.Key) != key;
|
||||
|
||||
d.Key = key;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_keysFromSettings.HasDynamicKeys)
|
||||
HasChange = true;
|
||||
_keysFromSettings.DynamicKeys.Add(new DynamicKey
|
||||
{
|
||||
HasChange = true;
|
||||
_keysFromSettings.DynamicKeys = new[]
|
||||
{
|
||||
new DynamicKey
|
||||
{
|
||||
Key = key,
|
||||
FileName = collection[e.CollectionIndex].Name,
|
||||
Guid = collection[e.CollectionIndex].Guid.ToString()
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (_keysFromSettings.DynamicKeys.FirstOrDefault(x => x.Guid == collection[e.CollectionIndex].Guid.ToString()) is { } d)
|
||||
{
|
||||
if (!HasChange)
|
||||
HasChange = FixKey(d.Key) != key;
|
||||
|
||||
d.Key = key;
|
||||
}
|
||||
Key = key,
|
||||
FileName = collection[e.CollectionIndex].Name,
|
||||
Guid = collection[e.CollectionIndex].Guid.ToString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
||||
|
||||
namespace FModel.ViewModels.ApiEndpoints.Models
|
||||
@@ -8,9 +9,9 @@ namespace FModel.ViewModels.ApiEndpoints.Models
|
||||
{
|
||||
[J("version")] public string Version { get; private set; }
|
||||
[J("mainKey")] public string MainKey { get; set; }
|
||||
[J("dynamicKeys")] public DynamicKey[] DynamicKeys { get; set; }
|
||||
[J("dynamicKeys")] public List<DynamicKey> DynamicKeys { get; set; }
|
||||
|
||||
public bool HasDynamicKeys => DynamicKeys is {Length: > 0};
|
||||
public bool HasDynamicKeys => DynamicKeys is {Count: > 0};
|
||||
}
|
||||
|
||||
[DebuggerDisplay("{" + nameof(Key) + "}")]
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace FModel.ViewModels
|
||||
await _threadWorkerView.Begin(cancellationToken =>
|
||||
{
|
||||
var aes = _apiEndpointView.BenbotApi.GetAesKeys(cancellationToken);
|
||||
if (aes == null) return;
|
||||
if (aes?.MainKey == null && aes?.DynamicKeys == null && aes?.Version == null) return;
|
||||
|
||||
UserSettings.Default.AesKeys[Game] = aes;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user