mirror of
https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies.git
synced 2026-07-29 08:07:37 +00:00
372b8c6463
- Add changelog/1.8.2.html with details for version 1.8.2 - Client status is properly updates after successful MAAC request - Bump version to 1.8.2
41 lines
902 B
C#
41 lines
902 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace NebulaAuth.Model.MAAC;
|
|
|
|
public sealed class PortableMaClientErrorData
|
|
{
|
|
public SortedDictionary<DateTime, Exception> Values { get; } = new();
|
|
public bool NoErrors => Values.Count == 0;
|
|
private readonly object _lock = new();
|
|
|
|
|
|
public DateTime? GetOldestErrorTime()
|
|
{
|
|
if (Values.Count == 0) return null;
|
|
return Values.Keys.First();
|
|
}
|
|
|
|
public void AddEntry(Exception ex)
|
|
{
|
|
lock (_lock)
|
|
Values[DateTime.UtcNow] = ex;
|
|
}
|
|
|
|
public bool Clear()
|
|
{
|
|
if (NoErrors) return false;
|
|
lock (_lock)
|
|
Values.Clear();
|
|
|
|
return true;
|
|
}
|
|
|
|
public TimeSpan? GetTimeFromLastError()
|
|
{
|
|
if (Values.Count == 0) return null;
|
|
var lastEntry = Values.Keys.Last();
|
|
return DateTime.UtcNow - lastEntry;
|
|
}
|
|
} |