2
0

Add Connectors to Tranga

This commit is contained in:
glax 2023-08-26 01:47:15 +02:00
parent e6a3fa2899
commit 565bc0775d

View File

@ -1,5 +1,6 @@
using Logging;
using Tranga.Jobs;
using Tranga.MangaConnectors;
namespace Tranga;
@ -8,15 +9,36 @@ public partial class Tranga : GlobalBase
public bool keepRunning;
private JobBoss _jobBoss;
private Server server;
private HashSet<MangaConnector> connectors;
public Tranga(Logger? logger, TrangaSettings settings) : base(logger, settings)
{
keepRunning = true;
_jobBoss = new(this);
connectors = new HashSet<MangaConnector>()
{
new Manganato(this),
new Mangasee(this),
new MangaDex(this),
new MangaKatana(this)
};
StartJobBoss();
this.server = new Server(this);
}
public MangaConnector? GetConnector(string name)
{
foreach(MangaConnector mc in connectors)
if (mc.name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
return mc;
return null;
}
public IEnumerable<MangaConnector> GetConnectors()
{
return connectors;
}
private void StartJobBoss()
{
Thread t = new (() =>