libraryType in constructor
This commit is contained in:
parent
783fd8129e
commit
2d82fe1489
@ -15,7 +15,7 @@ public abstract class LibraryManager
|
|||||||
Kavita = 1
|
Kavita = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
public LibraryType libraryType;
|
public LibraryType libraryType { get; }
|
||||||
public string baseUrl { get; }
|
public string baseUrl { get; }
|
||||||
protected string auth { get; } //Base64 encoded, if you use your password everywhere, you have problems
|
protected string auth { get; } //Base64 encoded, if you use your password everywhere, you have problems
|
||||||
protected Logger? logger;
|
protected Logger? logger;
|
||||||
@ -23,11 +23,12 @@ public abstract class LibraryManager
|
|||||||
/// <param name="baseUrl">Base-URL of Komga instance, no trailing slashes(/)</param>
|
/// <param name="baseUrl">Base-URL of Komga instance, no trailing slashes(/)</param>
|
||||||
/// <param name="auth">Base64 string of username and password (username):(password)</param>
|
/// <param name="auth">Base64 string of username and password (username):(password)</param>
|
||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
protected LibraryManager(string baseUrl, string auth, Logger? logger)
|
protected LibraryManager(string baseUrl, string auth, Logger? logger, LibraryType libraryType)
|
||||||
{
|
{
|
||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
this.auth = auth;
|
this.auth = auth;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
this.libraryType = libraryType;
|
||||||
}
|
}
|
||||||
public abstract void UpdateLibrary();
|
public abstract void UpdateLibrary();
|
||||||
|
|
||||||
|
@ -6,9 +6,8 @@ namespace Tranga.LibraryManagers;
|
|||||||
|
|
||||||
public class Kavita : LibraryManager
|
public class Kavita : LibraryManager
|
||||||
{
|
{
|
||||||
public Kavita(string baseUrl, string apiKey, Logger? logger) : base(baseUrl, apiKey, logger)
|
public Kavita(string baseUrl, string apiKey, Logger? logger) : base(baseUrl, apiKey, logger, LibraryType.Kavita)
|
||||||
{
|
{
|
||||||
this.libraryType = LibraryType.Kavita;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateLibrary()
|
public override void UpdateLibrary()
|
||||||
|
@ -12,15 +12,13 @@ namespace Tranga.LibraryManagers;
|
|||||||
public class Komga : LibraryManager
|
public class Komga : LibraryManager
|
||||||
{
|
{
|
||||||
public Komga(string baseUrl, string username, string password, Logger? logger)
|
public Komga(string baseUrl, string username, string password, Logger? logger)
|
||||||
: base(baseUrl, Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{username}:{password}")), logger)
|
: base(baseUrl, Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{username}:{password}")), logger, LibraryType.Komga)
|
||||||
{
|
{
|
||||||
this.libraryType = LibraryType.Komga;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public Komga(string baseUrl, string auth, Logger? logger) : base(baseUrl, auth, logger)
|
public Komga(string baseUrl, string auth, Logger? logger) : base(baseUrl, auth, logger, LibraryType.Komga)
|
||||||
{
|
{
|
||||||
this.libraryType = LibraryType.Komga;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateLibrary()
|
public override void UpdateLibrary()
|
||||||
|
Loading…
Reference in New Issue
Block a user