Fix save errors blocking play session recording. Fix route that SDK client hits for play sessions

net8.0
Pat Hartl 2023-11-20 19:33:48 -06:00
parent 8b3f2c6cde
commit b863080842
2 changed files with 20 additions and 6 deletions

View File

@ -333,11 +333,18 @@ namespace LANCommander.PlaynitePlugin
{
if (args.Game.PluginId == Id)
{
SaveController.Download(args.Game);
var gameId = Guid.Parse(args.Game.GameId);
LANCommanderClient.StartPlaySession(gameId);
try
{
SaveController.Download(args.Game);
}
catch (Exception ex)
{
Logger?.Error(ex, "Could not download save");
}
}
}
@ -345,11 +352,18 @@ namespace LANCommander.PlaynitePlugin
{
if (args.Game.PluginId == Id)
{
SaveController.Upload(args.Game);
var gameId = Guid.Parse(args.Game.GameId);
LANCommanderClient.EndPlaySession(gameId);
try
{
SaveController.Upload(args.Game);
}
catch (Exception ex)
{
Logger?.Error(ex, "Could not upload save");
}
}
}

View File

@ -384,14 +384,14 @@ namespace LANCommander.SDK
{
Logger?.LogTrace("Starting a game session...");
PostRequest<object>($"/api/PlaySession/Start/{gameId}");
PostRequest<object>($"/api/PlaySessions/Start/{gameId}");
}
public void EndPlaySession(Guid gameId)
{
Logger?.LogTrace("Ending a game session...");
PostRequest<object>($"/api/PlaySession/End/{gameId}");
PostRequest<object>($"/api/PlaySessions/End/{gameId}");
}
private string GetMacAddress()