diff --git a/QobuzDownloaderX/Models/Download/TrackRequest.cs b/QobuzDownloaderX/Shared/DownloadRequest.cs similarity index 98% rename from QobuzDownloaderX/Models/Download/TrackRequest.cs rename to QobuzDownloaderX/Shared/DownloadRequest.cs index 5dfe0a4..16d093b 100644 --- a/QobuzDownloaderX/Models/Download/TrackRequest.cs +++ b/QobuzDownloaderX/Shared/DownloadRequest.cs @@ -5,9 +5,9 @@ using QobuzApiSharp.Exceptions; using QobuzApiSharp.Models.Content; using QobuzApiSharp.Service; +using QobuzDownloaderX.Models; using QobuzDownloaderX.Models.Content; using QobuzDownloaderX.Properties; -using QobuzDownloaderX.Shared; using Requests; using Requests.Options; using System; @@ -18,9 +18,9 @@ using System.Linq; using System.Threading.Tasks; -namespace QobuzDownloaderX.Models.Download +namespace QobuzDownloaderX.Shared { - internal class TrackRequest : Request, ISpeedReportable + internal class DownloadRequest : Request, ISpeedReportable { private readonly DownloadLogger _logger; private readonly DownloadItem _downloadItem; @@ -35,7 +35,7 @@ internal class TrackRequest : Request SpeedReporter => _requestContainer.SpeedReporter; - public TrackRequest(TrackRequestOptions options) + public DownloadRequest(DownloadRequestOptions options) : base(options) { _logger = options.Logger; @@ -188,7 +188,7 @@ private bool DownloadTrack(Track qobuzTrack, string basePath, bool isPartOfTrack if (removeTagArtFileAfterDownload) { Notify x = (_, _) => RemoveTempTaggingArtFile(key); - Options.RequestCompleated = (Notify)(Delegate.Combine(Options.RequestCompleated, x)); + Options.RequestCompleated = (Notify)Delegate.Combine(Options.RequestCompleated, x); } return true; } @@ -304,7 +304,7 @@ private bool DownloadAlbum(Album qobuzAlbum, string basePath, string albumPathSu { if (State != RequestState.Running && State != RequestState.Idle) return false; - bool isLastTrackOfAlbum = (i + tracksPageOffset) == (tracksTotal - 1); + bool isLastTrackOfAlbum = i + tracksPageOffset == tracksTotal - 1; Track qobuzTrack = qobuzAlbum.Tracks.Items[i]; qobuzTrack.Album = qobuzAlbum; @@ -312,7 +312,7 @@ private bool DownloadAlbum(Album qobuzAlbum, string basePath, string albumPathSu noErrorsOccured = false; i++; - if (i == tracksLoaded && tracksTotal > (i + tracksPageOffset)) + if (i == tracksLoaded && tracksTotal > i + tracksPageOffset) { tracksPageOffset += tracksLimit; qobuzAlbum = ExecuteApiCall(apiService => apiService.GetAlbum(qobuzAlbum.Id, true, null, tracksLimit, tracksPageOffset)); diff --git a/QobuzDownloaderX/Models/Download/TrackRequestOptions.cs b/QobuzDownloaderX/Shared/DownloadRequestOptions.cs similarity index 74% rename from QobuzDownloaderX/Models/Download/TrackRequestOptions.cs rename to QobuzDownloaderX/Shared/DownloadRequestOptions.cs index 331742e..d8cde9e 100644 --- a/QobuzDownloaderX/Models/Download/TrackRequestOptions.cs +++ b/QobuzDownloaderX/Shared/DownloadRequestOptions.cs @@ -1,9 +1,9 @@ -using QobuzDownloaderX.Shared; +using QobuzDownloaderX.Models; using Requests.Options; -namespace QobuzDownloaderX.Models.Download +namespace QobuzDownloaderX.Shared { - public record TrackRequestOptions : RequestOptions + public record DownloadRequestOptions : RequestOptions { public DownloadLogger Logger { get; init; } public DownloadItem DownloadItem { get; init; } @@ -14,14 +14,14 @@ public record TrackRequestOptions : RequestOptions /// /// Main Constructor /// - public TrackRequestOptions() + public DownloadRequestOptions() { } /// /// Copy Constructor /// /// Copied object - protected TrackRequestOptions(TrackRequestOptions options) : base(options) + protected DownloadRequestOptions(DownloadRequestOptions options) : base(options) { Logger = options.Logger; DownloadItem = options.DownloadItem; diff --git a/QobuzDownloaderX/View/MainForm.cs b/QobuzDownloaderX/View/MainForm.cs index be2b19e..95107aa 100644 --- a/QobuzDownloaderX/View/MainForm.cs +++ b/QobuzDownloaderX/View/MainForm.cs @@ -1,7 +1,6 @@ using DownloadAssistant.Requests; using Newtonsoft.Json.Linq; using QobuzDownloaderX.Models; -using QobuzDownloaderX.Models.Download; using QobuzDownloaderX.Properties; using QobuzDownloaderX.Shared; using QobuzDownloaderX.View; @@ -39,7 +38,7 @@ public QobuzDownloaderX() }; } - private readonly ExtendedContainer _requests = []; + private readonly ExtendedContainer _requests = []; public string DownloadLogPath { get; set; } public int DevClickEggThingValue { get; set; } @@ -299,7 +298,7 @@ public void StartLinkItemDownload(params string[] downloadLinks) output.Invoke(new Action(() => output.AppendText($"URL >{downloadItem.Url}< not understood. Is there a typo?\r\n"))); else - _requests.Add(new TrackRequest(new() + _requests.Add(new DownloadRequest(new() { DownloadItem = downloadItem, UpdateAlbumTagsUi = UpdateAlbumTagsUI,