Allow injection of loggers
parent
5237e88612
commit
20de9d6cae
|
@ -15,7 +15,7 @@ namespace LANCommander.SDK
|
||||||
{
|
{
|
||||||
public class Client
|
public class Client
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger;
|
private readonly ILogger Logger;
|
||||||
|
|
||||||
private readonly RestClient ApiClient;
|
private readonly RestClient ApiClient;
|
||||||
private AuthToken Token;
|
private AuthToken Token;
|
||||||
|
@ -26,6 +26,14 @@ namespace LANCommander.SDK
|
||||||
ApiClient = new RestClient(baseUrl);
|
ApiClient = new RestClient(baseUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Client(string baseUrl, ILogger logger)
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrWhiteSpace(baseUrl))
|
||||||
|
ApiClient = new RestClient(baseUrl);
|
||||||
|
|
||||||
|
Logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
private T PostRequest<T>(string route, object body)
|
private T PostRequest<T>(string route, object body)
|
||||||
{
|
{
|
||||||
var request = new RestRequest(route)
|
var request = new RestRequest(route)
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace LANCommander.SDK
|
||||||
{
|
{
|
||||||
public class GameManager
|
public class GameManager
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger;
|
private readonly ILogger Logger;
|
||||||
private Client Client { get; set; }
|
private Client Client { get; set; }
|
||||||
private string DefaultInstallDirectory { get; set; }
|
private string DefaultInstallDirectory { get; set; }
|
||||||
|
|
||||||
|
@ -30,6 +30,12 @@ namespace LANCommander.SDK
|
||||||
Client = client;
|
Client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GameManager(Client client, ILogger logger)
|
||||||
|
{
|
||||||
|
Client = client;
|
||||||
|
Logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Downloads, extracts, and runs post-install scripts for the specified game
|
/// Downloads, extracts, and runs post-install scripts for the specified game
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace LANCommander.SDK
|
||||||
{
|
{
|
||||||
public class RedistributableManager
|
public class RedistributableManager
|
||||||
{
|
{
|
||||||
private static readonly ILogger Logger;
|
private readonly ILogger Logger;
|
||||||
private Client Client { get; set; }
|
private Client Client { get; set; }
|
||||||
|
|
||||||
public delegate void OnArchiveEntryExtractionProgressHandler(object sender, ArchiveEntryExtractionProgressArgs e);
|
public delegate void OnArchiveEntryExtractionProgressHandler(object sender, ArchiveEntryExtractionProgressArgs e);
|
||||||
|
@ -29,6 +29,12 @@ namespace LANCommander.SDK
|
||||||
Client = client;
|
Client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RedistributableManager(Client client, ILogger logger)
|
||||||
|
{
|
||||||
|
Client = client;
|
||||||
|
Logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
public void Install(Game game)
|
public void Install(Game game)
|
||||||
{
|
{
|
||||||
foreach (var redistributable in game.Redistributables)
|
foreach (var redistributable in game.Redistributables)
|
||||||
|
|
Loading…
Reference in New Issue