From 565bc0775d87d2039143aded2738258fa4f7bd82 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 26 Aug 2023 01:47:15 +0200 Subject: [PATCH] Add Connectors to Tranga --- Tranga/Tranga.cs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Tranga/Tranga.cs b/Tranga/Tranga.cs index 05c90d5..398879c 100644 --- a/Tranga/Tranga.cs +++ b/Tranga/Tranga.cs @@ -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 connectors; + public Tranga(Logger? logger, TrangaSettings settings) : base(logger, settings) { keepRunning = true; _jobBoss = new(this); + connectors = new HashSet() + { + 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 GetConnectors() + { + return connectors; + } + private void StartJobBoss() { Thread t = new (() =>