use prim ctor and fixed warnings: LauncherCallbacks, LauncherController
This commit is contained in:
@@ -8,24 +8,13 @@ using Core.Utils;
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable]
|
||||
public class LauncherCallbacks
|
||||
public class LauncherCallbacks(
|
||||
HttpResponseUtil _httpResponseUtil,
|
||||
LauncherController _launcherController,
|
||||
SaveServer _saveServer,
|
||||
Watermark _watermark
|
||||
)
|
||||
{
|
||||
protected HttpResponseUtil _httpResponseUtil;
|
||||
protected LauncherController _launcherController;
|
||||
protected SaveServer _saveServer;
|
||||
protected Watermark _watermark;
|
||||
public LauncherCallbacks(
|
||||
HttpResponseUtil httpResponse,
|
||||
LauncherController launcherController,
|
||||
SaveServer saveServer,
|
||||
Watermark watermark)
|
||||
{
|
||||
_httpResponseUtil = httpResponse;
|
||||
_launcherController = launcherController;
|
||||
_saveServer = saveServer;
|
||||
_watermark = watermark;
|
||||
}
|
||||
|
||||
public string Connect()
|
||||
{
|
||||
return _httpResponseUtil.NoBody(_launcherController.Connect());
|
||||
|
||||
@@ -99,16 +99,16 @@ public class LauncherController
|
||||
return result;
|
||||
}
|
||||
|
||||
public Info? Find(string sessionId)
|
||||
public Info? Find(string? sessionId)
|
||||
{
|
||||
return _saveServer.GetProfiles().TryGetValue(sessionId, out var profile) ? profile.ProfileInfo : null;
|
||||
return sessionId is not null && _saveServer.GetProfiles().TryGetValue(sessionId, out var profile) ? profile.ProfileInfo : null;
|
||||
}
|
||||
|
||||
public string? Login(LoginRequestData info)
|
||||
public string? Login(LoginRequestData? info)
|
||||
{
|
||||
foreach (var kvp in _saveServer.GetProfiles()) {
|
||||
var account = _saveServer.GetProfile(kvp.Key).ProfileInfo;
|
||||
if (info.Username == account.Username) {
|
||||
if (info?.Username == account?.Username) {
|
||||
return kvp.Key;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user