use prim ctor and fixed warnings: AchievementController, appContext, ContextVar, BackupService stubbed out
This commit is contained in:
@@ -6,8 +6,8 @@ namespace Core.Context;
|
||||
public class ApplicationContext
|
||||
{
|
||||
private const short MaxSavedValues = 10;
|
||||
protected Dictionary<ContextVariableType, LinkedList<ContextVariable>> variables = new();
|
||||
protected object variablesLock = new();
|
||||
private readonly Dictionary<ContextVariableType, LinkedList<ContextVariable>> variables = new();
|
||||
private readonly Lock variablesLock = new();
|
||||
|
||||
public ContextVariable? GetLatestValue(ContextVariableType type)
|
||||
{
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
namespace Core.Context;
|
||||
|
||||
public class ContextVariable
|
||||
public class ContextVariable(object value, ContextVariableType contextVariableInternalType)
|
||||
{
|
||||
protected object _value;
|
||||
protected ContextVariableType _internalType;
|
||||
protected DateTime _timestamp;
|
||||
|
||||
public ContextVariable(object value, ContextVariableType contextVariableInternalType)
|
||||
{
|
||||
_value = value;
|
||||
_timestamp = DateTime.Now;
|
||||
_internalType = contextVariableInternalType;
|
||||
}
|
||||
private readonly DateTime _timestamp = DateTime.Now;
|
||||
|
||||
public T GetValue<T>() {
|
||||
return (T)_value;
|
||||
return (T)value;
|
||||
}
|
||||
|
||||
public DateTime GetTimestamp()
|
||||
@@ -24,6 +15,6 @@ public class ContextVariable
|
||||
|
||||
public ContextVariableType GetContextType()
|
||||
{
|
||||
return _internalType;
|
||||
return contextVariableInternalType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,14 @@
|
||||
using Core.Annotations;
|
||||
using Core.Models.Eft.Profile;
|
||||
using Core.Models.Utils;
|
||||
using Core.Services;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
[Injectable]
|
||||
public class AchievementController
|
||||
{
|
||||
protected ISptLogger<AchievementController> _logger;
|
||||
protected DatabaseService _databaseService;
|
||||
|
||||
public AchievementController
|
||||
(
|
||||
ISptLogger<AchievementController> logger,
|
||||
DatabaseService databaseService
|
||||
public class AchievementController(
|
||||
DatabaseService _databaseService
|
||||
)
|
||||
{
|
||||
_logger = logger;
|
||||
_databaseService = databaseService;
|
||||
}
|
||||
|
||||
{
|
||||
public GetAchievementsResponse GetAchievements(string sessionID)
|
||||
{
|
||||
return new GetAchievementsResponse
|
||||
@@ -36,7 +24,7 @@ public class AchievementController
|
||||
|
||||
foreach (var achievement in achievements)
|
||||
{
|
||||
stats.Add(achievement.Id, 0);
|
||||
if (achievement.Id != null) stats.Add(achievement.Id, 0);
|
||||
}
|
||||
|
||||
return new()
|
||||
|
||||
@@ -15,7 +15,8 @@ public class BackupService
|
||||
*/
|
||||
public async Task InitAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Console.WriteLine("NEEDS IMPLEMENTING: BackupService");
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user