2024-08-04 17:53:19 -05:00
|
|
|
|
using LANCommander.Launcher.Data.Models;
|
2024-10-23 18:17:01 -05:00
|
|
|
|
using LANCommander.SDK.Models;
|
2024-09-11 00:24:34 -05:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2024-05-29 19:25:41 -05:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
2024-08-04 17:53:19 -05:00
|
|
|
|
namespace LANCommander.Launcher.Services
|
2024-05-29 19:25:41 -05:00
|
|
|
|
{
|
2024-09-11 00:24:34 -05:00
|
|
|
|
public class SaveService : BaseService
|
2024-05-29 19:25:41 -05:00
|
|
|
|
{
|
2024-09-11 00:24:34 -05:00
|
|
|
|
public SaveService(SDK.Client client, ILogger<SaveService> saveService) : base(client, saveService) { }
|
2024-05-29 19:25:41 -05:00
|
|
|
|
|
2024-10-23 18:17:01 -05:00
|
|
|
|
public async Task<IEnumerable<GameSave>> Get(Guid gameId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await Client.Saves.GetAsync(gameId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-15 19:13:40 -05:00
|
|
|
|
public async Task DownloadLatestAsync(string installDirectory, Guid gameId)
|
|
|
|
|
|
{
|
2024-10-23 18:17:01 -05:00
|
|
|
|
await Client.Saves.DownloadAsync(installDirectory, gameId);
|
2024-07-15 19:13:40 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task DownloadLatest(string installDirectory, Guid gameId)
|
2024-05-29 19:25:41 -05:00
|
|
|
|
{
|
|
|
|
|
|
|
2024-10-23 18:17:01 -05:00
|
|
|
|
await Client.Saves.DownloadAsync(installDirectory, gameId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task DownloadAsync(string installDirectory, Guid gameId, Guid saveId)
|
|
|
|
|
|
{
|
|
|
|
|
|
await Client.Saves.DownloadAsync(installDirectory, gameId, saveId);
|
2024-07-15 19:13:40 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task UploadAsync(string installDirectory, Guid gameId)
|
|
|
|
|
|
{
|
2024-10-23 18:17:01 -05:00
|
|
|
|
await Client.Saves.UploadAsync(installDirectory, gameId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task DeleteAsync(Guid saveId)
|
|
|
|
|
|
{
|
|
|
|
|
|
await Client.Saves.DeleteAsync(saveId);
|
2024-05-29 19:25:41 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-10-23 18:17:01 -05:00
|
|
|
|
|