diff --git a/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs index 329c872..5cfcd3f 100644 --- a/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs +++ b/server/RdtClient.Service/Services/TorrentClients/TorBoxTorrentClient.cs @@ -322,12 +322,14 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien { return fileName.Trim('"'); } - } else + } + else { if (response.Content.Headers.ContentType?.MediaType == "application/zip") { return $"download-{new Random().Next(1, 10001)}.zip"; - } else + } + else { logger.LogDebug($"Failed to get filename for URI {downloadUrl}"); } @@ -353,7 +355,7 @@ public class TorBoxTorrentClient(ILogger logger, IHttpClien return Map(result!); } - + public static void MoveHashDirContents(String extractPath, Torrent _torrent) { var hashDir = Path.Combine(extractPath, _torrent.Hash); diff --git a/server/RdtClient.Service/Services/UnpackClient.cs b/server/RdtClient.Service/Services/UnpackClient.cs index 33e0ff0..d5e1cd7 100644 --- a/server/RdtClient.Service/Services/UnpackClient.cs +++ b/server/RdtClient.Service/Services/UnpackClient.cs @@ -11,13 +11,13 @@ namespace RdtClient.Service.Services; public class UnpackClient(Download download, String destinationPath) { public Boolean Finished { get; private set; } - + public String? Error { get; private set; } - + public Int32 Progess { get; private set; } private readonly Torrent _torrent = download.Torrent ?? throw new($"Torrent is null"); - + private readonly CancellationTokenSource _cancellationTokenSource = new(); public void Start() @@ -70,13 +70,13 @@ public class UnpackClient(Download download, String destinationPath) if (archiveEntries.Any(m => m.Contains(".r00"))) { extractPathTemp = Path.Combine(extractPath, Guid.NewGuid().ToString()); - + if (!Directory.Exists(extractPathTemp)) { Directory.CreateDirectory(extractPathTemp); } } - + if (extractPathTemp != null) { Extract(filePath, extractPathTemp, cancellationToken); @@ -168,10 +168,10 @@ public class UnpackClient(Download download, String destinationPath) d => { Debug.WriteLine(d); - Progess = (Int32) Math.Round(d); + Progess = (Int32)Math.Round(d); }, cancellationToken: cancellationToken); - + archive.Dispose(); GC.Collect();