Added Image download and compression to archive to Connector.

This commit is contained in:
glax
2023-05-18 16:42:00 +02:00
parent c3cb4d6e08
commit b54ac730b7
2 changed files with 22 additions and 3 deletions

View File

@ -161,6 +161,18 @@ public class MangaDex : Connector
imageFileNames.Add(imageFileNameObject!.GetValue<string>());
foreach(string imageFileName in imageFileNames)
DownloadChapter($"{baseUrl}/{hash}/imageFileName");
DownloadChapterImage($"{baseUrl}/{hash}/{imageFileName}", Path.Join(downloadLocation, publication.sortName));
}
internal override void DownloadImage(string url, string path)
{
DownloadClient.RequestResult requestResult = _downloadClient.GetPage(url);
FileStream fs = new FileStream(path, FileMode.CreateNew);
Span<byte> buffer = new();
while (requestResult.result.CanRead)
{
_ = requestResult.result.Read(buffer);
fs.Write(buffer);
}
}
}