Further async changes (#387)

* Further async changes
- SaveServer & Backup Server are now async
- Anything that ties in with SaveServer saving (Such as callbacks) are now async
- Various async util methods added
- Removed two wrapper methods and switched code over to use the actual method

* Update test
This commit is contained in:
Jesse
2025-06-09 21:09:12 +02:00
committed by GitHub
parent c8e1c48e98
commit 2c52012740
20 changed files with 125 additions and 80 deletions
@@ -97,7 +97,7 @@ public class LauncherController(
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public string Register(RegisterData info)
public async Task<string> Register(RegisterData info)
{
foreach (var kvp in _saveServer.GetProfiles())
{
@@ -107,14 +107,14 @@ public class LauncherController(
}
}
return CreateAccount(info);
return await CreateAccount(info);
}
/// <summary>
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
protected string CreateAccount(RegisterData info)
protected async Task<string> CreateAccount(RegisterData info)
{
var profileId = GenerateProfileId();
var scavId = GenerateProfileId();
@@ -130,8 +130,8 @@ public class LauncherController(
};
_saveServer.CreateProfile(newProfileDetails);
_saveServer.LoadProfile(profileId);
_saveServer.SaveProfile(profileId);
await _saveServer.LoadProfileAsync(profileId);
await _saveServer.SaveProfileAsync(profileId);
return profileId;
}
@@ -71,7 +71,7 @@ public class LauncherV2Controller(
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public bool Register(RegisterData info)
public async Task<bool> Register(RegisterData info)
{
foreach (var session in _saveServer.GetProfiles())
{
@@ -81,7 +81,7 @@ public class LauncherV2Controller(
}
}
CreateAccount(info);
await CreateAccount(info);
return true;
}
@@ -90,7 +90,7 @@ public class LauncherV2Controller(
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public bool PasswordChange(ChangeRequestData info)
public async Task<bool> PasswordChange(ChangeRequestData info)
{
var sessionId = GetSessionId(info);
@@ -105,7 +105,7 @@ public class LauncherV2Controller(
}
_saveServer.GetProfile(sessionId).ProfileInfo!.Password = info.Change;
_saveServer.SaveProfile(sessionId);
await _saveServer.SaveProfileAsync(sessionId);
return true;
}
@@ -162,7 +162,7 @@ public class LauncherV2Controller(
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
protected string CreateAccount(RegisterData info)
protected async Task<string> CreateAccount(RegisterData info)
{
var profileId = GenerateProfileId();
var scavId = GenerateProfileId();
@@ -179,8 +179,8 @@ public class LauncherV2Controller(
_saveServer.CreateProfile(newProfileDetails);
_saveServer.LoadProfile(profileId);
_saveServer.SaveProfile(profileId);
await _saveServer.LoadProfileAsync(profileId);
await _saveServer.SaveProfileAsync(profileId);
return profileId;
}
@@ -59,7 +59,7 @@ public class PrestigeController(
/// </list>
/// </summary>
/// <returns></returns>
public void ObtainPrestige(
public async Task ObtainPrestige(
string sessionId,
ObtainPrestigeRequestList request)
{
@@ -75,7 +75,7 @@ public class PrestigeController(
profile.SptData.PendingPrestige = pendingPrestige;
profile.ProfileInfo.IsWiped = true;
_saveServer.SaveProfile(sessionId);
await _saveServer.SaveProfileAsync(sessionId);
}
}
}
@@ -118,9 +118,9 @@ public class ProfileController(
/// <param name="request">Create profile request</param>
/// <param name="sessionId">Player id</param>
/// <returns>Player id</returns>
public virtual string CreateProfile(ProfileCreateRequestData request, string sessionId)
public virtual async ValueTask<string> CreateProfile(ProfileCreateRequestData request, string sessionId)
{
return _createProfileService.CreateProfile(sessionId, request);
return await _createProfileService.CreateProfile(sessionId, request);
}
/// <summary>