diff --git a/Lantean.QBTBlazor.Test/ContentItemSizeComparer.cs b/Lantean.QBTBlazor.Test/ContentItemSizeComparer.cs deleted file mode 100644 index c2b1801..0000000 --- a/Lantean.QBTBlazor.Test/ContentItemSizeComparer.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace Lantean.QBTFluent.Comparers -{ -} \ No newline at end of file diff --git a/Lantean.QBTMud.Test/ContentItemSizeComparer.cs b/Lantean.QBTMud.Test/ContentItemSizeComparer.cs new file mode 100644 index 0000000..ddb0dbc --- /dev/null +++ b/Lantean.QBTMud.Test/ContentItemSizeComparer.cs @@ -0,0 +1,3 @@ +namespace Lantean.QBTMud.Test +{ +} \ No newline at end of file diff --git a/Lantean.QBTBlazor.Test/Lantean.QBTBlazor.Test.csproj b/Lantean.QBTMud.Test/Lantean.QBTMud.Test.csproj similarity index 81% rename from Lantean.QBTBlazor.Test/Lantean.QBTBlazor.Test.csproj rename to Lantean.QBTMud.Test/Lantean.QBTMud.Test.csproj index a0a51bd..1bfaff2 100644 --- a/Lantean.QBTBlazor.Test/Lantean.QBTBlazor.Test.csproj +++ b/Lantean.QBTMud.Test/Lantean.QBTMud.Test.csproj @@ -10,9 +10,10 @@ - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -22,7 +23,7 @@ - + diff --git a/Lantean.QBTMud.Test/Tests.cs b/Lantean.QBTMud.Test/Tests.cs new file mode 100644 index 0000000..38aa916 --- /dev/null +++ b/Lantean.QBTMud.Test/Tests.cs @@ -0,0 +1,6 @@ +namespace Lantean.QBTMud.Test +{ + internal class Tests + { + } +} \ No newline at end of file diff --git a/Lantean.QBTBlazor.Test/UnitTest1.cs b/Lantean.QBTMud.Test/UnitTest1.cs similarity index 98% rename from Lantean.QBTBlazor.Test/UnitTest1.cs rename to Lantean.QBTMud.Test/UnitTest1.cs index 8917a96..29d5ef2 100644 --- a/Lantean.QBTBlazor.Test/UnitTest1.cs +++ b/Lantean.QBTMud.Test/UnitTest1.cs @@ -4,7 +4,7 @@ using System.Linq.Expressions; using System.Text.Json; using Xunit.Abstractions; -namespace Lantean.QBTBlazor.Test +namespace Lantean.QBTMud.Test { public class UnitTest1 { diff --git a/Lantean.QBTBlazor.sln b/Lantean.QBTMud.sln similarity index 91% rename from Lantean.QBTBlazor.sln rename to Lantean.QBTMud.sln index 28dc590..9d4784c 100644 --- a/Lantean.QBTBlazor.sln +++ b/Lantean.QBTMud.sln @@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34511.84 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lantean.QBTBlazor.Test", "Lantean.QBTBlazor.Test\Lantean.QBTBlazor.Test.csproj", "{715E075C-1D86-4A7F-BC72-E1E24A294F17}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lantean.QBTMud.Test", "Lantean.QBTMud.Test\Lantean.QBTMud.Test.csproj", "{715E075C-1D86-4A7F-BC72-E1E24A294F17}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lantean.QBitTorrentClient", "Lantean.QBitTorrentClient\Lantean.QBitTorrentClient.csproj", "{F0DDAB07-0D6C-40C7-AFE6-08FF2C4CC7E7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lantean.QBTMudBlade", "Lantean.QBTMudBlade\Lantean.QBTMudBlade.csproj", "{83BC76CC-D51B-42AF-A6EE-FA400C300098}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lantean.QBTMud", "Lantean.QBTMud\Lantean.QBTMud.csproj", "{83BC76CC-D51B-42AF-A6EE-FA400C300098}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1BF1A631-87D7-4039-A701-88C5E0234B63}" ProjectSection(SolutionItems) = preProject diff --git a/Lantean.QBTMudBlade/App.razor b/Lantean.QBTMud/App.razor similarity index 100% rename from Lantean.QBTMudBlade/App.razor rename to Lantean.QBTMud/App.razor diff --git a/Lantean.QBTMudBlade/Components/ApplicationActions.razor b/Lantean.QBTMud/Components/ApplicationActions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/ApplicationActions.razor rename to Lantean.QBTMud/Components/ApplicationActions.razor diff --git a/Lantean.QBTMudBlade/Components/ApplicationActions.razor.cs b/Lantean.QBTMud/Components/ApplicationActions.razor.cs similarity index 93% rename from Lantean.QBTMudBlade/Components/ApplicationActions.razor.cs rename to Lantean.QBTMud/Components/ApplicationActions.razor.cs index 8771a86..ff66b1b 100644 --- a/Lantean.QBTMudBlade/Components/ApplicationActions.razor.cs +++ b/Lantean.QBTMud/Components/ApplicationActions.razor.cs @@ -1,11 +1,11 @@ -using Lantean.QBitTorrentClient.Models; -using Lantean.QBitTorrentClient; +using Lantean.QBitTorrentClient; +using Lantean.QBitTorrentClient.Models; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class ApplicationActions { @@ -38,7 +38,7 @@ namespace Lantean.QBTMudBlade.Components if (action.Name != "rss" || Preferences is not null && Preferences.RssProcessingEnabled) { yield return action; - } + } } } } @@ -91,4 +91,4 @@ namespace Lantean.QBTMudBlade.Components await DialogService.ShowConfirmDialog("Quit?", "Are you sure you want to exit qBittorrent?", ApiClient.Shutdown); } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddPeerDialog.razor b/Lantean.QBTMud/Components/Dialogs/AddPeerDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/AddPeerDialog.razor rename to Lantean.QBTMud/Components/Dialogs/AddPeerDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddPeerDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/AddPeerDialog.razor.cs similarity index 93% rename from Lantean.QBTMudBlade/Components/Dialogs/AddPeerDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/AddPeerDialog.razor.cs index b6f0a73..7a915be 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/AddPeerDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/AddPeerDialog.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class AddPeerDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTagDialog.razor b/Lantean.QBTMud/Components/Dialogs/AddTagDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTagDialog.razor rename to Lantean.QBTMud/Components/Dialogs/AddTagDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTagDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/AddTagDialog.razor.cs similarity index 86% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTagDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/AddTagDialog.razor.cs index 2f278d2..a8a1005 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/AddTagDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/AddTagDialog.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class AddTagDialog { @@ -47,6 +47,10 @@ namespace Lantean.QBTMudBlade.Components.Dialogs protected void Submit() { + if (Tags.Count == 0 && Tag is not null) + { + Tags.Add(Tag); + } MudDialog.Close(Tags); } diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentFileDialog.razor b/Lantean.QBTMud/Components/Dialogs/AddTorrentFileDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTorrentFileDialog.razor rename to Lantean.QBTMud/Components/Dialogs/AddTorrentFileDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentFileDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/AddTorrentFileDialog.razor.cs similarity index 91% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTorrentFileDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/AddTorrentFileDialog.razor.cs index aa070a7..abe52a1 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentFileDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/AddTorrentFileDialog.razor.cs @@ -1,9 +1,9 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class AddTorrentFileDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentLinkDialog.razor b/Lantean.QBTMud/Components/Dialogs/AddTorrentLinkDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTorrentLinkDialog.razor rename to Lantean.QBTMud/Components/Dialogs/AddTorrentLinkDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentLinkDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/AddTorrentLinkDialog.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTorrentLinkDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/AddTorrentLinkDialog.razor.cs index ec5dc4e..ba4aff1 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentLinkDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/AddTorrentLinkDialog.razor.cs @@ -1,13 +1,14 @@ -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class AddTorrentLinkDialog : IAsyncDisposable { private bool _disposedValue; + private readonly KeyboardEvent _ctrlEnterKey = new KeyboardEvent("Enter") { CtrlKey = true, diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentOptions.razor b/Lantean.QBTMud/Components/Dialogs/AddTorrentOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTorrentOptions.razor rename to Lantean.QBTMud/Components/Dialogs/AddTorrentOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentOptions.razor.cs b/Lantean.QBTMud/Components/Dialogs/AddTorrentOptions.razor.cs similarity index 96% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTorrentOptions.razor.cs rename to Lantean.QBTMud/Components/Dialogs/AddTorrentOptions.razor.cs index 0fb597d..fa298b2 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/AddTorrentOptions.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/AddTorrentOptions.razor.cs @@ -1,8 +1,8 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class AddTorrentOptions { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTrackerDialog.razor b/Lantean.QBTMud/Components/Dialogs/AddTrackerDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTrackerDialog.razor rename to Lantean.QBTMud/Components/Dialogs/AddTrackerDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/AddTrackerDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/AddTrackerDialog.razor.cs similarity index 92% rename from Lantean.QBTMudBlade/Components/Dialogs/AddTrackerDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/AddTrackerDialog.razor.cs index ba6586e..9ec1509 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/AddTrackerDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/AddTrackerDialog.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class AddTrackerDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/CategoryPropertiesDialog.razor b/Lantean.QBTMud/Components/Dialogs/CategoryPropertiesDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/CategoryPropertiesDialog.razor rename to Lantean.QBTMud/Components/Dialogs/CategoryPropertiesDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/CategoryPropertiesDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/CategoryPropertiesDialog.razor.cs similarity index 94% rename from Lantean.QBTMudBlade/Components/Dialogs/CategoryPropertiesDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/CategoryPropertiesDialog.razor.cs index 156ed6a..a695947 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/CategoryPropertiesDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/CategoryPropertiesDialog.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class CategoryPropertiesDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ColumnOptionsDialog.razor b/Lantean.QBTMud/Components/Dialogs/ColumnOptionsDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/ColumnOptionsDialog.razor rename to Lantean.QBTMud/Components/Dialogs/ColumnOptionsDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ColumnOptionsDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/ColumnOptionsDialog.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/Dialogs/ColumnOptionsDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/ColumnOptionsDialog.razor.cs index 7e46e3a..3d53342 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/ColumnOptionsDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/ColumnOptionsDialog.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class ColumnOptionsDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ConfirmDialog.razor b/Lantean.QBTMud/Components/Dialogs/ConfirmDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/ConfirmDialog.razor rename to Lantean.QBTMud/Components/Dialogs/ConfirmDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ConfirmDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/ConfirmDialog.razor.cs similarity index 90% rename from Lantean.QBTMudBlade/Components/Dialogs/ConfirmDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/ConfirmDialog.razor.cs index 084fae0..b32a995 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/ConfirmDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/ConfirmDialog.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class ConfirmDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/DeleteDialog.razor b/Lantean.QBTMud/Components/Dialogs/DeleteDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/DeleteDialog.razor rename to Lantean.QBTMud/Components/Dialogs/DeleteDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/DeleteDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/DeleteDialog.razor.cs similarity index 88% rename from Lantean.QBTMudBlade/Components/Dialogs/DeleteDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/DeleteDialog.razor.cs index e3adec6..4c9627a 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/DeleteDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/DeleteDialog.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class DeleteDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ExceptionDialog.razor b/Lantean.QBTMud/Components/Dialogs/ExceptionDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/ExceptionDialog.razor rename to Lantean.QBTMud/Components/Dialogs/ExceptionDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ExceptionDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/ExceptionDialog.razor.cs similarity index 88% rename from Lantean.QBTMudBlade/Components/Dialogs/ExceptionDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/ExceptionDialog.razor.cs index 0db0252..47c46a0 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/ExceptionDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/ExceptionDialog.razor.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class ExceptionDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/FilterOptionsDialog.razor b/Lantean.QBTMud/Components/Dialogs/FilterOptionsDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/FilterOptionsDialog.razor rename to Lantean.QBTMud/Components/Dialogs/FilterOptionsDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/FilterOptionsDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/FilterOptionsDialog.razor.cs similarity index 96% rename from Lantean.QBTMudBlade/Components/Dialogs/FilterOptionsDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/FilterOptionsDialog.razor.cs index d683dbe..f7f537e 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/FilterOptionsDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/FilterOptionsDialog.razor.cs @@ -1,10 +1,10 @@ -using Lantean.QBTMudBlade.Filter; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Filter; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; using System.Reflection; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class FilterOptionsDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ManageCategoriesDialog.razor b/Lantean.QBTMud/Components/Dialogs/ManageCategoriesDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/ManageCategoriesDialog.razor rename to Lantean.QBTMud/Components/Dialogs/ManageCategoriesDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ManageCategoriesDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/ManageCategoriesDialog.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/Dialogs/ManageCategoriesDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/ManageCategoriesDialog.razor.cs index 9ad30eb..4205632 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/ManageCategoriesDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/ManageCategoriesDialog.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Helpers; +using Lantean.QBTMud.Helpers; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class ManageCategoriesDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ManageTagsDialog.razor b/Lantean.QBTMud/Components/Dialogs/ManageTagsDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/ManageTagsDialog.razor rename to Lantean.QBTMud/Components/Dialogs/ManageTagsDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ManageTagsDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/ManageTagsDialog.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/Dialogs/ManageTagsDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/ManageTagsDialog.razor.cs index f275f86..cbc9427 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/ManageTagsDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/ManageTagsDialog.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Helpers; +using Lantean.QBTMud.Helpers; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class ManageTagsDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/MultipleFieldDialog.razor b/Lantean.QBTMud/Components/Dialogs/MultipleFieldDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/MultipleFieldDialog.razor rename to Lantean.QBTMud/Components/Dialogs/MultipleFieldDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/MultipleFieldDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/MultipleFieldDialog.razor.cs similarity index 94% rename from Lantean.QBTMudBlade/Components/Dialogs/MultipleFieldDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/MultipleFieldDialog.razor.cs index dd0edbc..8480cfe 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/MultipleFieldDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/MultipleFieldDialog.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class MultipleFieldDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/NumericFieldDialog.razor b/Lantean.QBTMud/Components/Dialogs/NumericFieldDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/NumericFieldDialog.razor rename to Lantean.QBTMud/Components/Dialogs/NumericFieldDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/NumericFieldDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/NumericFieldDialog.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Components/Dialogs/NumericFieldDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/NumericFieldDialog.razor.cs index 7b264f9..95807e1 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/NumericFieldDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/NumericFieldDialog.razor.cs @@ -1,9 +1,9 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; using System.Numerics; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class NumericFieldDialog where T : struct, INumber { diff --git a/Lantean.QBTMud/Components/Dialogs/RenameFilesDialog.razor b/Lantean.QBTMud/Components/Dialogs/RenameFilesDialog.razor new file mode 100644 index 0000000..0de18b2 --- /dev/null +++ b/Lantean.QBTMud/Components/Dialogs/RenameFilesDialog.razor @@ -0,0 +1,42 @@ + + + + + + + + + + Close + Rename + + + +@code { + private static RenderFragment> NameColumn + { + get + { + return context => __builder => + { +
= 1 ? 16 : 0)}px")"> + @if (context.Data.IsFolder) + { + + } + @context.Data.OriginalName +
+ ; + }; + } + } +} \ No newline at end of file diff --git a/Lantean.QBTMud/Components/Dialogs/RenameFilesDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/RenameFilesDialog.razor.cs new file mode 100644 index 0000000..3eab22f --- /dev/null +++ b/Lantean.QBTMud/Components/Dialogs/RenameFilesDialog.razor.cs @@ -0,0 +1,468 @@ +using Blazored.LocalStorage; +using Lantean.QBitTorrentClient; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; +using Microsoft.AspNetCore.Components; +using MudBlazor; +using System.Collections.ObjectModel; + +namespace Lantean.QBTMud.Components.Dialogs +{ + public partial class RenameFilesDialog + { + private const string _preferencesStorageKey = "RenameFilesDialog.MultiRenamePreferences"; + + protected static readonly Dictionary AppliesToItems = Enum.GetValues().ToDictionary(v => v, v => v.GetDescriptionAttributeOrDefault()); + + private readonly Dictionary>> _columnRenderFragments = []; + + private string? _sortColumn; + private SortDirection _sortDirection; + + [Inject] + protected IApiClient ApiClient { get; set; } = default!; + + [Inject] + protected IDataManager DataManager { get; set; } = default!; + + [Inject] + protected ILocalStorageService LocalStorage { get; set; } = default!; + + [CascadingParameter] + public MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter] + public string? Hash { get; set; } + + protected HashSet SelectedItems { get; set; } = []; + + protected IEnumerable FileList { get; private set; } = []; + + protected IEnumerable Files => GetFiles(); + + protected HashSet ExpandedNodes { get; set; } = []; + + public RenameFilesDialog() + { + _columnRenderFragments.Add("Name", NameColumn); + //_columnRenderFragments.Add("Replacement", ReplacementColumn); + } + + private ReadOnlyCollection GetFiles() + { + var maxLevel = FileList.Max(f => f.Level); + // this is a flat file structure + if (maxLevel == 0) + { + return FileList.OrderByDirection(_sortDirection, GetSortSelector()).ToList().AsReadOnly(); + } + + var list = new List(); + + var rootItems = FileList.Where(c => c.Level == 0).OrderByDirection(_sortDirection, GetSortSelector()).ToList(); + foreach (var item in rootItems) + { + list.Add(item); + + if (item.IsFolder) + { + var level = 0; + var descendants = GetChildren(item, level); + foreach (var descendant in descendants) + { + list.Add(descendant); + } + } + } + + return list.AsReadOnly(); + } + + private IEnumerable GetRenamedItems(IEnumerable items) + { + var renamedFiles = FileNameMatcher.GetRenamedFiles( + SelectedItems, + Search, + UseRegex, + Replacement, + MatchAllOccurrences, + CaseSensitive, + AppliesToValue, + IncludeFiles, + IncludeFolders, + ReplaceAll, + FileEnumerationStart); + + foreach (var item in items) + { + var fileRow = CreateFileRow(item); + if (renamedFiles.TryGetValue(fileRow.Name, out var renamedRow)) + { + yield return renamedRow; + } + else + { + yield return fileRow; + } + } + } + + private static FileRow CreateFileRow(ContentItem item) + { + var fileRow = new FileRow + { + IsFolder = item.IsFolder, + Level = item.Level, + NewName = item.DisplayName, + OriginalName = item.DisplayName, + Name = item.Name, + Path = item.Path, + }; + + return fileRow; + } + + //private IEnumerable<(FileRow, string)> GetRenamedItemsOld(IEnumerable items) + //{ + // foreach (var item in items) + // { + // if (!SelectedItems.Contains(item)) + // { + // yield return (item, ""); + // continue; + // } + + // if ((item.IsFolder && !IncludeFolders) || (!item.IsFolder && !IncludeFiles)) + // { + // yield return (item, ""); + // continue; + // } + + // if (string.IsNullOrEmpty(Search) || string.IsNullOrEmpty(Replacement)) + // { + // yield return (item, ""); + // continue; + // } + + // var newName = item.DisplayName; + // switch (AppliesToValue) + // { + // case AppliesTo.FilenameExtension: + // newName = ReplaceInString(item.DisplayName); + // break; + + // case AppliesTo.Filename: + // var extension = Path.GetExtension(item.DisplayName); + // var filename = Path.GetFileNameWithoutExtension(item.DisplayName); + // filename = ReplaceInString(filename); + // newName = filename + extension; + // break; + + // case AppliesTo.Extension: + // extension = Path.GetExtension(item.DisplayName); + // string newExtension = ReplaceInString(extension); + // newName = Path.GetFileNameWithoutExtension(item.DisplayName) + newExtension; + // break; + // } + + // yield return (item, newName); + // } + //} + + //private string ReplaceInString(string input) + //{ + // if (UseRegex) + // { + // var regex = new Regex(Search, CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase); + // return MatchAllOccurrences + // ? regex.Replace(input, Replacement) + // : regex.Replace(input, Replacement, 1); + // } + // else + // { + // var comparison = CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + + // if (MatchAllOccurrences) + // { + // return input.Replace(Search, Replacement, comparison); + // } + // else + // { + // var index = input.IndexOf(Search, comparison); + // if (index == -1) + // { + // return input; + // } + // return input.Remove(index, Search.Length).Insert(index, Replacement); + // } + // } + //} + + protected async Task DoRename() + { + if (Hash is null) + { + return; + } + + await RenameAsync(Hash, Files.Where(f => f.Renamed).ToList()); + } + + private async Task RenameAsync(string hash, List matchedFiles) + { + if (matchedFiles == null || matchedFiles.Count == 0 || string.IsNullOrEmpty(hash)) + { + return; + } + + for (int i = matchedFiles.Count - 1; i >= 0; i--) + { + var file = matchedFiles[i]; + var (success, errorMessage) = await RenameItem(hash, file); + file.Renamed = success; + file.ErrorMessage = errorMessage; + } + } + + private async Task<(bool, string?)> RenameItem(string hash, FileRow match) + { + if (match.NewName == match.OriginalName) + { + // Original file name is identical to Renamed + return (false, null); + } + + var newName = match.NewName!; + + var parentPath = Path.GetDirectoryName(match.Name); + var oldPath = string.IsNullOrEmpty(parentPath) + ? match.OriginalName + : Path.Combine(parentPath, match.OriginalName); + var newPath = string.IsNullOrEmpty(parentPath) + ? newName + : Path.Combine(parentPath, newName); + + try + { + if (match.IsFolder) + { + await ApiClient.RenameFile(hash, oldPath, newPath); + } + else + { + await ApiClient.RenameFile(hash, oldPath, newPath); + } + return (true, null); + } + catch (HttpRequestException ex) + { + return (false, ex.Message != "" ? ex.Message : $"Error with request: {ex.StatusCode}."); + } + } + + private IEnumerable GetChildren(FileRow folder, int level) + { + level++; + var descendantsKey = folder.Name.GetDescendantsKey(level); + + foreach (var item in FileList.Where(f => f.Name.StartsWith(descendantsKey) && f.Level == level).OrderByDirection(_sortDirection, GetSortSelector())) + { + if (item.IsFolder) + { + var descendants = GetChildren(item, level); + // if the filter returns some results then show folder item + if (descendants.Any()) + { + yield return item; + } + + // then show children + foreach (var descendant in descendants) + { + yield return descendant; + } + } + else + { + yield return item; + } + } + } + + private Func GetSortSelector() + { + var sortSelector = ColumnsDefinitions.Find(c => c.Id == _sortColumn)?.SortSelector; + + return sortSelector ?? (i => i.Name); + } + + protected void SortColumnChanged(string sortColumn) + { + _sortColumn = sortColumn; + } + + protected void SortDirectionChanged(SortDirection sortDirection) + { + _sortDirection = sortDirection; + } + + protected void SelectedItemsChanged(HashSet selectedItems) + { + SelectedItems = selectedItems; + } + + protected string Search { get; set; } = ""; + + protected void SearchChanged(string value) + { + Search = value; + } + + protected bool UseRegex { get; set; } + + protected void UseRegexChanged(bool value) + { + UseRegex = value; + } + + protected bool MatchAllOccurrences { get; set; } + + protected void MatchAllOccurrencesChanged(bool value) + { + MatchAllOccurrences = value; + } + + protected bool CaseSensitive { get; set; } + + protected void CaseSensitiveChanged(bool value) + { + CaseSensitive = value; + } + + protected string Replacement { get; set; } = ""; + + protected void ReplacementChanged(string value) + { + Replacement = value; + } + + protected AppliesTo AppliesToValue { get; set; } = AppliesTo.FilenameExtension; + + protected void AppliesToChanged(AppliesTo value) + { + AppliesToValue = value; + } + + protected bool IncludeFiles { get; set; } = true; + + protected void IncludeFilesChanged(bool value) + { + IncludeFiles = value; + } + + protected bool IncludeFolders { get; set; } + + protected void IncludeFoldersChanged(bool value) + { + IncludeFolders = value; + } + + protected int FileEnumerationStart { get; set; } + + protected void FileEnumerationStartChanged(int value) + { + FileEnumerationStart = value; + } + + protected bool ReplaceAll { get; set; } + + protected void ReplaceAllChanged(bool value) + { + ReplaceAll = value; + } + + protected override async Task OnInitializedAsync() + { + var preferences = await LocalStorage.GetItemAsync(_preferencesStorageKey) ?? new(); + + if (preferences.RememberPreferences) + { + Search = preferences.Search; + UseRegex = preferences.UseRegex; + MatchAllOccurrences = preferences.MatchAllOccurrences; + CaseSensitive = preferences.CaseSensitive; + Replacement = preferences.Replace; + AppliesToValue = preferences.AppliesTo; + IncludeFiles = preferences.IncludeFiles; + IncludeFolders = preferences.IncludeFolders; + FileEnumerationStart = preferences.FileEnumerationStart; + ReplaceAll = preferences.ReplaceAll; + } + + if (Hash is null) + { + return; + } + + var contents = await ApiClient.GetTorrentContents(Hash); + FileList = GetRenamedItems(DataManager.CreateContentsList(contents).Values); + } + + protected void Cancel() + { + MudDialog.Cancel(); + } + + protected void Submit() + { + MudDialog.Close(); + } + + protected IEnumerable> Columns => GetColumnDefinitions(); + + private IEnumerable> GetColumnDefinitions() + { + foreach (var columnDefinition in ColumnsDefinitions) + { + if (_columnRenderFragments.TryGetValue(columnDefinition.Header, out var fragment)) + { + columnDefinition.RowTemplate = fragment; + } + + yield return columnDefinition; + } + } + + public static List> ColumnsDefinitions { get; } = + [ + ColumnDefinitionHelper.CreateColumnDefinition("Name", c => c.Name, NameColumn, width: 400, initialDirection: SortDirection.Ascending, classFunc: c => c.IsFolder ? "px-0 pt-0 pb-2" : "pa-2"), + ColumnDefinitionHelper.CreateColumnDefinition("Replacement", c => c.NewName), + ]; + + private sealed class MultiRenamePreferences + { + public bool RememberPreferences { get; set; } = false; + + public string Search { get; set; } = ""; + + public bool UseRegex { get; set; } = false; + + public bool MatchAllOccurrences { get; set; } = false; + + public bool CaseSensitive { get; set; } = false; + + public string Replace { get; set; } = ""; + + public AppliesTo AppliesTo { get; set; } = AppliesTo.FilenameExtension; + + public bool IncludeFiles { get; set; } = true; + + public bool IncludeFolders { get; set; } = false; + + public int FileEnumerationStart { get; set; } = 0; + + public bool ReplaceAll { get; set; } = false; + } + } +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Components/Dialogs/RssRulesDialog.razor b/Lantean.QBTMud/Components/Dialogs/RssRulesDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/RssRulesDialog.razor rename to Lantean.QBTMud/Components/Dialogs/RssRulesDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/RssRulesDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/RssRulesDialog.razor.cs similarity index 99% rename from Lantean.QBTMudBlade/Components/Dialogs/RssRulesDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/RssRulesDialog.razor.cs index 1f6a590..3fb48dc 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/RssRulesDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/RssRulesDialog.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Helpers; +using Lantean.QBTMud.Helpers; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class RssRulesDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ShareRatioDialog.razor b/Lantean.QBTMud/Components/Dialogs/ShareRatioDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/ShareRatioDialog.razor rename to Lantean.QBTMud/Components/Dialogs/ShareRatioDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/ShareRatioDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/ShareRatioDialog.razor.cs similarity index 93% rename from Lantean.QBTMudBlade/Components/Dialogs/ShareRatioDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/ShareRatioDialog.razor.cs index 2bff92a..1302594 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/ShareRatioDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/ShareRatioDialog.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class ShareRatioDialog { @@ -67,7 +67,7 @@ namespace Lantean.QBTMudBlade.Components.Dialogs protected override void OnParametersSet() { - if (Value is null || (Value.RatioLimit == Limits.GlobalLimit && Value.SeedingTimeLimit == Limits.GlobalLimit && Value.InactiveSeedingTimeLimit == Limits.GlobalLimit)) + if (Value is null || Value.RatioLimit == Limits.GlobalLimit && Value.SeedingTimeLimit == Limits.GlobalLimit && Value.InactiveSeedingTimeLimit == Limits.GlobalLimit) { ShareRatioType = Limits.GlobalLimit; } diff --git a/Lantean.QBTMudBlade/Components/Dialogs/SliderFieldDialog.razor b/Lantean.QBTMud/Components/Dialogs/SliderFieldDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/SliderFieldDialog.razor rename to Lantean.QBTMud/Components/Dialogs/SliderFieldDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/SliderFieldDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/SliderFieldDialog.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Components/Dialogs/SliderFieldDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/SliderFieldDialog.razor.cs index 6cca826..279e639 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/SliderFieldDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/SliderFieldDialog.razor.cs @@ -1,9 +1,9 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; using System.Numerics; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class SliderFieldDialog where T : struct, INumber { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/StringFieldDialog.razor b/Lantean.QBTMud/Components/Dialogs/StringFieldDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/StringFieldDialog.razor rename to Lantean.QBTMud/Components/Dialogs/StringFieldDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/StringFieldDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/StringFieldDialog.razor.cs similarity index 90% rename from Lantean.QBTMudBlade/Components/Dialogs/StringFieldDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/StringFieldDialog.razor.cs index 8b62ff9..f8d2383 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/StringFieldDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/StringFieldDialog.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class StringFieldDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/SubMenuDialog.razor b/Lantean.QBTMud/Components/Dialogs/SubMenuDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/SubMenuDialog.razor rename to Lantean.QBTMud/Components/Dialogs/SubMenuDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/SubMenuDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/SubMenuDialog.razor.cs similarity index 90% rename from Lantean.QBTMudBlade/Components/Dialogs/SubMenuDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/SubMenuDialog.razor.cs index f9ba156..f20c8f3 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/SubMenuDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/SubMenuDialog.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class SubMenuDialog { diff --git a/Lantean.QBTMudBlade/Components/Dialogs/SubmittableDialog.cs b/Lantean.QBTMud/Components/Dialogs/SubmittableDialog.cs similarity index 91% rename from Lantean.QBTMudBlade/Components/Dialogs/SubmittableDialog.cs rename to Lantean.QBTMud/Components/Dialogs/SubmittableDialog.cs index 7334cae..ce2fb5a 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/SubmittableDialog.cs +++ b/Lantean.QBTMud/Components/Dialogs/SubmittableDialog.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public abstract class SubmittableDialog : ComponentBase, IAsyncDisposable { @@ -43,4 +43,4 @@ namespace Lantean.QBTMudBlade.Components.Dialogs GC.SuppressFinalize(this); } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Components/Dialogs/TorrentOptionsDialog.razor b/Lantean.QBTMud/Components/Dialogs/TorrentOptionsDialog.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Dialogs/TorrentOptionsDialog.razor rename to Lantean.QBTMud/Components/Dialogs/TorrentOptionsDialog.razor diff --git a/Lantean.QBTMudBlade/Components/Dialogs/TorrentOptionsDialog.razor.cs b/Lantean.QBTMud/Components/Dialogs/TorrentOptionsDialog.razor.cs similarity index 94% rename from Lantean.QBTMudBlade/Components/Dialogs/TorrentOptionsDialog.razor.cs rename to Lantean.QBTMud/Components/Dialogs/TorrentOptionsDialog.razor.cs index 3bcc2fe..acfcb25 100644 --- a/Lantean.QBTMudBlade/Components/Dialogs/TorrentOptionsDialog.razor.cs +++ b/Lantean.QBTMud/Components/Dialogs/TorrentOptionsDialog.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Dialogs +namespace Lantean.QBTMud.Components.Dialogs { public partial class TorrentOptionsDialog { diff --git a/Lantean.QBTMudBlade/Components/EnhancedErrorBoundary.cs b/Lantean.QBTMud/Components/EnhancedErrorBoundary.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/EnhancedErrorBoundary.cs rename to Lantean.QBTMud/Components/EnhancedErrorBoundary.cs index 6fcd8bb..15f4b0e 100644 --- a/Lantean.QBTMudBlade/Components/EnhancedErrorBoundary.cs +++ b/Lantean.QBTMud/Components/EnhancedErrorBoundary.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Components.Rendering; using System.Collections.ObjectModel; using System.Runtime.ExceptionServices; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public class EnhancedErrorBoundary : ErrorBoundaryBase { diff --git a/Lantean.QBTMudBlade/Components/ErrorDisplay.razor b/Lantean.QBTMud/Components/ErrorDisplay.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/ErrorDisplay.razor rename to Lantean.QBTMud/Components/ErrorDisplay.razor diff --git a/Lantean.QBTMudBlade/Components/ErrorDisplay.razor.cs b/Lantean.QBTMud/Components/ErrorDisplay.razor.cs similarity index 88% rename from Lantean.QBTMudBlade/Components/ErrorDisplay.razor.cs rename to Lantean.QBTMud/Components/ErrorDisplay.razor.cs index 80a159c..e7ab1a1 100644 --- a/Lantean.QBTMudBlade/Components/ErrorDisplay.razor.cs +++ b/Lantean.QBTMud/Components/ErrorDisplay.razor.cs @@ -1,9 +1,9 @@ -using Lantean.QBTMudBlade.Components.Dialogs; -using Lantean.QBTMudBlade.Helpers; +using Lantean.QBTMud.Components.Dialogs; +using Lantean.QBTMud.Helpers; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class ErrorDisplay { diff --git a/Lantean.QBTMudBlade/Components/FilesTab.razor b/Lantean.QBTMud/Components/FilesTab.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/FilesTab.razor rename to Lantean.QBTMud/Components/FilesTab.razor diff --git a/Lantean.QBTMudBlade/Components/FilesTab.razor.cs b/Lantean.QBTMud/Components/FilesTab.razor.cs similarity index 86% rename from Lantean.QBTMudBlade/Components/FilesTab.razor.cs rename to Lantean.QBTMud/Components/FilesTab.razor.cs index 9808657..23f198f 100644 --- a/Lantean.QBTMudBlade/Components/FilesTab.razor.cs +++ b/Lantean.QBTMud/Components/FilesTab.razor.cs @@ -1,17 +1,17 @@ using Blazored.LocalStorage; using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.Dialogs; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Filter; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Components.Dialogs; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Filter; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using MudBlazor; using System.Collections.ObjectModel; using System.Net; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class FilesTab : IAsyncDisposable { @@ -313,7 +313,7 @@ namespace Lantean.QBTMudBlade.Components } else { - await DialogService.InvokeRenameFilesDialog(ApiClient, Hash); + await DialogService.InvokeRenameFilesDialog(Hash); } } @@ -544,44 +544,12 @@ namespace Lantean.QBTMudBlade.Components public static List> ColumnsDefinitions { get; } = [ - CreateColumnDefinition("Name", c => c.Name, width: 400, initialDirection: SortDirection.Ascending, classFunc: c => c.IsFolder ? "pa-0" : "pa-2"), - CreateColumnDefinition("Total Size", c => c.Size, c => DisplayHelpers.Size(c.Size)), - CreateColumnDefinition("Progress", c => c.Progress, ProgressBarColumn, tdClass: "table-progress pl-2 pr-2"), - CreateColumnDefinition("Priority", c => c.Priority, tdClass: "table-select pa-0"), - CreateColumnDefinition("Remaining", c => c.Remaining, c => DisplayHelpers.Size(c.Remaining)), - CreateColumnDefinition("Availability", c => c.Availability, c => c.Availability.ToString("0.00")), + ColumnDefinitionHelper.CreateColumnDefinition("Name", c => c.Name, width: 400, initialDirection: SortDirection.Ascending, classFunc: c => c.IsFolder ? "pa-0" : "pa-2"), + ColumnDefinitionHelper.CreateColumnDefinition("Total Size", c => c.Size, c => DisplayHelpers.Size(c.Size)), + ColumnDefinitionHelper.CreateColumnDefinition("Progress", c => c.Progress, ProgressBarColumn, tdClass: "table-progress pl-2 pr-2"), + ColumnDefinitionHelper.CreateColumnDefinition("Priority", c => c.Priority, tdClass: "table-select pa-0"), + ColumnDefinitionHelper.CreateColumnDefinition("Remaining", c => c.Remaining, c => DisplayHelpers.Size(c.Remaining)), + ColumnDefinitionHelper.CreateColumnDefinition("Availability", c => c.Availability, c => c.Availability.ToString("0.00")), ]; - - private static ColumnDefinition CreateColumnDefinition(string name, Func selector, RenderFragment> rowTemplate, int? width = null, string? tdClass = null, Func? classFunc = null, bool enabled = true, SortDirection initialDirection = SortDirection.None) - { - var cd = new ColumnDefinition(name, selector, rowTemplate); - cd.Class = "no-wrap"; - if (tdClass is not null) - { - cd.Class += " " + tdClass; - } - cd.ClassFunc = classFunc; - cd.Width = width; - cd.Enabled = enabled; - cd.InitialDirection = initialDirection; - - return cd; - } - - private static ColumnDefinition CreateColumnDefinition(string name, Func selector, Func? formatter = null, int? width = null, string? tdClass = null, Func? classFunc = null, bool enabled = true, SortDirection initialDirection = SortDirection.None) - { - var cd = new ColumnDefinition(name, selector, formatter); - cd.Class = "no-wrap"; - if (tdClass is not null) - { - cd.Class += " " + tdClass; - } - cd.ClassFunc = classFunc; - cd.Width = width; - cd.Enabled = enabled; - cd.InitialDirection = initialDirection; - - return cd; - } } } \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Components/FiltersNav.razor b/Lantean.QBTMud/Components/FiltersNav.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/FiltersNav.razor rename to Lantean.QBTMud/Components/FiltersNav.razor diff --git a/Lantean.QBTMudBlade/Components/FiltersNav.razor.cs b/Lantean.QBTMud/Components/FiltersNav.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/FiltersNav.razor.cs rename to Lantean.QBTMud/Components/FiltersNav.razor.cs index 0275948..4256982 100644 --- a/Lantean.QBTMudBlade/Components/FiltersNav.razor.cs +++ b/Lantean.QBTMud/Components/FiltersNav.razor.cs @@ -1,13 +1,14 @@ using Blazored.LocalStorage; using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.EventHandlers; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using MudBlazor; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class FiltersNav { @@ -35,13 +36,13 @@ namespace Lantean.QBTMudBlade.Components protected string Tracker { get; set; } = FilterHelper.TRACKER_ALL; [Inject] - public ILocalStorageService LocalStorage { get; set; } = default!; + protected ILocalStorageService LocalStorage { get; set; } = default!; [Inject] - public IDialogService DialogService { get; set; } = default!; + protected IDialogService DialogService { get; set; } = default!; [Inject] - public IApiClient ApiClient { get; set; } = default!; + protected IApiClient ApiClient { get; set; } = default!; [CascadingParameter] public MainData? MainData { get; set; } diff --git a/Lantean.QBTMudBlade/Components/GeneralTab.razor b/Lantean.QBTMud/Components/GeneralTab.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/GeneralTab.razor rename to Lantean.QBTMud/Components/GeneralTab.razor diff --git a/Lantean.QBTMudBlade/Components/GeneralTab.razor.cs b/Lantean.QBTMud/Components/GeneralTab.razor.cs similarity index 98% rename from Lantean.QBTMudBlade/Components/GeneralTab.razor.cs rename to Lantean.QBTMud/Components/GeneralTab.razor.cs index 7b5febf..65bac3e 100644 --- a/Lantean.QBTMudBlade/Components/GeneralTab.razor.cs +++ b/Lantean.QBTMud/Components/GeneralTab.razor.cs @@ -1,10 +1,10 @@ using Lantean.QBitTorrentClient; using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using System.Net; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class GeneralTab : IAsyncDisposable { diff --git a/Lantean.QBTMudBlade/Components/Menu.razor b/Lantean.QBTMud/Components/Menu.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Menu.razor rename to Lantean.QBTMud/Components/Menu.razor diff --git a/Lantean.QBTMudBlade/Components/Menu.razor.cs b/Lantean.QBTMud/Components/Menu.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Components/Menu.razor.cs rename to Lantean.QBTMud/Components/Menu.razor.cs index 4685bd3..95ce7ce 100644 --- a/Lantean.QBTMudBlade/Components/Menu.razor.cs +++ b/Lantean.QBTMud/Components/Menu.razor.cs @@ -1,10 +1,10 @@ using Lantean.QBitTorrentClient; using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Helpers; +using Lantean.QBTMud.Helpers; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class Menu { diff --git a/Lantean.QBTMudBlade/Components/Options/AdvancedOptions.razor b/Lantean.QBTMud/Components/Options/AdvancedOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Options/AdvancedOptions.razor rename to Lantean.QBTMud/Components/Options/AdvancedOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Options/AdvancedOptions.razor.cs b/Lantean.QBTMud/Components/Options/AdvancedOptions.razor.cs similarity index 99% rename from Lantean.QBTMudBlade/Components/Options/AdvancedOptions.razor.cs rename to Lantean.QBTMud/Components/Options/AdvancedOptions.razor.cs index c4ec116..754e9d2 100644 --- a/Lantean.QBTMudBlade/Components/Options/AdvancedOptions.razor.cs +++ b/Lantean.QBTMud/Components/Options/AdvancedOptions.razor.cs @@ -2,7 +2,7 @@ using Lantean.QBitTorrentClient.Models; using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public partial class AdvancedOptions : Options { diff --git a/Lantean.QBTMudBlade/Components/Options/BehaviourOptions.razor b/Lantean.QBTMud/Components/Options/BehaviourOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Options/BehaviourOptions.razor rename to Lantean.QBTMud/Components/Options/BehaviourOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Options/BehaviourOptions.razor.cs b/Lantean.QBTMud/Components/Options/BehaviourOptions.razor.cs similarity index 98% rename from Lantean.QBTMudBlade/Components/Options/BehaviourOptions.razor.cs rename to Lantean.QBTMud/Components/Options/BehaviourOptions.razor.cs index 9732a06..c566ecf 100644 --- a/Lantean.QBTMudBlade/Components/Options/BehaviourOptions.razor.cs +++ b/Lantean.QBTMud/Components/Options/BehaviourOptions.razor.cs @@ -1,6 +1,6 @@ using Lantean.QBitTorrentClient.Models; -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public partial class BehaviourOptions : Options { diff --git a/Lantean.QBTMudBlade/Components/Options/BitTorrentOptions.razor b/Lantean.QBTMud/Components/Options/BitTorrentOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Options/BitTorrentOptions.razor rename to Lantean.QBTMud/Components/Options/BitTorrentOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Options/BitTorrentOptions.razor.cs b/Lantean.QBTMud/Components/Options/BitTorrentOptions.razor.cs similarity index 99% rename from Lantean.QBTMudBlade/Components/Options/BitTorrentOptions.razor.cs rename to Lantean.QBTMud/Components/Options/BitTorrentOptions.razor.cs index 5ab6eb9..cbd2816 100644 --- a/Lantean.QBTMudBlade/Components/Options/BitTorrentOptions.razor.cs +++ b/Lantean.QBTMud/Components/Options/BitTorrentOptions.razor.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public partial class BitTorrentOptions : Options { diff --git a/Lantean.QBTMudBlade/Components/Options/ConnectionOptions.razor b/Lantean.QBTMud/Components/Options/ConnectionOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Options/ConnectionOptions.razor rename to Lantean.QBTMud/Components/Options/ConnectionOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Options/ConnectionOptions.razor.cs b/Lantean.QBTMud/Components/Options/ConnectionOptions.razor.cs similarity index 99% rename from Lantean.QBTMudBlade/Components/Options/ConnectionOptions.razor.cs rename to Lantean.QBTMud/Components/Options/ConnectionOptions.razor.cs index 4faaf34..cd5ba5b 100644 --- a/Lantean.QBTMudBlade/Components/Options/ConnectionOptions.razor.cs +++ b/Lantean.QBTMud/Components/Options/ConnectionOptions.razor.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public partial class ConnectionOptions : Options { diff --git a/Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor b/Lantean.QBTMud/Components/Options/DownloadsOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor rename to Lantean.QBTMud/Components/Options/DownloadsOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor.cs b/Lantean.QBTMud/Components/Options/DownloadsOptions.razor.cs similarity index 99% rename from Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor.cs rename to Lantean.QBTMud/Components/Options/DownloadsOptions.razor.cs index 3e5bada..c7169ce 100644 --- a/Lantean.QBTMudBlade/Components/Options/DownloadsOptions.razor.cs +++ b/Lantean.QBTMud/Components/Options/DownloadsOptions.razor.cs @@ -1,6 +1,6 @@ using Lantean.QBitTorrentClient.Models; -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public partial class DownloadsOptions : Options { diff --git a/Lantean.QBTMudBlade/Components/Options/Options.cs b/Lantean.QBTMud/Components/Options/Options.cs similarity index 92% rename from Lantean.QBTMudBlade/Components/Options/Options.cs rename to Lantean.QBTMud/Components/Options/Options.cs index 80c4143..7765574 100644 --- a/Lantean.QBTMudBlade/Components/Options/Options.cs +++ b/Lantean.QBTMud/Components/Options/Options.cs @@ -1,7 +1,7 @@ using Lantean.QBitTorrentClient.Models; using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public abstract class Options : ComponentBase { @@ -23,7 +23,7 @@ namespace Lantean.QBTMudBlade.Components.Options [EditorRequired] public EventCallback PreferencesChanged { get; set; } - protected Func PortNonNegativeValidation = (int port) => + protected Func PortNonNegativeValidation = (port) => { if (port < MinNonNegativePortValue || port > MaxPortValue) { @@ -33,7 +33,7 @@ namespace Lantean.QBTMudBlade.Components.Options return null; }; - protected Func PortValidation = (int port) => + protected Func PortValidation = (port) => { if (port < MinPortValue || port > MaxPortValue) { diff --git a/Lantean.QBTMudBlade/Components/Options/RSSOptions.razor b/Lantean.QBTMud/Components/Options/RSSOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Options/RSSOptions.razor rename to Lantean.QBTMud/Components/Options/RSSOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Options/RSSOptions.razor.cs b/Lantean.QBTMud/Components/Options/RSSOptions.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/Options/RSSOptions.razor.cs rename to Lantean.QBTMud/Components/Options/RSSOptions.razor.cs index 5176227..976933b 100644 --- a/Lantean.QBTMudBlade/Components/Options/RSSOptions.razor.cs +++ b/Lantean.QBTMud/Components/Options/RSSOptions.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Helpers; +using Lantean.QBTMud.Helpers; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public partial class RSSOptions : Options { diff --git a/Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor b/Lantean.QBTMud/Components/Options/SpeedOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor rename to Lantean.QBTMud/Components/Options/SpeedOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor.cs b/Lantean.QBTMud/Components/Options/SpeedOptions.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor.cs rename to Lantean.QBTMud/Components/Options/SpeedOptions.razor.cs index 08bda38..6c9f98a 100644 --- a/Lantean.QBTMudBlade/Components/Options/SpeedOptions.razor.cs +++ b/Lantean.QBTMud/Components/Options/SpeedOptions.razor.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public partial class SpeedOptions : Options { @@ -71,8 +71,8 @@ LimitTcpOverhead = Preferences.LimitTcpOverhead; LimitLanPeers = Preferences.LimitLanPeers; SchedulerEnabled = Preferences.SchedulerEnabled; - ScheduleFrom = TimeSpan.FromMinutes((Preferences.ScheduleFromHour * 60) + Preferences.ScheduleFromMin); - ScheduleTo = TimeSpan.FromMinutes((Preferences.ScheduleToHour * 60) + Preferences.ScheduleToMin); + ScheduleFrom = TimeSpan.FromMinutes(Preferences.ScheduleFromHour * 60 + Preferences.ScheduleFromMin); + ScheduleTo = TimeSpan.FromMinutes(Preferences.ScheduleToHour * 60 + Preferences.ScheduleToMin); SchedulerDays = Preferences.SchedulerDays; return true; diff --git a/Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor b/Lantean.QBTMud/Components/Options/WebUIOptions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor rename to Lantean.QBTMud/Components/Options/WebUIOptions.razor diff --git a/Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor.cs b/Lantean.QBTMud/Components/Options/WebUIOptions.razor.cs similarity index 99% rename from Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor.cs rename to Lantean.QBTMud/Components/Options/WebUIOptions.razor.cs index 63e8310..3a42619 100644 --- a/Lantean.QBTMudBlade/Components/Options/WebUIOptions.razor.cs +++ b/Lantean.QBTMud/Components/Options/WebUIOptions.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Interop; +using Lantean.QBTMud.Interop; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; -namespace Lantean.QBTMudBlade.Components.Options +namespace Lantean.QBTMud.Components.Options { public partial class WebUIOptions : Options { diff --git a/Lantean.QBTMudBlade/Components/PeersTab.razor b/Lantean.QBTMud/Components/PeersTab.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/PeersTab.razor rename to Lantean.QBTMud/Components/PeersTab.razor diff --git a/Lantean.QBTMudBlade/Components/PeersTab.razor.cs b/Lantean.QBTMud/Components/PeersTab.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/PeersTab.razor.cs rename to Lantean.QBTMud/Components/PeersTab.razor.cs index 248c39d..e6c7e01 100644 --- a/Lantean.QBTMudBlade/Components/PeersTab.razor.cs +++ b/Lantean.QBTMud/Components/PeersTab.razor.cs @@ -1,14 +1,14 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using MudBlazor; using System.Data; using System.Net; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class PeersTab : IAsyncDisposable { diff --git a/Lantean.QBTMudBlade/Components/PieceProgress.razor b/Lantean.QBTMud/Components/PieceProgress.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/PieceProgress.razor rename to Lantean.QBTMud/Components/PieceProgress.razor diff --git a/Lantean.QBTMudBlade/Components/PieceProgress.razor.cs b/Lantean.QBTMud/Components/PieceProgress.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/PieceProgress.razor.cs rename to Lantean.QBTMud/Components/PieceProgress.razor.cs index a0b39ae..83f9705 100644 --- a/Lantean.QBTMudBlade/Components/PieceProgress.razor.cs +++ b/Lantean.QBTMud/Components/PieceProgress.razor.cs @@ -1,11 +1,11 @@ using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Interop; +using Lantean.QBTMud.Interop; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MudBlazor; using MudBlazor.Services; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class PieceProgress : IBrowserViewportObserver, IAsyncDisposable { diff --git a/Lantean.QBTMudBlade/Components/TorrentActions.razor b/Lantean.QBTMud/Components/TorrentActions.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/TorrentActions.razor rename to Lantean.QBTMud/Components/TorrentActions.razor diff --git a/Lantean.QBTMudBlade/Components/TorrentActions.razor.cs b/Lantean.QBTMud/Components/TorrentActions.razor.cs similarity index 89% rename from Lantean.QBTMudBlade/Components/TorrentActions.razor.cs rename to Lantean.QBTMud/Components/TorrentActions.razor.cs index fed5cd6..8aa64df 100644 --- a/Lantean.QBTMudBlade/Components/TorrentActions.razor.cs +++ b/Lantean.QBTMud/Components/TorrentActions.razor.cs @@ -1,18 +1,21 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.Dialogs; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Interop; -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Components.Dialogs; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Interop; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MudBlazor; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class TorrentActions : IAsyncDisposable { + private const int _defaultVersion = 5; + private bool _disposedValue; + private int? _version; private List? _actions; @@ -37,6 +40,9 @@ namespace Lantean.QBTMudBlade.Components [Inject] protected IKeyboardService KeyboardService { get; set; } = default!; + [CascadingParameter(Name = "Version")] + public string? Version { get; set; } + [Parameter] [EditorRequired] public IEnumerable Hashes { get; set; } = default!; @@ -68,6 +74,31 @@ namespace Lantean.QBTMudBlade.Components protected bool OverlayVisible { get; set; } + protected int MajorVersion + { + get + { + if (_version is not null) + { + return _version.Value; + } + + if (string.IsNullOrEmpty(Version)) + { + return _defaultVersion; + } + + if (!System.Version.TryParse(Version.Replace("v", ""), out var version)) + { + return _defaultVersion; + } + + _version = version.Major; + + return _version.Value; + } + } + protected override void OnInitialized() { _actions = @@ -124,7 +155,7 @@ namespace Lantean.QBTMudBlade.Components var actionCount = visibleActions.Count(); var separatorCount = visibleActions.Count(c => c.SeparatorBefore); - return (actionCount * 36) + (separatorCount * 1); + return actionCount * 36 + separatorCount * 1; } protected async Task OverlayVisibleChanged(bool value) @@ -193,7 +224,7 @@ namespace Lantean.QBTMudBlade.Components protected async Task RenameFiles() { - await DialogService.InvokeRenameFilesDialog(ApiClient, Hashes.First()); + await DialogService.InvokeRenameFilesDialog(Hashes.First()); } protected async Task SetCategory(string category) @@ -403,13 +434,27 @@ namespace Lantean.QBTMudBlade.Components allAreSuperSeeding = false; } - if (torrent.State != "pausedUP" && torrent.State != "pausedDL") + if (MajorVersion < 5) { - allArePaused = false; + if (torrent.State != "pausedUP" && torrent.State != "pausedDL") + { + allArePaused = false; + } + else + { + thereArePaused = true; + } } else { - thereArePaused = true; + if (torrent.State != "stoppedUP" && torrent.State != "stoppedDL") + { + allArePaused = false; + } + else + { + thereArePaused = true; + } } if (!torrent.ForceStart) @@ -510,6 +555,27 @@ namespace Lantean.QBTMudBlade.Components actionStates["start"] = ActionState.Hidden; } + if (MajorVersion >= 5) + { + if (actionStates.ContainsKey("start")) + { + actionStates["start"].TextOverride = "Start"; + } + else + { + actionStates["start"] = new ActionState { TextOverride = "Start" }; + } + + if (actionStates.ContainsKey("pause")) + { + actionStates["pause"].TextOverride = "Stop"; + } + else + { + actionStates["pause"] = new ActionState { TextOverride = "Stop" }; + } + } + if (!allAreAutoTmm && thereAreAutoTmm) { actionStates["autoTorrentManagement"] = ActionState.Hidden; @@ -552,6 +618,10 @@ namespace Lantean.QBTMudBlade.Components { act.IsChecked = actionState.IsChecked.Value; } + if (actionState.TextOverride is not null) + { + act.Text = actionState.TextOverride; + } yield return act; } @@ -567,6 +637,8 @@ namespace Lantean.QBTMudBlade.Components public bool? IsChecked { get; set; } + public string? TextOverride { get; set; } + public static readonly ActionState Hidden = new() { Show = false }; public static readonly ActionState HasSeperator = new() { HasSeparator = true }; @@ -588,7 +660,6 @@ namespace Lantean.QBTMudBlade.Components } } - public async ValueTask DisposeAsync() { // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method diff --git a/Lantean.QBTMudBlade/Components/TorrentInfo.razor b/Lantean.QBTMud/Components/TorrentInfo.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/TorrentInfo.razor rename to Lantean.QBTMud/Components/TorrentInfo.razor diff --git a/Lantean.QBTMudBlade/Components/TorrentInfo.razor.cs b/Lantean.QBTMud/Components/TorrentInfo.razor.cs similarity index 87% rename from Lantean.QBTMudBlade/Components/TorrentInfo.razor.cs rename to Lantean.QBTMud/Components/TorrentInfo.razor.cs index 6597e2e..6508276 100644 --- a/Lantean.QBTMudBlade/Components/TorrentInfo.razor.cs +++ b/Lantean.QBTMud/Components/TorrentInfo.razor.cs @@ -1,7 +1,7 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class TorrentInfo { diff --git a/Lantean.QBTMudBlade/Components/TorrentsListNav.razor b/Lantean.QBTMud/Components/TorrentsListNav.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/TorrentsListNav.razor rename to Lantean.QBTMud/Components/TorrentsListNav.razor diff --git a/Lantean.QBTMudBlade/Components/TorrentsListNav.razor.cs b/Lantean.QBTMud/Components/TorrentsListNav.razor.cs similarity index 90% rename from Lantean.QBTMudBlade/Components/TorrentsListNav.razor.cs rename to Lantean.QBTMud/Components/TorrentsListNav.razor.cs index d0f7616..e84cbb5 100644 --- a/Lantean.QBTMudBlade/Components/TorrentsListNav.razor.cs +++ b/Lantean.QBTMud/Components/TorrentsListNav.razor.cs @@ -1,9 +1,9 @@ -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Pages; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Pages; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class TorrentsListNav { diff --git a/Lantean.QBTMudBlade/Components/TrackersTab.razor b/Lantean.QBTMud/Components/TrackersTab.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/TrackersTab.razor rename to Lantean.QBTMud/Components/TrackersTab.razor diff --git a/Lantean.QBTMudBlade/Components/TrackersTab.razor.cs b/Lantean.QBTMud/Components/TrackersTab.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Components/TrackersTab.razor.cs rename to Lantean.QBTMud/Components/TrackersTab.razor.cs index ef9b474..599ca10 100644 --- a/Lantean.QBTMudBlade/Components/TrackersTab.razor.cs +++ b/Lantean.QBTMud/Components/TrackersTab.razor.cs @@ -1,16 +1,16 @@ using Lantean.QBitTorrentClient; using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Interop; -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Interop; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MudBlazor; using System.Net; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class TrackersTab : IAsyncDisposable { @@ -168,7 +168,7 @@ namespace Lantean.QBTMudBlade.Components { return; } - + await ApiClient.AddTrackersToTorrent(Hash, trackers); } diff --git a/Lantean.QBTMudBlade/Components/UI/ContextMenu.razor b/Lantean.QBTMud/Components/UI/ContextMenu.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/UI/ContextMenu.razor rename to Lantean.QBTMud/Components/UI/ContextMenu.razor diff --git a/Lantean.QBTMudBlade/Components/UI/ContextMenu.razor.cs b/Lantean.QBTMud/Components/UI/ContextMenu.razor.cs similarity index 98% rename from Lantean.QBTMudBlade/Components/UI/ContextMenu.razor.cs rename to Lantean.QBTMud/Components/UI/ContextMenu.razor.cs index ce3ec2d..57d49d9 100644 --- a/Lantean.QBTMudBlade/Components/UI/ContextMenu.razor.cs +++ b/Lantean.QBTMud/Components/UI/ContextMenu.razor.cs @@ -1,11 +1,12 @@ -using Lantean.QBTMudBlade.Interop; +using Lantean.QBTMud.EventHandlers; +using Lantean.QBTMud.Interop; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using Microsoft.JSInterop; using MudBlazor; using MudBlazor.Utilities; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { // This is a very hacky approach but works for now. // This needs to inherit from MudMenu because MudMenuItem needs a MudMenu passed to it to control the close of the menu when an item is clicked. diff --git a/Lantean.QBTMudBlade/Components/UI/CustomNavLink.razor b/Lantean.QBTMud/Components/UI/CustomNavLink.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/UI/CustomNavLink.razor rename to Lantean.QBTMud/Components/UI/CustomNavLink.razor diff --git a/Lantean.QBTMudBlade/Components/UI/CustomNavLink.razor.cs b/Lantean.QBTMud/Components/UI/CustomNavLink.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Components/UI/CustomNavLink.razor.cs rename to Lantean.QBTMud/Components/UI/CustomNavLink.razor.cs index 5e1c460..f2ff61a 100644 --- a/Lantean.QBTMudBlade/Components/UI/CustomNavLink.razor.cs +++ b/Lantean.QBTMud/Components/UI/CustomNavLink.razor.cs @@ -1,9 +1,10 @@ -using Microsoft.AspNetCore.Components; +using Lantean.QBTMud.EventHandlers; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using MudBlazor; using MudBlazor.Utilities; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { public partial class CustomNavLink { @@ -49,7 +50,6 @@ namespace Lantean.QBTMudBlade.Components.UI [Parameter] public RenderFragment? ContextMenu { get; set; } - protected string Classname => new CssBuilder("mud-nav-item") .AddClass($"mud-ripple", !DisableRipple && !Disabled) diff --git a/Lantean.QBTMudBlade/Components/UI/DynamicTable.razor b/Lantean.QBTMud/Components/UI/DynamicTable.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/UI/DynamicTable.razor rename to Lantean.QBTMud/Components/UI/DynamicTable.razor diff --git a/Lantean.QBTMudBlade/Components/UI/DynamicTable.razor.cs b/Lantean.QBTMud/Components/UI/DynamicTable.razor.cs similarity index 98% rename from Lantean.QBTMudBlade/Components/UI/DynamicTable.razor.cs rename to Lantean.QBTMud/Components/UI/DynamicTable.razor.cs index be40251..696e604 100644 --- a/Lantean.QBTMudBlade/Components/UI/DynamicTable.razor.cs +++ b/Lantean.QBTMud/Components/UI/DynamicTable.razor.cs @@ -1,11 +1,12 @@ using Blazored.LocalStorage; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.EventHandlers; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { public partial class DynamicTable : MudComponentBase { diff --git a/Lantean.QBTMudBlade/Components/UI/FieldSwitch.razor b/Lantean.QBTMud/Components/UI/FieldSwitch.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/UI/FieldSwitch.razor rename to Lantean.QBTMud/Components/UI/FieldSwitch.razor diff --git a/Lantean.QBTMudBlade/Components/UI/FieldSwitch.razor.cs b/Lantean.QBTMud/Components/UI/FieldSwitch.razor.cs similarity index 96% rename from Lantean.QBTMudBlade/Components/UI/FieldSwitch.razor.cs rename to Lantean.QBTMud/Components/UI/FieldSwitch.razor.cs index 2af92ca..d22ab34 100644 --- a/Lantean.QBTMudBlade/Components/UI/FieldSwitch.razor.cs +++ b/Lantean.QBTMud/Components/UI/FieldSwitch.razor.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { public partial class FieldSwitch { diff --git a/Lantean.QBTMudBlade/Components/UI/NonRendering.razor b/Lantean.QBTMud/Components/UI/NonRendering.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/UI/NonRendering.razor rename to Lantean.QBTMud/Components/UI/NonRendering.razor diff --git a/Lantean.QBTMudBlade/Components/UI/NonRendering.razor.cs b/Lantean.QBTMud/Components/UI/NonRendering.razor.cs similarity index 90% rename from Lantean.QBTMudBlade/Components/UI/NonRendering.razor.cs rename to Lantean.QBTMud/Components/UI/NonRendering.razor.cs index b9b4e3f..a376c80 100644 --- a/Lantean.QBTMudBlade/Components/UI/NonRendering.razor.cs +++ b/Lantean.QBTMud/Components/UI/NonRendering.razor.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { /// /// A simple razor wrapper that only renders the child content without any additonal html markup diff --git a/Lantean.QBTMudBlade/Components/UI/SortLabel.razor b/Lantean.QBTMud/Components/UI/SortLabel.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/UI/SortLabel.razor rename to Lantean.QBTMud/Components/UI/SortLabel.razor diff --git a/Lantean.QBTMudBlade/Components/UI/SortLabel.razor.cs b/Lantean.QBTMud/Components/UI/SortLabel.razor.cs similarity index 98% rename from Lantean.QBTMudBlade/Components/UI/SortLabel.razor.cs rename to Lantean.QBTMud/Components/UI/SortLabel.razor.cs index 5b05ff8..18bd550 100644 --- a/Lantean.QBTMudBlade/Components/UI/SortLabel.razor.cs +++ b/Lantean.QBTMud/Components/UI/SortLabel.razor.cs @@ -2,7 +2,7 @@ using MudBlazor; using MudBlazor.Utilities; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { public partial class SortLabel : MudComponentBase { diff --git a/Lantean.QBTMudBlade/Components/UI/TableDataContextMenuEventArgs.cs b/Lantean.QBTMud/Components/UI/TableDataContextMenuEventArgs.cs similarity index 95% rename from Lantean.QBTMudBlade/Components/UI/TableDataContextMenuEventArgs.cs rename to Lantean.QBTMud/Components/UI/TableDataContextMenuEventArgs.cs index 7e34833..7759258 100644 --- a/Lantean.QBTMudBlade/Components/UI/TableDataContextMenuEventArgs.cs +++ b/Lantean.QBTMud/Components/UI/TableDataContextMenuEventArgs.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components.Web; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { public class TableDataContextMenuEventArgs : EventArgs { @@ -40,4 +40,4 @@ namespace Lantean.QBTMudBlade.Components.UI Item = item; } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Components/UI/TableDataLongPressEventArgs.cs b/Lantean.QBTMud/Components/UI/TableDataLongPressEventArgs.cs similarity index 91% rename from Lantean.QBTMudBlade/Components/UI/TableDataLongPressEventArgs.cs rename to Lantean.QBTMud/Components/UI/TableDataLongPressEventArgs.cs index fdcaa3e..94601a0 100644 --- a/Lantean.QBTMudBlade/Components/UI/TableDataLongPressEventArgs.cs +++ b/Lantean.QBTMud/Components/UI/TableDataLongPressEventArgs.cs @@ -1,6 +1,7 @@ -using MudBlazor; +using Lantean.QBTMud.EventHandlers; +using MudBlazor; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { public class TableDataLongPressEventArgs : EventArgs { @@ -39,4 +40,4 @@ namespace Lantean.QBTMudBlade.Components.UI Item = item; } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Components/UI/TdExtended.razor b/Lantean.QBTMud/Components/UI/TdExtended.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/UI/TdExtended.razor rename to Lantean.QBTMud/Components/UI/TdExtended.razor diff --git a/Lantean.QBTMudBlade/Components/UI/TdExtended.razor.cs b/Lantean.QBTMud/Components/UI/TdExtended.razor.cs similarity index 82% rename from Lantean.QBTMudBlade/Components/UI/TdExtended.razor.cs rename to Lantean.QBTMud/Components/UI/TdExtended.razor.cs index 9239f24..7d958f6 100644 --- a/Lantean.QBTMudBlade/Components/UI/TdExtended.razor.cs +++ b/Lantean.QBTMud/Components/UI/TdExtended.razor.cs @@ -1,8 +1,9 @@ -using Microsoft.AspNetCore.Components; +using Lantean.QBTMud.EventHandlers; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using MudBlazor; -namespace Lantean.QBTMudBlade.Components.UI +namespace Lantean.QBTMud.Components.UI { public partial class TdExtended : MudTd { @@ -22,4 +23,4 @@ namespace Lantean.QBTMudBlade.Components.UI return OnContextMenu.InvokeAsync(e); } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Components/UI/TickSwitch.razor b/Lantean.QBTMud/Components/UI/TickSwitch.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/UI/TickSwitch.razor rename to Lantean.QBTMud/Components/UI/TickSwitch.razor diff --git a/Lantean.QBTMudBlade/Components/WebSeedsTab.razor b/Lantean.QBTMud/Components/WebSeedsTab.razor similarity index 100% rename from Lantean.QBTMudBlade/Components/WebSeedsTab.razor rename to Lantean.QBTMud/Components/WebSeedsTab.razor diff --git a/Lantean.QBTMudBlade/Components/WebSeedsTab.razor.cs b/Lantean.QBTMud/Components/WebSeedsTab.razor.cs similarity index 96% rename from Lantean.QBTMudBlade/Components/WebSeedsTab.razor.cs rename to Lantean.QBTMud/Components/WebSeedsTab.razor.cs index a6ab187..12b3003 100644 --- a/Lantean.QBTMudBlade/Components/WebSeedsTab.razor.cs +++ b/Lantean.QBTMud/Components/WebSeedsTab.razor.cs @@ -1,11 +1,11 @@ using Lantean.QBitTorrentClient; using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using System.Net; -namespace Lantean.QBTMudBlade.Components +namespace Lantean.QBTMud.Components { public partial class WebSeedsTab : IAsyncDisposable { diff --git a/Lantean.QBTMudBlade/CustomIcons.cs b/Lantean.QBTMud/CustomIcons.cs similarity index 96% rename from Lantean.QBTMudBlade/CustomIcons.cs rename to Lantean.QBTMud/CustomIcons.cs index 9797bde..89d1da5 100644 --- a/Lantean.QBTMudBlade/CustomIcons.cs +++ b/Lantean.QBTMud/CustomIcons.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade +namespace Lantean.QBTMud { public static class CustomIcons { diff --git a/Lantean.QBTMudBlade/EventHandlers/EventHandlers.cs b/Lantean.QBTMud/EventHandlers/EventHandlers.cs similarity index 84% rename from Lantean.QBTMudBlade/EventHandlers/EventHandlers.cs rename to Lantean.QBTMud/EventHandlers/EventHandlers.cs index 9c48fc2..cdfad75 100644 --- a/Lantean.QBTMudBlade/EventHandlers/EventHandlers.cs +++ b/Lantean.QBTMud/EventHandlers/EventHandlers.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade +namespace Lantean.QBTMud.EventHandlers { [EventHandler("onlongpress", typeof(LongPressEventArgs), enableStopPropagation: true, enablePreventDefault: true)] public static class EventHandlers { } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/EventHandlers/LongPressEventArgs.cs b/Lantean.QBTMud/EventHandlers/LongPressEventArgs.cs similarity index 97% rename from Lantean.QBTMudBlade/EventHandlers/LongPressEventArgs.cs rename to Lantean.QBTMud/EventHandlers/LongPressEventArgs.cs index c91ca44..74c50fe 100644 --- a/Lantean.QBTMudBlade/EventHandlers/LongPressEventArgs.cs +++ b/Lantean.QBTMud/EventHandlers/LongPressEventArgs.cs @@ -1,6 +1,5 @@ -namespace Lantean.QBTMudBlade +namespace Lantean.QBTMud.EventHandlers { - public class LongPressEventArgs : EventArgs { /// @@ -73,4 +72,4 @@ /// public string? Type { get; set; } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Extensions.cs b/Lantean.QBTMud/Extensions.cs similarity index 75% rename from Lantean.QBTMudBlade/Extensions.cs rename to Lantean.QBTMud/Extensions.cs index 87477a1..6e0368e 100644 --- a/Lantean.QBTMudBlade/Extensions.cs +++ b/Lantean.QBTMud/Extensions.cs @@ -1,6 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; +using System.ComponentModel; +using System.Reflection; -namespace Lantean.QBTMudBlade +namespace Lantean.QBTMud { public static class Extensions { @@ -64,5 +66,22 @@ namespace Lantean.QBTMudBlade return !(torrent.State == "metaDL" || torrent.State == "forcedMetaDL" || torrent.TotalSize == -1); } + + public static string GetDescriptionAttributeOrDefault(this T value) where T : Enum + { + var type = typeof(T); + + var memberInfo = type.GetMember(value.ToString()); + if (memberInfo.Length > 0) + { + var attribute = memberInfo[0].GetCustomAttribute(); + if (attribute is not null) + { + return attribute.Description; + } + } + + return value.ToString(); + } } } \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Filter/ExpressionModifier.cs b/Lantean.QBTMud/Filter/ExpressionModifier.cs similarity index 97% rename from Lantean.QBTMudBlade/Filter/ExpressionModifier.cs rename to Lantean.QBTMud/Filter/ExpressionModifier.cs index 4576490..fc3f5b1 100644 --- a/Lantean.QBTMudBlade/Filter/ExpressionModifier.cs +++ b/Lantean.QBTMud/Filter/ExpressionModifier.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; -namespace Lantean.QBTMudBlade.Filter +namespace Lantean.QBTMud.Filter { internal static class ExpressionModifier { @@ -99,7 +99,11 @@ namespace Lantean.QBTMudBlade.Filter [return: NotNullIfNotNull(nameof(node))] public override Expression? Visit(Expression? node) { - if (node == _from) return _to; + if (node == _from) + { + return _to; + } + return base.Visit(node); } } diff --git a/Lantean.QBTMudBlade/Filter/FilterExpressionGenerator.cs b/Lantean.QBTMud/Filter/FilterExpressionGenerator.cs similarity index 99% rename from Lantean.QBTMudBlade/Filter/FilterExpressionGenerator.cs rename to Lantean.QBTMud/Filter/FilterExpressionGenerator.cs index 3fc25e0..5e36869 100644 --- a/Lantean.QBTMudBlade/Filter/FilterExpressionGenerator.cs +++ b/Lantean.QBTMud/Filter/FilterExpressionGenerator.cs @@ -1,7 +1,7 @@ using MudBlazor; using System.Linq.Expressions; -namespace Lantean.QBTMudBlade.Filter +namespace Lantean.QBTMud.Filter { public static class FilterExpressionGenerator { diff --git a/Lantean.QBTMudBlade/Filter/FilterOperator.cs b/Lantean.QBTMud/Filter/FilterOperator.cs similarity index 99% rename from Lantean.QBTMudBlade/Filter/FilterOperator.cs rename to Lantean.QBTMud/Filter/FilterOperator.cs index 9f9b036..3d4b95f 100644 --- a/Lantean.QBTMudBlade/Filter/FilterOperator.cs +++ b/Lantean.QBTMud/Filter/FilterOperator.cs @@ -1,6 +1,6 @@ using MudBlazor; -namespace Lantean.QBTMudBlade.Filter +namespace Lantean.QBTMud.Filter { public static class FilterOperator { diff --git a/Lantean.QBTMudBlade/Filter/PropertyFilterDefinition.cs b/Lantean.QBTMud/Filter/PropertyFilterDefinition.cs similarity index 95% rename from Lantean.QBTMudBlade/Filter/PropertyFilterDefinition.cs rename to Lantean.QBTMud/Filter/PropertyFilterDefinition.cs index 3cf63db..cecf08c 100644 --- a/Lantean.QBTMudBlade/Filter/PropertyFilterDefinition.cs +++ b/Lantean.QBTMud/Filter/PropertyFilterDefinition.cs @@ -1,6 +1,6 @@ using System.Linq.Expressions; -namespace Lantean.QBTMudBlade.Filter +namespace Lantean.QBTMud.Filter { public record PropertyFilterDefinition { diff --git a/Lantean.QBTMudBlade/GlobalSuppressions.cs b/Lantean.QBTMud/GlobalSuppressions.cs similarity index 84% rename from Lantean.QBTMudBlade/GlobalSuppressions.cs rename to Lantean.QBTMud/GlobalSuppressions.cs index d7e85b9..924b2cd 100644 --- a/Lantean.QBTMudBlade/GlobalSuppressions.cs +++ b/Lantean.QBTMud/GlobalSuppressions.cs @@ -1,7 +1,4 @@ // This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. - -using System.Diagnostics.CodeAnalysis; - +// a specific target and scoped to a namespace, type, member, etc. \ No newline at end of file diff --git a/Lantean.QBTMud/Helpers/ColumnDefinitionHelper.cs b/Lantean.QBTMud/Helpers/ColumnDefinitionHelper.cs new file mode 100644 index 0000000..d75d200 --- /dev/null +++ b/Lantean.QBTMud/Helpers/ColumnDefinitionHelper.cs @@ -0,0 +1,42 @@ +using Lantean.QBTMud.Models; +using Microsoft.AspNetCore.Components; +using MudBlazor; + +namespace Lantean.QBTMud.Helpers +{ + public static class ColumnDefinitionHelper + { + public static ColumnDefinition CreateColumnDefinition(string name, Func selector, RenderFragment> rowTemplate, bool iconOnly = false, int? width = null, string? tdClass = null, Func? classFunc = null, bool enabled = true, SortDirection initialDirection = SortDirection.None) + { + var cd = new ColumnDefinition(name, selector, rowTemplate); + cd.Class = "no-wrap"; + if (tdClass is not null) + { + cd.Class += " " + tdClass; + } + cd.ClassFunc = classFunc; + cd.Width = width; + cd.Enabled = enabled; + cd.InitialDirection = initialDirection; + cd.IconOnly = iconOnly; + return cd; + } + + public static ColumnDefinition CreateColumnDefinition(string name, Func selector, Func? formatter = null, bool iconOnly = false, int? width = null, string? tdClass = null, Func? classFunc = null, bool enabled = true, SortDirection initialDirection = SortDirection.None) + { + var cd = new ColumnDefinition(name, selector, formatter); + cd.Class = "no-wrap"; + if (tdClass is not null) + { + cd.Class += " " + tdClass; + } + cd.ClassFunc = classFunc; + cd.Width = width; + cd.Enabled = enabled; + cd.InitialDirection = initialDirection; + cd.IconOnly = iconOnly; + + return cd; + } + } +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Helpers/DialogHelper.cs b/Lantean.QBTMud/Helpers/DialogHelper.cs similarity index 97% rename from Lantean.QBTMudBlade/Helpers/DialogHelper.cs rename to Lantean.QBTMud/Helpers/DialogHelper.cs index 659cfd2..cb517b7 100644 --- a/Lantean.QBTMudBlade/Helpers/DialogHelper.cs +++ b/Lantean.QBTMud/Helpers/DialogHelper.cs @@ -1,24 +1,36 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.Dialogs; -using Lantean.QBTMudBlade.Filter; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Components.Dialogs; +using Lantean.QBTMud.Filter; +using Lantean.QBTMud.Models; using MudBlazor; -namespace Lantean.QBTMudBlade.Helpers +namespace Lantean.QBTMud.Helpers { public static class DialogHelper { + public const long _maxFileSize = 4194304; + public static readonly DialogOptions ConfirmDialogOptions = new() { BackgroundClass = "background-blur", MaxWidth = MaxWidth.Small, FullWidth = true }; public static readonly DialogOptions FormDialogOptions = new() { CloseButton = true, MaxWidth = MaxWidth.Medium, BackgroundClass = "background-blur", FullWidth = true }; + public static readonly DialogOptions FullScreenDialogOptions = new() { CloseButton = true, MaxWidth = MaxWidth.ExtraExtraLarge, BackgroundClass = "background-blur", FullWidth = true }; + public static readonly DialogOptions NonBlurConfirmDialogOptions = new() { MaxWidth = MaxWidth.Small, FullWidth = true }; public static readonly DialogOptions NonBlurFormDialogOptions = new() { CloseButton = true, MaxWidth = MaxWidth.Medium, FullWidth = true }; - public static readonly DialogOptions ConfirmDialogOptions = new() { BackgroundClass = "background-blur", MaxWidth = MaxWidth.Small, FullWidth = true }; + public static async Task InvokeAddCategoryDialog(this IDialogService dialogService, IApiClient apiClient) + { + var reference = await dialogService.ShowAsync("Add Category", NonBlurFormDialogOptions); + var dialogResult = await reference.Result; + if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) + { + return null; + } - public static readonly DialogOptions NonBlurConfirmDialogOptions = new() { MaxWidth = MaxWidth.Small, FullWidth = true }; + var category = (Category)dialogResult.Data; - public static readonly DialogOptions FullScreenDialogOptions = new() { CloseButton = true, MaxWidth = MaxWidth.ExtraExtraLarge, BackgroundClass = "background-blur", FullWidth = true }; + await apiClient.AddCategory(category.Name, category.SavePath); - public const long _maxFileSize = 4194304; + return category.Name; + } public static async Task InvokeAddTorrentFileDialog(this IDialogService dialogService, IApiClient apiClient) { @@ -126,25 +138,31 @@ namespace Lantean.QBTMudBlade.Helpers return true; } - public static async Task InvokeRenameFilesDialog(this IDialogService dialogService, IApiClient apiClient, string hash) + public static async Task InvokeDownloadRateDialog(this IDialogService dialogService, IApiClient apiClient, long rate, IEnumerable hashes) { - await Task.Delay(0); - } + Func valueDisplayFunc = v => v == Limits.NoLimit ? "∞" : v.ToString(); + Func valueGetFunc = v => v == "∞" ? Limits.NoLimit : long.Parse(v); - public static async Task InvokeAddCategoryDialog(this IDialogService dialogService, IApiClient apiClient) - { - var reference = await dialogService.ShowAsync("Add Category", NonBlurFormDialogOptions); - var dialogResult = await reference.Result; + var parameters = new DialogParameters + { + { nameof(SliderFieldDialog.Min), -1L }, + { nameof(SliderFieldDialog.Max), 1000L }, + { nameof(SliderFieldDialog.Value), rate / 1024 }, + { nameof(SliderFieldDialog.ValueDisplayFunc), valueDisplayFunc }, + { nameof(SliderFieldDialog.ValueGetFunc), valueGetFunc }, + { nameof(SliderFieldDialog.Label), "Download rate limit" }, + { nameof(SliderFieldDialog.Adornment), Adornment.End }, + { nameof(SliderFieldDialog.AdornmentText), "KiB/s" }, + }; + var result = await dialogService.ShowAsync>("Download Rate", parameters, FormDialogOptions); + + var dialogResult = await result.Result; if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) { - return null; + return; } - - var category = (Category)dialogResult.Data; - - await apiClient.AddCategory(category.Name, category.SavePath); - - return category.Name; + var kibs = (long)dialogResult.Data; + await apiClient.SetTorrentDownloadLimit(kibs * 1024, null, hashes.ToArray()); } public static async Task InvokeEditCategoryDialog(this IDialogService dialogService, IApiClient apiClient, string categoryName) @@ -170,6 +188,104 @@ namespace Lantean.QBTMudBlade.Helpers return updatedCategory.Name; } + public static async Task InvokeRenameFilesDialog(this IDialogService dialogService, string hash) + { + var parameters = new DialogParameters + { + //{ nameof(RenameFilesDialog.Hash), hash } + }; + + await dialogService.ShowAsync("Rename Files", parameters, FullScreenDialogOptions); + } + + public static async Task InvokeRssRulesDialog(this IDialogService dialogService) + { + await dialogService.ShowAsync("Edit Rss Auto Downloading Rules", FullScreenDialogOptions); + } + + public static async Task InvokeShareRatioDialog(this IDialogService dialogService, IApiClient apiClient, IEnumerable torrents) + { + var torrentShareRatios = torrents.Select(t => new ShareRatioMax + { + InactiveSeedingTimeLimit = t.InactiveSeedingTimeLimit, + MaxInactiveSeedingTime = t.InactiveSeedingTimeLimit, + MaxRatio = t.MaxRatio, + MaxSeedingTime = t.MaxSeedingTime, + RatioLimit = t.RatioLimit, + SeedingTimeLimit = t.SeedingTimeLimit, + }); + + var torrentsHaveSameShareRatio = torrentShareRatios.Distinct().Count() == 1; + + var parameters = new DialogParameters + { + { nameof(ShareRatioDialog.Value), torrentsHaveSameShareRatio ? torrentShareRatios.FirstOrDefault() : null }, + }; + var result = await dialogService.ShowAsync("Share ratio", parameters, FormDialogOptions); + + var dialogResult = await result.Result; + if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) + { + return; + } + + var shareRatio = (ShareRatio)dialogResult.Data; + + await apiClient.SetTorrentShareLimit(shareRatio.RatioLimit, shareRatio.SeedingTimeLimit, shareRatio.InactiveSeedingTimeLimit, null, torrents.Select(t => t.Hash).ToArray()); + } + + public static async Task InvokeStringFieldDialog(this IDialogService dialogService, string title, string label, string? value, Func onSuccess) + { + var result = await dialogService.ShowStringFieldDialog(title, label, value); + + if (result is not null) + { + await onSuccess(result); + } + } + + public static async Task InvokeUploadRateDialog(this IDialogService dialogService, IApiClient apiClient, long rate, IEnumerable hashes) + { + Func valueDisplayFunc = v => v == Limits.NoLimit ? "∞" : v.ToString(); + Func valueGetFunc = v => v == "∞" ? Limits.NoLimit : long.Parse(v); + + var parameters = new DialogParameters + { + { nameof(SliderFieldDialog.Min), -1L }, + { nameof(SliderFieldDialog.Max), 1000L }, + { nameof(SliderFieldDialog.Value), rate / 1024 }, + { nameof(SliderFieldDialog.ValueDisplayFunc), valueDisplayFunc }, + { nameof(SliderFieldDialog.ValueGetFunc), valueGetFunc }, + { nameof(SliderFieldDialog.Label), "Upload rate limit" }, + { nameof(SliderFieldDialog.Adornment), Adornment.End }, + { nameof(SliderFieldDialog.AdornmentText), "KiB/s" }, + }; + var result = await dialogService.ShowAsync>("Upload Rate", parameters, FormDialogOptions); + + var dialogResult = await result.Result; + if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) + { + return; + } + var kibs = (long)dialogResult.Data; + await apiClient.SetTorrentUploadLimit(kibs * 1024, null, hashes.ToArray()); + } + + public static async Task?> ShowAddPeersDialog(this IDialogService dialogService) + { + var reference = await dialogService.ShowAsync("Add Peer", NonBlurFormDialogOptions); + var dialogResult = await reference.Result; + + if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) + { + return null; + } + + var peers = (HashSet)dialogResult.Data; + + return peers; + } + public static async Task?> ShowAddTagsDialog(this IDialogService dialogService) { var reference = await dialogService.ShowAsync("Add Tags", NonBlurFormDialogOptions); @@ -200,19 +316,23 @@ namespace Lantean.QBTMudBlade.Helpers return tags; } - public static async Task?> ShowAddPeersDialog(this IDialogService dialogService) + public static async Task<(HashSet SelectedColumns, Dictionary ColumnWidths)> ShowColumnsOptionsDialog(this IDialogService dialogService, List> columnDefinitions, HashSet selectedColumns, Dictionary widths) { - var reference = await dialogService.ShowAsync("Add Peer", NonBlurFormDialogOptions); - var dialogResult = await reference.Result; + var parameters = new DialogParameters + { + { nameof(ColumnOptionsDialog.Columns), columnDefinitions }, + { nameof(ColumnOptionsDialog.SelectedColumns), selectedColumns }, + { nameof(ColumnOptionsDialog.Widths), widths }, + }; + var reference = await dialogService.ShowAsync>("Column Options", parameters, FormDialogOptions); + var dialogResult = await reference.Result; if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) { - return null; + return default; } - var peers = (HashSet)dialogResult.Data; - - return peers; + return ((HashSet, Dictionary))dialogResult.Data; } public static async Task ShowConfirmDialog(this IDialogService dialogService, string title, string content) @@ -254,14 +374,22 @@ namespace Lantean.QBTMudBlade.Helpers }); } - public static async Task InvokeStringFieldDialog(this IDialogService dialogService, string title, string label, string? value, Func onSuccess) + public static async Task>?> ShowFilterOptionsDialog(this IDialogService dialogService, List>? propertyFilterDefinitions) { - var result = await ShowStringFieldDialog(dialogService, title, label, value); - - if (result is not null) + var parameters = new DialogParameters { - await onSuccess(result); + { nameof(FilterOptionsDialog.FilterDefinitions), propertyFilterDefinitions }, + }; + + var result = await dialogService.ShowAsync>("Filters", parameters, FormDialogOptions); + + var dialogResult = await result.Result; + if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) + { + return null; } + + return (List>?)dialogResult.Data; } public static async Task ShowStringFieldDialog(this IDialogService dialogService, string title, string label, string? value) @@ -282,133 +410,6 @@ namespace Lantean.QBTMudBlade.Helpers return (string)dialogResult.Data; } - public static async Task InvokeDownloadRateDialog(this IDialogService dialogService, IApiClient apiClient, long rate, IEnumerable hashes) - { - Func valueDisplayFunc = v => v == Limits.NoLimit ? "∞" : v.ToString(); - Func valueGetFunc = v => v == "∞" ? Limits.NoLimit : long.Parse(v); - - var parameters = new DialogParameters - { - { nameof(SliderFieldDialog.Min), -1L }, - { nameof(SliderFieldDialog.Max), 1000L }, - { nameof(SliderFieldDialog.Value), rate / 1024 }, - { nameof(SliderFieldDialog.ValueDisplayFunc), valueDisplayFunc }, - { nameof(SliderFieldDialog.ValueGetFunc), valueGetFunc }, - { nameof(SliderFieldDialog.Label), "Download rate limit" }, - { nameof(SliderFieldDialog.Adornment), Adornment.End }, - { nameof(SliderFieldDialog.AdornmentText), "KiB/s" }, - }; - var result = await dialogService.ShowAsync>("Download Rate", parameters, FormDialogOptions); - - var dialogResult = await result.Result; - if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) - { - return; - } - var kibs = (long)dialogResult.Data; - await apiClient.SetTorrentDownloadLimit(kibs * 1024, null, hashes.ToArray()); - } - - public static async Task InvokeUploadRateDialog(this IDialogService dialogService, IApiClient apiClient, long rate, IEnumerable hashes) - { - Func valueDisplayFunc = v => v == Limits.NoLimit ? "∞" : v.ToString(); - Func valueGetFunc = v => v == "∞" ? Limits.NoLimit : long.Parse(v); - - var parameters = new DialogParameters - { - { nameof(SliderFieldDialog.Min), -1L }, - { nameof(SliderFieldDialog.Max), 1000L }, - { nameof(SliderFieldDialog.Value), rate / 1024 }, - { nameof(SliderFieldDialog.ValueDisplayFunc), valueDisplayFunc }, - { nameof(SliderFieldDialog.ValueGetFunc), valueGetFunc }, - { nameof(SliderFieldDialog.Label), "Upload rate limit" }, - { nameof(SliderFieldDialog.Adornment), Adornment.End }, - { nameof(SliderFieldDialog.AdornmentText), "KiB/s" }, - }; - var result = await dialogService.ShowAsync>("Upload Rate", parameters, FormDialogOptions); - - var dialogResult = await result.Result; - if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) - { - return; - } - var kibs = (long)dialogResult.Data; - await apiClient.SetTorrentUploadLimit(kibs * 1024, null, hashes.ToArray()); - } - - public static async Task InvokeShareRatioDialog(this IDialogService dialogService, IApiClient apiClient, IEnumerable torrents) - { - var torrentShareRatios = torrents.Select(t => new ShareRatioMax - { - InactiveSeedingTimeLimit = t.InactiveSeedingTimeLimit, - MaxInactiveSeedingTime = t.InactiveSeedingTimeLimit, - MaxRatio = t.MaxRatio, - MaxSeedingTime = t.MaxSeedingTime, - RatioLimit = t.RatioLimit, - SeedingTimeLimit = t.SeedingTimeLimit, - }); - - var torrentsHaveSameShareRatio = torrentShareRatios.Distinct().Count() == 1; - - var parameters = new DialogParameters - { - { nameof(ShareRatioDialog.Value), torrentsHaveSameShareRatio ? torrentShareRatios.FirstOrDefault() : null }, - }; - var result = await dialogService.ShowAsync("Share ratio", parameters, FormDialogOptions); - - var dialogResult = await result.Result; - if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) - { - return; - } - - var shareRatio = (ShareRatio)dialogResult.Data; - - await apiClient.SetTorrentShareLimit(shareRatio.RatioLimit, shareRatio.SeedingTimeLimit, shareRatio.InactiveSeedingTimeLimit, null, torrents.Select(t => t.Hash).ToArray()); - } - - public static async Task>?> ShowFilterOptionsDialog(this IDialogService dialogService, List>? propertyFilterDefinitions) - { - var parameters = new DialogParameters - { - { nameof(FilterOptionsDialog.FilterDefinitions), propertyFilterDefinitions }, - }; - - var result = await dialogService.ShowAsync>("Filters", parameters, FormDialogOptions); - - var dialogResult = await result.Result; - if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) - { - return null; - } - - return (List>?)dialogResult.Data; - } - - public static async Task<(HashSet SelectedColumns, Dictionary ColumnWidths)> ShowColumnsOptionsDialog(this IDialogService dialogService, List> columnDefinitions, HashSet selectedColumns, Dictionary widths) - { - var parameters = new DialogParameters - { - { nameof(ColumnOptionsDialog.Columns), columnDefinitions }, - { nameof(ColumnOptionsDialog.SelectedColumns), selectedColumns }, - { nameof(ColumnOptionsDialog.Widths), widths }, - }; - - var reference = await dialogService.ShowAsync>("Column Options", parameters, FormDialogOptions); - var dialogResult = await reference.Result; - if (dialogResult is null || dialogResult.Canceled || dialogResult.Data is null) - { - return default; - } - - return ((HashSet, Dictionary))dialogResult.Data; - } - - public static async Task InvokeRssRulesDialog(this IDialogService dialogService) - { - await dialogService.ShowAsync("Edit Rss Auto Downloading Rules", FullScreenDialogOptions); - } - public static async Task ShowSubMenu(this IDialogService dialogService, IEnumerable hashes, UIAction parent, Dictionary torrents, QBitTorrentClient.Models.Preferences? preferences) { var parameters = new DialogParameters diff --git a/Lantean.QBTMudBlade/Helpers/DisplayHelpers.cs b/Lantean.QBTMud/Helpers/DisplayHelpers.cs similarity index 96% rename from Lantean.QBTMudBlade/Helpers/DisplayHelpers.cs rename to Lantean.QBTMud/Helpers/DisplayHelpers.cs index 98d261e..b3e918e 100644 --- a/Lantean.QBTMudBlade/Helpers/DisplayHelpers.cs +++ b/Lantean.QBTMud/Helpers/DisplayHelpers.cs @@ -1,10 +1,10 @@ using ByteSizeLib; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using MudBlazor; using System.Diagnostics.CodeAnalysis; using System.Text; -namespace Lantean.QBTMudBlade.Helpers +namespace Lantean.QBTMud.Helpers { public static class DisplayHelpers { @@ -322,6 +322,8 @@ namespace Lantean.QBTMudBlade.Helpers "checkingResumeData" => "Checking resume data", "pausedDL" => "Paused", "pausedUP" => "Completed", + "stoppedDL" => "Stopped", + "stoppedUP" => "Completed", "moving" => "Moving", "missingFiles" => "Missing Files", "error" => "Errored", @@ -357,6 +359,12 @@ namespace Lantean.QBTMudBlade.Helpers case "pausedUP": return (Icons.Material.Filled.Pause, Color.Info); + case "stoppedDL": + return (Icons.Material.Filled.Stop, Color.Success); + + case "stoppedUP": + return (Icons.Material.Filled.Stop, Color.Info); + case "queuedDL": case "queuedUP": return (Icons.Material.Filled.Queue, Color.Default); @@ -398,6 +406,7 @@ namespace Lantean.QBTMudBlade.Helpers Status.Completed => (Icons.Material.Filled.Check, Color.Default), Status.Resumed => (Icons.Material.Filled.PlayArrow, Color.Success), Status.Paused => (Icons.Material.Filled.Pause, Color.Default), + Status.Stopped => (Icons.Material.Filled.Stop, Color.Default), Status.Active => (Icons.Material.Filled.Sort, Color.Success), Status.Inactive => (Icons.Material.Filled.Sort, Color.Error), Status.Stalled => (Icons.Material.Filled.Sort, Color.Info), diff --git a/Lantean.QBTMudBlade/Helpers/FilterHelper.cs b/Lantean.QBTMud/Helpers/FilterHelper.cs similarity index 98% rename from Lantean.QBTMudBlade/Helpers/FilterHelper.cs rename to Lantean.QBTMud/Helpers/FilterHelper.cs index 2f159df..4c9f5e2 100644 --- a/Lantean.QBTMudBlade/Helpers/FilterHelper.cs +++ b/Lantean.QBTMud/Helpers/FilterHelper.cs @@ -1,6 +1,6 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; -namespace Lantean.QBTMudBlade.Helpers +namespace Lantean.QBTMud.Helpers { public static class FilterHelper { @@ -207,7 +207,7 @@ namespace Lantean.QBTMudBlade.Helpers break; case Status.Paused: - if (!state.Contains("paused")) + if (!state.Contains("paused") || !state.Contains("stopped")) { return false; } diff --git a/Lantean.QBTMudBlade/Interop/BoundingClientRect.cs b/Lantean.QBTMud/Interop/BoundingClientRect.cs similarity index 88% rename from Lantean.QBTMudBlade/Interop/BoundingClientRect.cs rename to Lantean.QBTMud/Interop/BoundingClientRect.cs index 85c5d6e..a11e2fa 100644 --- a/Lantean.QBTMudBlade/Interop/BoundingClientRect.cs +++ b/Lantean.QBTMud/Interop/BoundingClientRect.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Interop +namespace Lantean.QBTMud.Interop { public class BoundingClientRect : ClientSize { diff --git a/Lantean.QBTMudBlade/Interop/ClientSize.cs b/Lantean.QBTMud/Interop/ClientSize.cs similarity index 75% rename from Lantean.QBTMudBlade/Interop/ClientSize.cs rename to Lantean.QBTMud/Interop/ClientSize.cs index 2317e1b..7d8b985 100644 --- a/Lantean.QBTMudBlade/Interop/ClientSize.cs +++ b/Lantean.QBTMud/Interop/ClientSize.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Interop +namespace Lantean.QBTMud.Interop { public class ClientSize { diff --git a/Lantean.QBTMudBlade/Interop/InteropHelper.cs b/Lantean.QBTMud/Interop/InteropHelper.cs similarity index 97% rename from Lantean.QBTMudBlade/Interop/InteropHelper.cs rename to Lantean.QBTMud/Interop/InteropHelper.cs index 3896f43..0277c7f 100644 --- a/Lantean.QBTMudBlade/Interop/InteropHelper.cs +++ b/Lantean.QBTMud/Interop/InteropHelper.cs @@ -1,6 +1,6 @@ using Microsoft.JSInterop; -namespace Lantean.QBTMudBlade.Interop +namespace Lantean.QBTMud.Interop { public static class InteropHelper { @@ -8,12 +8,12 @@ namespace Lantean.QBTMudBlade.Interop { return await runtime.InvokeAsync("qbt.getBoundingClientRect", selector); } - + public static async Task GetWindowSize(this IJSRuntime runtime) { return await runtime.InvokeAsync("qbt.getWindowSize"); } - + public static async Task GetInnerDimensions(this IJSRuntime runtime, string selector) { return await runtime.InvokeAsync("qbt.getInnerDimensions", selector); diff --git a/Lantean.QBTMudBlade/Lantean.QBTMudBlade.csproj b/Lantean.QBTMud/Lantean.QBTMud.csproj similarity index 73% rename from Lantean.QBTMudBlade/Lantean.QBTMudBlade.csproj rename to Lantean.QBTMud/Lantean.QBTMud.csproj index 44b14ee..7eb8098 100644 --- a/Lantean.QBTMudBlade/Lantean.QBTMudBlade.csproj +++ b/Lantean.QBTMud/Lantean.QBTMud.csproj @@ -6,18 +6,19 @@ enable true false + 12 - - - - - + + + + + - + diff --git a/Lantean.QBTMudBlade/Layout/DetailsLayout.razor b/Lantean.QBTMud/Layout/DetailsLayout.razor similarity index 100% rename from Lantean.QBTMudBlade/Layout/DetailsLayout.razor rename to Lantean.QBTMud/Layout/DetailsLayout.razor diff --git a/Lantean.QBTMudBlade/Layout/DetailsLayout.razor.cs b/Lantean.QBTMud/Layout/DetailsLayout.razor.cs similarity index 92% rename from Lantean.QBTMudBlade/Layout/DetailsLayout.razor.cs rename to Lantean.QBTMud/Layout/DetailsLayout.razor.cs index 1bc1adb..a733a3d 100644 --- a/Lantean.QBTMudBlade/Layout/DetailsLayout.razor.cs +++ b/Lantean.QBTMud/Layout/DetailsLayout.razor.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Layout +namespace Lantean.QBTMud.Layout { public partial class DetailsLayout { diff --git a/Lantean.QBTMudBlade/Layout/ListLayout.razor b/Lantean.QBTMud/Layout/ListLayout.razor similarity index 100% rename from Lantean.QBTMudBlade/Layout/ListLayout.razor rename to Lantean.QBTMud/Layout/ListLayout.razor diff --git a/Lantean.QBTMudBlade/Layout/ListLayout.razor.cs b/Lantean.QBTMud/Layout/ListLayout.razor.cs similarity index 91% rename from Lantean.QBTMudBlade/Layout/ListLayout.razor.cs rename to Lantean.QBTMud/Layout/ListLayout.razor.cs index 84a32d0..8828ebb 100644 --- a/Lantean.QBTMudBlade/Layout/ListLayout.razor.cs +++ b/Lantean.QBTMud/Layout/ListLayout.razor.cs @@ -1,7 +1,7 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Layout +namespace Lantean.QBTMud.Layout { public partial class ListLayout { diff --git a/Lantean.QBTMudBlade/Layout/LoggedInLayout.razor b/Lantean.QBTMud/Layout/LoggedInLayout.razor similarity index 100% rename from Lantean.QBTMudBlade/Layout/LoggedInLayout.razor rename to Lantean.QBTMud/Layout/LoggedInLayout.razor diff --git a/Lantean.QBTMudBlade/Layout/LoggedInLayout.razor.cs b/Lantean.QBTMud/Layout/LoggedInLayout.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Layout/LoggedInLayout.razor.cs rename to Lantean.QBTMud/Layout/LoggedInLayout.razor.cs index 831cb83..cad0081 100644 --- a/Lantean.QBTMudBlade/Layout/LoggedInLayout.razor.cs +++ b/Lantean.QBTMud/Layout/LoggedInLayout.razor.cs @@ -1,12 +1,12 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Components; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Layout +namespace Lantean.QBTMud.Layout { public partial class LoggedInLayout : IDisposable { diff --git a/Lantean.QBTMudBlade/Layout/MainLayout.razor b/Lantean.QBTMud/Layout/MainLayout.razor similarity index 100% rename from Lantean.QBTMudBlade/Layout/MainLayout.razor rename to Lantean.QBTMud/Layout/MainLayout.razor diff --git a/Lantean.QBTMudBlade/Layout/MainLayout.razor.cs b/Lantean.QBTMud/Layout/MainLayout.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Layout/MainLayout.razor.cs rename to Lantean.QBTMud/Layout/MainLayout.razor.cs index dd48b56..d73ad54 100644 --- a/Lantean.QBTMudBlade/Layout/MainLayout.razor.cs +++ b/Lantean.QBTMud/Layout/MainLayout.razor.cs @@ -1,11 +1,10 @@ using Blazored.LocalStorage; -using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components; +using Lantean.QBTMud.Components; using Microsoft.AspNetCore.Components; using MudBlazor; using MudBlazor.Services; -namespace Lantean.QBTMudBlade.Layout +namespace Lantean.QBTMud.Layout { public partial class MainLayout : IBrowserViewportObserver, IAsyncDisposable { @@ -20,9 +19,6 @@ namespace Lantean.QBTMudBlade.Layout [Inject] private IBrowserViewportService BrowserViewportService { get; set; } = default!; - [Inject] - private IApiClient ApiClient { get; set; } = default!; - [Inject] protected ILocalStorageService LocalStorage { get; set; } = default!; diff --git a/Lantean.QBTMudBlade/Layout/OtherLayout.razor b/Lantean.QBTMud/Layout/OtherLayout.razor similarity index 100% rename from Lantean.QBTMudBlade/Layout/OtherLayout.razor rename to Lantean.QBTMud/Layout/OtherLayout.razor diff --git a/Lantean.QBTMudBlade/Layout/OtherLayout.razor.cs b/Lantean.QBTMud/Layout/OtherLayout.razor.cs similarity index 89% rename from Lantean.QBTMudBlade/Layout/OtherLayout.razor.cs rename to Lantean.QBTMud/Layout/OtherLayout.razor.cs index 3536d60..83bb819 100644 --- a/Lantean.QBTMudBlade/Layout/OtherLayout.razor.cs +++ b/Lantean.QBTMud/Layout/OtherLayout.razor.cs @@ -1,7 +1,7 @@ using Lantean.QBitTorrentClient.Models; using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Layout +namespace Lantean.QBTMud.Layout { public partial class OtherLayout { diff --git a/Lantean.QBTMudBlade/Models/AddTorrentFileOptions.cs b/Lantean.QBTMud/Models/AddTorrentFileOptions.cs similarity index 90% rename from Lantean.QBTMudBlade/Models/AddTorrentFileOptions.cs rename to Lantean.QBTMud/Models/AddTorrentFileOptions.cs index 6dec44b..abaa91d 100644 --- a/Lantean.QBTMudBlade/Models/AddTorrentFileOptions.cs +++ b/Lantean.QBTMud/Models/AddTorrentFileOptions.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Components.Forms; -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record AddTorrentFileOptions : TorrentOptions { diff --git a/Lantean.QBTMudBlade/Models/AddTorrentLinkOptions.cs b/Lantean.QBTMud/Models/AddTorrentLinkOptions.cs similarity index 89% rename from Lantean.QBTMudBlade/Models/AddTorrentLinkOptions.cs rename to Lantean.QBTMud/Models/AddTorrentLinkOptions.cs index 16174dc..5981810 100644 --- a/Lantean.QBTMudBlade/Models/AddTorrentLinkOptions.cs +++ b/Lantean.QBTMud/Models/AddTorrentLinkOptions.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record AddTorrentLinkOptions : TorrentOptions { diff --git a/Lantean.QBTMud/Models/AppliesTo.cs b/Lantean.QBTMud/Models/AppliesTo.cs new file mode 100644 index 0000000..daf0024 --- /dev/null +++ b/Lantean.QBTMud/Models/AppliesTo.cs @@ -0,0 +1,13 @@ +using System.ComponentModel; + +namespace Lantean.QBTMud.Models +{ + public enum AppliesTo + { + [Description("Filename + Extension")] + FilenameExtension, + + Filename, + Extension + } +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Models/Category.cs b/Lantean.QBTMud/Models/Category.cs similarity index 86% rename from Lantean.QBTMudBlade/Models/Category.cs rename to Lantean.QBTMud/Models/Category.cs index 98c5e88..3c06cfd 100644 --- a/Lantean.QBTMudBlade/Models/Category.cs +++ b/Lantean.QBTMud/Models/Category.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record Category { diff --git a/Lantean.QBTMudBlade/Models/ColumnDefinition.cs b/Lantean.QBTMud/Models/ColumnDefinition.cs similarity index 97% rename from Lantean.QBTMudBlade/Models/ColumnDefinition.cs rename to Lantean.QBTMud/Models/ColumnDefinition.cs index 057a432..c5b4165 100644 --- a/Lantean.QBTMudBlade/Models/ColumnDefinition.cs +++ b/Lantean.QBTMud/Models/ColumnDefinition.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class ColumnDefinition { diff --git a/Lantean.QBTMudBlade/Models/ContentItem.cs b/Lantean.QBTMud/Models/ContentItem.cs similarity index 92% rename from Lantean.QBTMudBlade/Models/ContentItem.cs rename to Lantean.QBTMud/Models/ContentItem.cs index 805d58d..8704b57 100644 --- a/Lantean.QBTMudBlade/Models/ContentItem.cs +++ b/Lantean.QBTMud/Models/ContentItem.cs @@ -1,6 +1,6 @@ using System.Diagnostics; -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { [DebuggerDisplay("{Name}")] public class ContentItem @@ -53,7 +53,11 @@ namespace Lantean.QBTMudBlade.Models public override bool Equals(object? obj) { - if (obj is null) return false; + if (obj is null) + { + return false; + } + return ((ContentItem)obj).Name == Name; } diff --git a/Lantean.QBTMudBlade/Models/ContentItemType.cs b/Lantean.QBTMud/Models/ContentItemType.cs similarity index 65% rename from Lantean.QBTMudBlade/Models/ContentItemType.cs rename to Lantean.QBTMud/Models/ContentItemType.cs index 95178e4..f958c0f 100644 --- a/Lantean.QBTMudBlade/Models/ContentItemType.cs +++ b/Lantean.QBTMud/Models/ContentItemType.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public enum ContentItemType { diff --git a/Lantean.QBTMud/Models/FileRow.cs b/Lantean.QBTMud/Models/FileRow.cs new file mode 100644 index 0000000..6e39ae7 --- /dev/null +++ b/Lantean.QBTMud/Models/FileRow.cs @@ -0,0 +1,29 @@ +namespace Lantean.QBTMud.Models +{ + public class FileRow + { + public required string OriginalName { get; set; } + public string? NewName { get; set; } + public bool IsFolder { get; set; } + public required string Name { get; set; } + public int Level { get; set; } + public bool Renamed { get; set; } + public string? ErrorMessage { get; set; } + public required string Path { get; set; } + + public override bool Equals(object? obj) + { + if (obj is null) + { + return false; + } + + return ((FileRow)obj).Name == Name; + } + + public override int GetHashCode() + { + return Name.GetHashCode(); + } + } +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Models/FilterState.cs b/Lantean.QBTMud/Models/FilterState.cs similarity index 94% rename from Lantean.QBTMudBlade/Models/FilterState.cs rename to Lantean.QBTMud/Models/FilterState.cs index 5d7c2f8..bc38cc5 100644 --- a/Lantean.QBTMudBlade/Models/FilterState.cs +++ b/Lantean.QBTMud/Models/FilterState.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public readonly struct FilterState { diff --git a/Lantean.QBTMudBlade/Models/GlobalTransferInfo.cs b/Lantean.QBTMud/Models/GlobalTransferInfo.cs similarity index 96% rename from Lantean.QBTMudBlade/Models/GlobalTransferInfo.cs rename to Lantean.QBTMud/Models/GlobalTransferInfo.cs index 4f014c5..041a4d5 100644 --- a/Lantean.QBTMudBlade/Models/GlobalTransferInfo.cs +++ b/Lantean.QBTMud/Models/GlobalTransferInfo.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record GlobalTransferInfo { diff --git a/Lantean.QBTMudBlade/Models/KeyboardEvent.cs b/Lantean.QBTMud/Models/KeyboardEvent.cs similarity index 98% rename from Lantean.QBTMudBlade/Models/KeyboardEvent.cs rename to Lantean.QBTMud/Models/KeyboardEvent.cs index 57ba123..32c71a3 100644 --- a/Lantean.QBTMudBlade/Models/KeyboardEvent.cs +++ b/Lantean.QBTMud/Models/KeyboardEvent.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class KeyboardEvent { @@ -96,4 +96,4 @@ namespace Lantean.QBTMudBlade.Models return input.ToString()!; } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Models/LogForm.cs b/Lantean.QBTMud/Models/LogForm.cs similarity index 94% rename from Lantean.QBTMudBlade/Models/LogForm.cs rename to Lantean.QBTMud/Models/LogForm.cs index 5ed786f..3091bc9 100644 --- a/Lantean.QBTMudBlade/Models/LogForm.cs +++ b/Lantean.QBTMud/Models/LogForm.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class LogForm { diff --git a/Lantean.QBTMudBlade/Models/LoginForm.cs b/Lantean.QBTMud/Models/LoginForm.cs similarity index 88% rename from Lantean.QBTMudBlade/Models/LoginForm.cs rename to Lantean.QBTMud/Models/LoginForm.cs index 6363e62..636a49e 100644 --- a/Lantean.QBTMudBlade/Models/LoginForm.cs +++ b/Lantean.QBTMud/Models/LoginForm.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class LoginForm { diff --git a/Lantean.QBTMudBlade/Models/MainData.cs b/Lantean.QBTMud/Models/MainData.cs similarity index 97% rename from Lantean.QBTMudBlade/Models/MainData.cs rename to Lantean.QBTMud/Models/MainData.cs index ca51f7e..444b1da 100644 --- a/Lantean.QBTMudBlade/Models/MainData.cs +++ b/Lantean.QBTMud/Models/MainData.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record MainData { diff --git a/Lantean.QBTMudBlade/Models/Peer.cs b/Lantean.QBTMud/Models/Peer.cs similarity index 94% rename from Lantean.QBTMudBlade/Models/Peer.cs rename to Lantean.QBTMud/Models/Peer.cs index 961cc0e..e9365db 100644 --- a/Lantean.QBTMudBlade/Models/Peer.cs +++ b/Lantean.QBTMud/Models/Peer.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class Peer { @@ -60,7 +60,11 @@ public override bool Equals(object? obj) { - if (obj is null) return false; + if (obj is null) + { + return false; + } + return ((Peer)obj).Key == Key; } diff --git a/Lantean.QBTMudBlade/Models/PeerList.cs b/Lantean.QBTMud/Models/PeerList.cs similarity index 83% rename from Lantean.QBTMudBlade/Models/PeerList.cs rename to Lantean.QBTMud/Models/PeerList.cs index c919844..76b2299 100644 --- a/Lantean.QBTMudBlade/Models/PeerList.cs +++ b/Lantean.QBTMud/Models/PeerList.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record PeerList { diff --git a/Lantean.QBTMudBlade/Models/Priority.cs b/Lantean.QBTMud/Models/Priority.cs similarity index 78% rename from Lantean.QBTMudBlade/Models/Priority.cs rename to Lantean.QBTMud/Models/Priority.cs index e4b7bfb..8cc4225 100644 --- a/Lantean.QBTMudBlade/Models/Priority.cs +++ b/Lantean.QBTMud/Models/Priority.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public enum Priority { diff --git a/Lantean.QBTMudBlade/Models/RowContext.cs b/Lantean.QBTMud/Models/RowContext.cs similarity index 92% rename from Lantean.QBTMudBlade/Models/RowContext.cs rename to Lantean.QBTMud/Models/RowContext.cs index 07ad6d1..d959be8 100644 --- a/Lantean.QBTMudBlade/Models/RowContext.cs +++ b/Lantean.QBTMud/Models/RowContext.cs @@ -1,6 +1,5 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { - public record RowContext { private readonly Func _valueGetter; diff --git a/Lantean.QBTMudBlade/Models/RssArticle.cs b/Lantean.QBTMud/Models/RssArticle.cs similarity index 96% rename from Lantean.QBTMudBlade/Models/RssArticle.cs rename to Lantean.QBTMud/Models/RssArticle.cs index fee1d91..10cf3d0 100644 --- a/Lantean.QBTMudBlade/Models/RssArticle.cs +++ b/Lantean.QBTMud/Models/RssArticle.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class RssArticle { diff --git a/Lantean.QBTMudBlade/Models/RssFeed.cs b/Lantean.QBTMud/Models/RssFeed.cs similarity index 90% rename from Lantean.QBTMudBlade/Models/RssFeed.cs rename to Lantean.QBTMud/Models/RssFeed.cs index 3baceff..5d57ebd 100644 --- a/Lantean.QBTMudBlade/Models/RssFeed.cs +++ b/Lantean.QBTMud/Models/RssFeed.cs @@ -1,6 +1,4 @@ -using System.Text.Json.Serialization; - -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class RssFeed { diff --git a/Lantean.QBTMudBlade/Models/RssList.cs b/Lantean.QBTMud/Models/RssList.cs similarity index 95% rename from Lantean.QBTMudBlade/Models/RssList.cs rename to Lantean.QBTMud/Models/RssList.cs index 7882dbb..fc5aee6 100644 --- a/Lantean.QBTMudBlade/Models/RssList.cs +++ b/Lantean.QBTMud/Models/RssList.cs @@ -1,5 +1,4 @@ - -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class RssList { @@ -39,4 +38,4 @@ namespace Lantean.QBTMudBlade.Models Feeds[selectedFeed].UnreadCount = 0; } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Models/SearchForm.cs b/Lantean.QBTMud/Models/SearchForm.cs similarity index 83% rename from Lantean.QBTMudBlade/Models/SearchForm.cs rename to Lantean.QBTMud/Models/SearchForm.cs index 7020008..21ab0bc 100644 --- a/Lantean.QBTMudBlade/Models/SearchForm.cs +++ b/Lantean.QBTMud/Models/SearchForm.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class SearchForm { @@ -8,4 +8,4 @@ public string SelectedCategory { get; set; } = "all"; } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Models/ServerState.cs b/Lantean.QBTMud/Models/ServerState.cs similarity index 98% rename from Lantean.QBTMudBlade/Models/ServerState.cs rename to Lantean.QBTMud/Models/ServerState.cs index 98ed5fc..ca6e827 100644 --- a/Lantean.QBTMudBlade/Models/ServerState.cs +++ b/Lantean.QBTMud/Models/ServerState.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record ServerState : GlobalTransferInfo { diff --git a/Lantean.QBTMudBlade/Models/ShareRatio.cs b/Lantean.QBTMud/Models/ShareRatio.cs similarity index 89% rename from Lantean.QBTMudBlade/Models/ShareRatio.cs rename to Lantean.QBTMud/Models/ShareRatio.cs index eb14ba4..a4b8baa 100644 --- a/Lantean.QBTMudBlade/Models/ShareRatio.cs +++ b/Lantean.QBTMud/Models/ShareRatio.cs @@ -1,11 +1,10 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record ShareRatio { public float RatioLimit { get; set; } public float SeedingTimeLimit { get; set; } public float InactiveSeedingTimeLimit { get; set; } - } public record ShareRatioMax : ShareRatio diff --git a/Lantean.QBTMudBlade/Models/Status.cs b/Lantean.QBTMud/Models/Status.cs similarity index 79% rename from Lantean.QBTMudBlade/Models/Status.cs rename to Lantean.QBTMud/Models/Status.cs index 568f2e9..55e66e4 100644 --- a/Lantean.QBTMudBlade/Models/Status.cs +++ b/Lantean.QBTMud/Models/Status.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public enum Status { @@ -14,6 +14,7 @@ StalledUploading, StalledDownloading, Checking, - Errored + Errored, + Stopped } } \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Models/Torrent.cs b/Lantean.QBTMud/Models/Torrent.cs similarity index 98% rename from Lantean.QBTMudBlade/Models/Torrent.cs rename to Lantean.QBTMud/Models/Torrent.cs index 1e66ceb..86dcdf8 100644 --- a/Lantean.QBTMudBlade/Models/Torrent.cs +++ b/Lantean.QBTMud/Models/Torrent.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public class Torrent { @@ -218,12 +218,16 @@ public long Reannounce { get; set; } public float InactiveSeedingTimeLimit { get; set; } - + public float MaxInactiveSeedingTime { get; set; } public override bool Equals(object? obj) { - if (obj is null) return false; + if (obj is null) + { + return false; + } + return ((Torrent)obj).Hash == Hash; } diff --git a/Lantean.QBTMudBlade/Models/TorrentOptions.cs b/Lantean.QBTMud/Models/TorrentOptions.cs similarity index 97% rename from Lantean.QBTMudBlade/Models/TorrentOptions.cs rename to Lantean.QBTMud/Models/TorrentOptions.cs index e51962e..aadbb56 100644 --- a/Lantean.QBTMudBlade/Models/TorrentOptions.cs +++ b/Lantean.QBTMud/Models/TorrentOptions.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record TorrentOptions { diff --git a/Lantean.QBTMudBlade/Models/UIAction.cs b/Lantean.QBTMud/Models/UIAction.cs similarity index 96% rename from Lantean.QBTMudBlade/Models/UIAction.cs rename to Lantean.QBTMud/Models/UIAction.cs index 0e75b44..1d3928b 100644 --- a/Lantean.QBTMudBlade/Models/UIAction.cs +++ b/Lantean.QBTMud/Models/UIAction.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Models +namespace Lantean.QBTMud.Models { public record UIAction { @@ -43,7 +43,7 @@ namespace Lantean.QBTMudBlade.Models public string Name { get; } - public string Text { get; } + public string Text { get; set; } public string? Icon { get; } diff --git a/Lantean.QBTMud/Pages/About.razor b/Lantean.QBTMud/Pages/About.razor new file mode 100644 index 0000000..02b30cd --- /dev/null +++ b/Lantean.QBTMud/Pages/About.razor @@ -0,0 +1,1100 @@ +@page "/about" +@layout OtherLayout + + + @if (!DrawerOpen) + { + + + } + About + + + + +
+ + + +
+ qBittorrent @QBittorrentVersion +
+
+ + + An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar. + + + + Copyright © 2006-2024 The qBittorrent project + + + + Home Page + + + https://www.qbittorrent.org + + + + Bug Tracker + + + https://bugs.qbittorrent.org + + + + Forum + + + https://forum.qbittorrent.org + +
+
+
+ + + Current maintainer + + + + Name + + + Sledgehammer999 + + + Nationality + + + Greece + + + E-mail + + + sledgehammer999@qbittorrent.org + + + + Original author + + + Name + + + Christophe Dumez + + + Nationality + + + France + + + E-mail + + + chris@qbittorrent.org + + + + + + + I would first like to thank sourceforge.net for hosting qBittorrent project and for their support. + I am pleased that people from all over the world are contributing to qBittorrent: Ishan Arora (India), Arnaud Demaizière (France) and Stephanos Antaris (Greece). Their help is greatly appreciated + I also want to thank Στέφανος Αντάρης (santaris@csd.auth.gr) and Mirco Chinelli (infinity89@fastwebmail.it) for working on Mac OS X packaging. + I am grateful to Peter Koeleman (peter@qbittorrent.org) and Mohammad Dib (mdib@qbittorrent.org) for working on qBittorrent port to Windows. + Thanks a lot to our graphist Mateusz Toboła (tobejodok@qbittorrent.org) for his great work. + Thanks to all contributors on GitHub. + + + + + + I would like to thank the people who volunteered to Circle qBittorrent.
+ Most of them Circled via Transifex and some of them are mentioned below:
+ (the list might not be up to date) +
+ + Arabic: SDERAWI (abz8868@msn.com), sn51234 (nesseyan@gmail.com) and Ibrahim Saed ibraheem_alex(Transifex) + Armenian: Hrant Ohanyan (hrantohanyan@mail.am) + Basque: Xabier Aramendi (azpidatziak@gmail.com) + Belarusian: Mihas Varantsou (meequz@gmail.com) + Bulgarian: Tsvetan & Boyko Bankoff (emerge_life@users.sourceforge.net) + Catalan: Francisco Luque Contreras (frannoe@ya.com) + Chinese (Simplified): Guo Yue (yue.guo0418@gmail.com) + Chinese (Traditional): Yi-Shun Wang (dnextstep@gmail.com) and 冥王歐西里斯 s8321414(Transifex) + Croatian: Oliver Mucafir (oliver.untwist@gmail.com) + Czech: Jirka Vilim (web@tets.cz) and Petr Cernobila abr(Transifex) + Danish: Mathias Nielsen (comoneo@gmail.com), scootergrisen, Nicolaj (fuskern@gmail.com) and Joe Hansen (joedalton2@yahoo.dk) + Dutch: Pieter Heyvaert (pieter_heyvaert@hotmail.com) + English(Australia): Robert Readman readmanr(Transifex) + English(United Kingdom): Robert Readman readmanr(Transifex) + Finnish: Niklas Laxström (nikerabbit@users.sourceforge.net), Pekka Niemi (pekka.niemi@iki.fi) and Jiri Grönroos artnay(Transifex) + Galician: Marcos Lans (marcoslansgarza@gmail.com) and antiparvos(Transifex) + Georgian: Beqa Arabuli (arabulibeqa@yahoo.com) + German: Niels Hoffmann (zentralmaschine@users.sourceforge.net), schnurlos (schnurlos@gmail.com) + Greek: Tsvetan Bankov (emerge_life@users.sourceforge.net), Stephanos Antaris (santaris@csd.auth.gr), sledgehammer999(hammered999@gmail.com), Γιάννης Ανθυμίδης Evropi(Transifex) and Panagiotis Tabakis(tabakisp@gmail.com) + Hebrew: David Deutsch (d.deffo@gmail.com) + Hungarian: Majoros Péter + Italian: bovirus (bovirus@live.it) and Matteo Sechi (bu17714@gmail.com) + Japanese: Masato Hashimoto (cabezon.hashimoto@gmail.com) + Korean: Jin Woo Sin (jin828sin@users.sourceforge.net) + Lithuanian: Naglis Jonaitis (njonaitis@gmail.com) + Norwegian: Tomaso + Polish: Mariusz Fik (fisiu@opensuse.org) + Portuguese: Sérgio Marques smarquespt(Transifex) and L.Sousa(Transifex) + Portuguese(Brazil): Nick Marinho (nickmarinho@gmail.com) + Romanian: Obada Denis (obadadenis@users.sourceforge.net), Adrian Gabor Adriannho(Transifex) and Mihai Coman z0id(Transifex) + Russian: Nick Khazov (m2k3d0n at users.sourceforge.net), Alexey Morsov (samurai@ricom.ru), Nick Tiskov Dayman(daymansmail (at) gmail (dot) com), Dmitry DmitryKX(Transifex) and kraleksandr kraleksandr(Transifex) + Serbian: Anaximandar Milet (anaximandar@operamail.com) + Slovak: helix84 + Spanish: Alfredo Monclús (alfrix), Francisco Luque Contreras (frannoe@ya.com), José Antonio Moray moray33(Transifex) and Diego de las Heras(Transifex) + Swedish: Daniel Nylander (po@danielnylander.se) and Emil Hammarberg Ooglogput(Transifex) + Turkish: Hasan YILMAZ (iletisim@hedefturkce.com), Erdem Bingöl (erdem84@gmail.com) and Burak Yavuz (BouRock) + Ukrainian: Oleh Prypin (blaxpirit@gmail.com) + Vietnamese: Anh Phan ppanhh(Transifex) + + Please contact me if you would like to Circle qBittorrent into your own language. +
+
+ + + + The qBittorrent source code is licensed under the GNU General Public License, version 2 or (at your option) any later version (GPLv2+). + However, this binary distribution is licensed under GNU General Public License, version 3 or (at your option) any later version (GPLv3+), + because it contains GPLv3+ assets (eg images). In both cases, the following special exception is added: + + + In addition, as a special exception, the copyright holders give permission to + link this program with the OpenSSL project's "OpenSSL" library (or with + modified versions of it that use the same license as the "OpenSSL" library), + and distribute the linked executables. You must obey the GNU General Public + License in all respects for all of the code used other than "OpenSSL". If you + modify file(s), you may extend this exception to your version of the file(s), + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + + + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + + Copyright © 2007 Free Software Foundation, Inc. + <https://fsf.org/> + + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + Preamble + + + The GNU General Public License is a free, copyleft license for + software and other kinds of works. + + + + The licenses for most software and other practical works are designed + to take away your freedom to share and change the works. By contrast, + the GNU General Public License is intended to guarantee your freedom to + share and change all versions of a program--to make sure it remains free + software for all its users. We, the Free Software Foundation, use the + GNU General Public License for most of our software; it applies also to + any other work released this way by its authors. You can apply it to + your programs, too. + + + + When we speak of free software, we are referring to freedom, not + price. Our General Public Licenses are designed to make sure that you + have the freedom to distribute copies of free software (and charge for + them if you wish), that you receive source code or can get it if you + want it, that you can change the software or use pieces of it in new + free programs, and that you know you can do these things. + + + + To protect your rights, we need to prevent others from denying you + these rights or asking you to surrender the rights. Therefore, you have + certain responsibilities if you distribute copies of the software, or if + you modify it: responsibilities to respect the freedom of others. + + + + For example, if you distribute copies of such a program, whether + gratis or for a fee, you must pass on to the recipients the same + freedoms that you received. You must make sure that they, too, receive + or can get the source code. And you must show them these terms so they + know their rights. + + + + Developers that use the GNU GPL protect your rights with two steps: + (1) assert copyright on the software, and (2) offer you this License + giving you legal permission to copy, distribute and/or modify it. + + + + For the developers' and authors' protection, the GPL clearly explains + that there is no warranty for this free software. For both users' and + authors' sake, the GPL requires that modified versions be marked as + changed, so that their problems will not be attributed erroneously to + authors of previous versions. + + + + Some devices are designed to deny users access to install or run + modified versions of the software inside them, although the manufacturer + can do so. This is fundamentally incompatible with the aim of + protecting users' freedom to change the software. The systematic + pattern of such abuse occurs in the area of products for individuals to + use, which is precisely where it is most unacceptable. Therefore, we + have designed this version of the GPL to prohibit the practice for those + products. If such problems arise substantially in other domains, we + stand ready to extend this provision to those domains in future versions + of the GPL, as needed to protect the freedom of users. + + + + Finally, every program is threatened constantly by software patents. + States should not allow patents to restrict development and use of + software on general-purpose computers, but in those that do, we wish to + avoid the special danger that patents applied to a free program could + make it effectively proprietary. To prevent this, the GPL assures that + patents cannot be used to render the program non-free. + + + + The precise terms and conditions for copying, distribution and + modification follow. + + + TERMS AND CONDITIONS + + 0. Definitions. + + “This License” refers to version 3 of the GNU General Public License. + + + “Copyright” also means copyright-like laws that apply to other kinds of + works, such as semiconductor masks. + + + + “The Program” refers to any copyrightable work licensed under this + License. Each licensee is addressed as “you”. “Licensees” and + “recipients” may be individuals or organizations. + + + + To “modify” a work means to copy from or adapt all or part of the work + in a fashion requiring copyright permission, other than the making of an + exact copy. The resulting work is called a “modified version” of the + earlier work or a work “based on” the earlier work. + + + + A “covered work” means either the unmodified Program or a work based + on the Program. + + + + To “propagate” a work means to do anything with it that, without + permission, would make you directly or secondarily liable for + infringement under applicable copyright law, except executing it on a + computer or modifying a private copy. Propagation includes copying, + distribution (with or without modification), making available to the + public, and in some countries other activities as well. + + + + To “convey” a work means any kind of propagation that enables other + parties to make or receive copies. Mere interaction with a user through + a computer network, with no transfer of a copy, is not conveying. + + + + An interactive user interface displays “Appropriate Legal Notices” + to the extent that it includes a convenient and prominently visible + feature that (1) displays an appropriate copyright notice, and (2) + tells the user that there is no warranty for the work (except to the + extent that warranties are provided), that licensees may convey the + work under this License, and how to view a copy of this License. If + the interface presents a list of user commands or options, such as a + menu, a prominent item in the list meets this criterion. + + + 1. Source Code. + + + The “source code” for a work means the preferred form of the work + for making modifications to it. “Object code” means any non-source + form of a work. + + + + A “Standard Interface” means an interface that either is an official + standard defined by a recognized standards body, or, in the case of + interfaces specified for a particular programming language, one that + is widely used among developers working in that language. + + + + The “System Libraries” of an executable work include anything, other + than the work as a whole, that (a) is included in the normal form of + packaging a Major Component, but which is not part of that Major + Component, and (b) serves only to enable use of the work with that + Major Component, or to implement a Standard Interface for which an + implementation is available to the public in source code form. A + “Major Component”, in this context, means a major essential component + (kernel, window system, and so on) of the specific operating system + (if any) on which the executable work runs, or a compiler used to + produce the work, or an object code interpreter used to run it. + + + + The “Corresponding Source” for a work in object code form means all + the source code needed to generate, install, and (for an executable + work) run the object code and to modify the work, including scripts to + control those activities. However, it does not include the work's + System Libraries, or general-purpose tools or generally available free + programs which are used unmodified in performing those activities but + which are not part of the work. For example, Corresponding Source + includes interface definition files associated with source files for + the work, and the source code for shared libraries and dynamically + linked subprograms that the work is specifically designed to require, + such as by intimate data communication or control flow between those + subprograms and other parts of the work. + + + + The Corresponding Source need not include anything that users + can regenerate automatically from other parts of the Corresponding + Source. + + + + The Corresponding Source for a work in source code form is that + same work. + + + 2. Basic Permissions. + + + All rights granted under this License are granted for the term of + copyright on the Program, and are irrevocable provided the stated + conditions are met. This License explicitly affirms your unlimited + permission to run the unmodified Program. The output from running a + covered work is covered by this License only if the output, given its + content, constitutes a covered work. This License acknowledges your + rights of fair use or other equivalent, as provided by copyright law. + + + + You may make, run and propagate covered works that you do not + convey, without conditions so long as your license otherwise remains + in force. You may convey covered works to others for the sole purpose + of having them make modifications exclusively for you, or provide you + with facilities for running those works, provided that you comply with + the terms of this License in conveying all material for which you do + not control copyright. Those thus making or running the covered works + for you must do so exclusively on your behalf, under your direction + and control, on terms that prohibit them from making any copies of + your copyrighted material outside their relationship with you. + + + + Conveying under any other circumstances is permitted solely under + the conditions stated below. Sublicensing is not allowed; section 10 + makes it unnecessary. + + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + + No covered work shall be deemed part of an effective technological + measure under any applicable law fulfilling obligations under article + 11 of the WIPO copyright treaty adopted on 20 December 1996, or + similar laws prohibiting or restricting circumvention of such + measures. + + + + When you convey a covered work, you waive any legal power to forbid + circumvention of technological measures to the extent such circumvention + is effected by exercising rights under this License with respect to + the covered work, and you disclaim any intention to limit operation or + modification of the work as a means of enforcing, against the work's + users, your or third parties' legal rights to forbid circumvention of + technological measures. + + + 4. Conveying Verbatim Copies. + + + You may convey verbatim copies of the Program's source code as you + receive it, in any medium, provided that you conspicuously and + appropriately publish on each copy an appropriate copyright notice; + keep intact all notices stating that this License and any + non-permissive terms added in accord with section 7 apply to the code; + keep intact all notices of the absence of any warranty; and give all + recipients a copy of this License along with the Program. + + + + You may charge any price or no price for each copy that you convey, + and you may offer support or warranty protection for a fee. + + + 5. Conveying Modified Source Versions. + + + You may convey a work based on the Program, or the modifications to + produce it from the Program, in the form of source code under the + terms of section 4, provided that you also meet all of these conditions: + + + + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + “keep intact all notices”. + + + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + + + + A compilation of a covered work with other separate and independent + works, which are not by their nature extensions of the covered work, + and which are not combined with it such as to form a larger program, + in or on a volume of a storage or distribution medium, is called an + “aggregate” if the compilation and its resulting copyright are not + used to limit the access or legal rights of the compilation's users + beyond what the individual works permit. Inclusion of a covered work + in an aggregate does not cause this License to apply to the other + parts of the aggregate. + + + 6. Conveying Non-Source Forms. + + + You may convey a covered work in object code form under the terms + of sections 4 and 5, provided that you also convey the + machine-readable Corresponding Source under the terms of this License, + in one of these ways: + + + + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + + + + A separable portion of the object code, whose source code is excluded + from the Corresponding Source as a System Library, need not be + included in conveying the object code work. + + + + A “User Product” is either (1) a “consumer product”, which means any + tangible personal property which is normally used for personal, family, + or household purposes, or (2) anything designed or sold for incorporation + into a dwelling. In determining whether a product is a consumer product, + doubtful cases shall be resolved in favor of coverage. For a particular + product received by a particular user, “normally used” refers to a + typical or common use of that class of product, regardless of the status + of the particular user or of the way in which the particular user + actually uses, or expects or is expected to use, the product. A product + is a consumer product regardless of whether the product has substantial + commercial, industrial or non-consumer uses, unless such uses represent + the only significant mode of use of the product. + + + + “Installation Information” for a User Product means any methods, + procedures, authorization keys, or other information required to install + and execute modified versions of a covered work in that User Product from + a modified version of its Corresponding Source. The information must + suffice to ensure that the continued functioning of the modified object + code is in no case prevented or interfered with solely because + modification has been made. + + + + If you convey an object code work under this section in, or with, or + specifically for use in, a User Product, and the conveying occurs as + part of a transaction in which the right of possession and use of the + User Product is transferred to the recipient in perpetuity or for a + fixed term (regardless of how the transaction is characterized), the + Corresponding Source conveyed under this section must be accompanied + by the Installation Information. But this requirement does not apply + if neither you nor any third party retains the ability to install + modified object code on the User Product (for example, the work has + been installed in ROM). + + + + The requirement to provide Installation Information does not include a + requirement to continue to provide support service, warranty, or updates + for a work that has been modified or installed by the recipient, or for + the User Product in which it has been modified or installed. Access to a + network may be denied when the modification itself materially and + adversely affects the operation of the network or violates the rules and + protocols for communication across the network. + + + + Corresponding Source conveyed, and Installation Information provided, + in accord with this section must be in a format that is publicly + documented (and with an implementation available to the public in + source code form), and must require no special password or key for + unpacking, reading or copying. + + + 7. Additional Terms. + + + “Additional permissions” are terms that supplement the terms of this + License by making exceptions from one or more of its conditions. + Additional permissions that are applicable to the entire Program shall + be treated as though they were included in this License, to the extent + that they are valid under applicable law. If additional permissions + apply only to part of the Program, that part may be used separately + under those permissions, but the entire Program remains governed by + this License without regard to the additional permissions. + + + + When you convey a copy of a covered work, you may at your option + remove any additional permissions from that copy, or from any part of + it. (Additional permissions may be written to require their own + removal in certain cases when you modify the work.) You may place + additional permissions on material, added by you to a covered work, + for which you have or can give appropriate copyright permission. + + + + Notwithstanding any other provision of this License, for material you + add to a covered work, you may (if authorized by the copyright holders of + that material) supplement the terms of this License with terms: + + + + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + + + + All other non-permissive additional terms are considered “further + restrictions” within the meaning of section 10. If the Program as you + received it, or any part of it, contains a notice stating that it is + governed by this License along with a term that is a further + restriction, you may remove that term. If a license document contains + a further restriction but permits relicensing or conveying under this + License, you may add to a covered work material governed by the terms + of that license document, provided that the further restriction does + not survive such relicensing or conveying. + + + + If you add terms to a covered work in accord with this section, you + must place, in the relevant source files, a statement of the + additional terms that apply to those files, or a notice indicating + where to find the applicable terms. + + + + Additional terms, permissive or non-permissive, may be stated in the + form of a separately written license, or stated as exceptions; + the above requirements apply either way. + + + 8. Termination. + + + You may not propagate or modify a covered work except as expressly + provided under this License. Any attempt otherwise to propagate or + modify it is void, and will automatically terminate your rights under + this License (including any patent licenses granted under the third + paragraph of section 11). + + + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the copyright + holder fails to notify you of the violation by some reasonable means + prior to 60 days after the cessation. + + + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from that + copyright holder, and you cure the violation prior to 30 days after + your receipt of the notice. + + + + Termination of your rights under this section does not terminate the + licenses of parties who have received copies or rights from you under + this License. If your rights have been terminated and not permanently + reinstated, you do not qualify to receive new licenses for the same + material under section 10. + + + 9. Acceptance Not Required for Having Copies. + + + You are not required to accept this License in order to receive or + run a copy of the Program. Ancillary propagation of a covered work + occurring solely as a consequence of using peer-to-peer transmission + to receive a copy likewise does not require acceptance. However, + nothing other than this License grants you permission to propagate or + modify any covered work. These actions infringe copyright if you do + not accept this License. Therefore, by modifying or propagating a + covered work, you indicate your acceptance of this License to do so. + + + 10. Automatic Licensing of Downstream Recipients. + + + Each time you convey a covered work, the recipient automatically + receives a license from the original licensors, to run, modify and + propagate that work, subject to this License. You are not responsible + for enforcing compliance by third parties with this License. + + + + An “entity transaction” is a transaction transferring control of an + organization, or substantially all assets of one, or subdividing an + organization, or merging organizations. If propagation of a covered + work results from an entity transaction, each party to that + transaction who receives a copy of the work also receives whatever + licenses to the work the party's predecessor in interest had or could + give under the previous paragraph, plus a right to possession of the + Corresponding Source of the work from the predecessor in interest, if + the predecessor has it or can get it with reasonable efforts. + + + + You may not impose any further restrictions on the exercise of the + rights granted or affirmed under this License. For example, you may + not impose a license fee, royalty, or other charge for exercise of + rights granted under this License, and you may not initiate litigation + (including a cross-claim or counterclaim in a lawsuit) alleging that + any patent claim is infringed by making, using, selling, offering for + sale, or importing the Program or any portion of it. + + + 11. Patents. + + + A “contributor” is a copyright holder who authorizes use under this + License of the Program or a work on which the Program is based. The + work thus licensed is called the contributor's “contributor version”. + + + + A contributor's “essential patent claims” are all patent claims + owned or controlled by the contributor, whether already acquired or + hereafter acquired, that would be infringed by some manner, permitted + by this License, of making, using, or selling its contributor version, + but do not include claims that would be infringed only as a + consequence of further modification of the contributor version. For + purposes of this definition, “control” includes the right to grant + patent sublicenses in a manner consistent with the requirements of + this License. + + + + Each contributor grants you a non-exclusive, worldwide, royalty-free + patent license under the contributor's essential patent claims, to + make, use, sell, offer for sale, import and otherwise run, modify and + propagate the contents of its contributor version. + + + + In the following three paragraphs, a “patent license” is any express + agreement or commitment, however denominated, not to enforce a patent + (such as an express permission to practice a patent or covenant not to + sue for patent infringement). To “grant” such a patent license to a + party means to make such an agreement or commitment not to enforce a + patent against the party. + + + + If you convey a covered work, knowingly relying on a patent license, + and the Corresponding Source of the work is not available for anyone + to copy, free of charge and under the terms of this License, through a + publicly available network server or other readily accessible means, + then you must either (1) cause the Corresponding Source to be so + available, or (2) arrange to deprive yourself of the benefit of the + patent license for this particular work, or (3) arrange, in a manner + consistent with the requirements of this License, to extend the patent + license to downstream recipients. “Knowingly relying” means you have + actual knowledge that, but for the patent license, your conveying the + covered work in a country, or your recipient's use of the covered work + in a country, would infringe one or more identifiable patents in that + country that you have reason to believe are valid. + + + + If, pursuant to or in connection with a single transaction or + arrangement, you convey, or propagate by procuring conveyance of, a + covered work, and grant a patent license to some of the parties + receiving the covered work authorizing them to use, propagate, modify + or convey a specific copy of the covered work, then the patent license + you grant is automatically extended to all recipients of the covered + work and works based on it. + + + + A patent license is “discriminatory” if it does not include within + the scope of its coverage, prohibits the exercise of, or is + conditioned on the non-exercise of one or more of the rights that are + specifically granted under this License. You may not convey a covered + work if you are a party to an arrangement with a third party that is + in the business of distributing software, under which you make payment + to the third party based on the extent of your activity of conveying + the work, and under which the third party grants, to any of the + parties who would receive the covered work from you, a discriminatory + patent license (a) in connection with copies of the covered work + conveyed by you (or copies made from those copies), or (b) primarily + for and in connection with specific products or compilations that + contain the covered work, unless you entered into that arrangement, + or that patent license was granted, prior to 28 March 2007. + + + + Nothing in this License shall be construed as excluding or limiting + any implied license or other defenses to infringement that may + otherwise be available to you under applicable patent law. + + + 12. No Surrender of Others' Freedom. + + + If conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot convey a + covered work so as to satisfy simultaneously your obligations under this + License and any other pertinent obligations, then as a consequence you may + not convey it at all. For example, if you agree to terms that obligate you + to collect a royalty for further conveying from those to whom you convey + the Program, the only way you could satisfy both those terms and this + License would be to refrain entirely from conveying the Program. + + + 13. Use with the GNU Affero General Public License. + + + Notwithstanding any other provision of this License, you have + permission to link or combine any covered work with a work licensed + under version 3 of the GNU Affero General Public License into a single + combined work, and to convey the resulting work. The terms of this + License will continue to apply to the part which is the covered work, + but the special requirements of the GNU Affero General Public License, + section 13, concerning interaction through a network will apply to the + combination as such. + + + 14. Revised Versions of this License. + + + The Free Software Foundation may publish revised and/or new versions of + the GNU General Public License from time to time. Such new versions will + be similar in spirit to the present version, but may differ in detail to + address new problems or concerns. + + + + Each version is given a distinguishing version number. If the + Program specifies that a certain numbered version of the GNU General + Public License “or any later version” applies to it, you have the + option of following the terms and conditions either of that numbered + version or of any later version published by the Free Software + Foundation. If the Program does not specify a version number of the + GNU General Public License, you may choose any version ever published + by the Free Software Foundation. + + + + If the Program specifies that a proxy can decide which future + versions of the GNU General Public License can be used, that proxy's + public statement of acceptance of a version permanently authorizes you + to choose that version for the Program. + + + + Later license versions may give you additional or different + permissions. However, no additional obligations are imposed on any + author or copyright holder as a result of your choosing to follow a + later version. + + + 15. Disclaimer of Warranty. + + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY + APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT + HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY + OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM + IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF + ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + + 16. Limitation of Liability. + + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING + WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS + THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY + GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE + USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF + DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), + EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF + SUCH DAMAGES. + + + 17. Interpretation of Sections 15 and 16. + + + If the disclaimer of warranty and limitation of liability provided + above cannot be given local legal effect according to their terms, + reviewing courts shall apply local law that most closely approximates + an absolute waiver of all civil liability in connection with the + Program, unless a warranty or assumption of liability accompanies a + copy of the Program in return for a fee. + + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + + If you develop a new program, and you want it to be of the greatest + possible use to the public, the best way to achieve this is to make it + free software which everyone can redistribute and change under these terms. + + + + To do so, attach the following notices to the program. It is safest + to attach them to the start of each source file to most effectively + state the exclusion of warranty; and each file should have at least + the “copyright” line and a pointer to where the full notice is found. + + +
+                <one line to give the program's name and a brief idea of what it does.>
+                Copyright (C) <year>  <name of author>
+
+                This program is free software: you can redistribute it and/or modify
+                it under the terms of the GNU General Public License as published by
+                the Free Software Foundation, either version 3 of the License, or
+                (at your option) any later version.
+
+                This program is distributed in the hope that it will be useful,
+                but WITHOUT ANY WARRANTY; without even the implied warranty of
+                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+                GNU General Public License for more details.
+
+                You should have received a copy of the GNU General Public License
+                along with this program.  If not, see <https://www.gnu.org/licenses/>.
+            
+ + Also add information on how to contact you by electronic and paper mail. + + + If the program does terminal interaction, make it output a short + notice like this when it starts in an interactive mode: + + +
+                <program>  Copyright (C) <year>  <name of author>
+                This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+                This is free software, and you are welcome to redistribute it
+                under certain conditions; type `show c' for details.
+            
+ + + The hypothetical commands `show w' and `show c' should show the appropriate + parts of the General Public License. Of course, your program's commands + might be different; for a GUI interface, you would use an “about box”. + + + + You should also get your employer (if you work as a programmer) or school, + if any, to sign a “copyright disclaimer” for the program, if necessary. + For more information on this, and how to apply and follow the GNU GPL, see + <https://www.gnu.org/licenses/>. + + + + The GNU General Public License does not permit incorporating your program + into proprietary programs. If your program is a subroutine library, you + may consider it more useful to permit linking proprietary applications with + the library. If this is what you want to do, use the GNU Lesser General + Public License instead of this License. But first, please read + <https://www.gnu.org/licenses/why-not-lgpl.html>. + +
+
+ + + qBittorrent was built with the following libraries: + + + + Qt + + + @QtVersion + + + + Libtorrent + + + @LibtorrentVersion + + + + Boost + + + @BoostVersion + + + + OpenSSL + + + @OpensslVersion + + + + zlib + + + @ZlibVersion + + + + The free IP to Country Lite database by DB-IP is used for resolving the countries of peers. The database is licensed under the Creative Commons Attribution 4.0 International License (https://db-ip.com/) + + +
\ No newline at end of file diff --git a/Lantean.QBTMudBlade/Pages/About.razor.cs b/Lantean.QBTMud/Pages/About.razor.cs similarity index 93% rename from Lantean.QBTMudBlade/Pages/About.razor.cs rename to Lantean.QBTMud/Pages/About.razor.cs index dfd5dd9..78d8b2c 100644 --- a/Lantean.QBTMudBlade/Pages/About.razor.cs +++ b/Lantean.QBTMud/Pages/About.razor.cs @@ -1,7 +1,7 @@ using Lantean.QBitTorrentClient; using Microsoft.AspNetCore.Components; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class About { @@ -47,7 +47,7 @@ namespace Lantean.QBTMudBlade.Pages BoostVersion = info.BoostVersion; OpensslVersion = info.OpenSSLVersion; ZlibVersion = info.ZLibVersion; - QBittorrentVersion = $"{Version} ({info.Bitness}-bit)"; + QBittorrentVersion = $"{Version} ({info.Bitness}-bit)"; } } } \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Pages/Blocks.razor b/Lantean.QBTMud/Pages/Blocks.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/Blocks.razor rename to Lantean.QBTMud/Pages/Blocks.razor diff --git a/Lantean.QBTMudBlade/Pages/Blocks.razor.cs b/Lantean.QBTMud/Pages/Blocks.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Pages/Blocks.razor.cs rename to Lantean.QBTMud/Pages/Blocks.razor.cs index 9bbe3a8..5d265fe 100644 --- a/Lantean.QBTMudBlade/Pages/Blocks.razor.cs +++ b/Lantean.QBTMud/Pages/Blocks.razor.cs @@ -1,15 +1,15 @@ using Blazored.LocalStorage; using Lantean.QBitTorrentClient; using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using MudBlazor; using System.Net; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class Blocks : IAsyncDisposable { diff --git a/Lantean.QBTMudBlade/Pages/CategoryManagement.razor b/Lantean.QBTMud/Pages/CategoryManagement.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/CategoryManagement.razor rename to Lantean.QBTMud/Pages/CategoryManagement.razor diff --git a/Lantean.QBTMudBlade/Pages/CategoryManagement.razor.cs b/Lantean.QBTMud/Pages/CategoryManagement.razor.cs similarity index 94% rename from Lantean.QBTMudBlade/Pages/CategoryManagement.razor.cs rename to Lantean.QBTMud/Pages/CategoryManagement.razor.cs index 80b49bc..cf75e2c 100644 --- a/Lantean.QBTMudBlade/Pages/CategoryManagement.razor.cs +++ b/Lantean.QBTMud/Pages/CategoryManagement.razor.cs @@ -1,12 +1,12 @@ using Blazored.LocalStorage; using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class CategoryManagement { diff --git a/Lantean.QBTMudBlade/Pages/Details.razor b/Lantean.QBTMud/Pages/Details.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/Details.razor rename to Lantean.QBTMud/Pages/Details.razor diff --git a/Lantean.QBTMudBlade/Pages/Details.razor.cs b/Lantean.QBTMud/Pages/Details.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Pages/Details.razor.cs rename to Lantean.QBTMud/Pages/Details.razor.cs index 54ee42c..2b8ffec 100644 --- a/Lantean.QBTMudBlade/Pages/Details.razor.cs +++ b/Lantean.QBTMud/Pages/Details.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class Details { diff --git a/Lantean.QBTMudBlade/Pages/Log.razor b/Lantean.QBTMud/Pages/Log.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/Log.razor rename to Lantean.QBTMud/Pages/Log.razor diff --git a/Lantean.QBTMudBlade/Pages/Log.razor.cs b/Lantean.QBTMud/Pages/Log.razor.cs similarity index 96% rename from Lantean.QBTMudBlade/Pages/Log.razor.cs rename to Lantean.QBTMud/Pages/Log.razor.cs index 524529f..5710c6d 100644 --- a/Lantean.QBTMudBlade/Pages/Log.razor.cs +++ b/Lantean.QBTMud/Pages/Log.razor.cs @@ -1,15 +1,14 @@ using Blazored.LocalStorage; using Lantean.QBitTorrentClient; -using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using MudBlazor; using System.Net; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class Log : IAsyncDisposable { diff --git a/Lantean.QBTMudBlade/Pages/Login.razor b/Lantean.QBTMud/Pages/Login.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/Login.razor rename to Lantean.QBTMud/Pages/Login.razor diff --git a/Lantean.QBTMudBlade/Pages/Login.razor.cs b/Lantean.QBTMud/Pages/Login.razor.cs similarity index 92% rename from Lantean.QBTMudBlade/Pages/Login.razor.cs rename to Lantean.QBTMud/Pages/Login.razor.cs index 9c43bc7..f238708 100644 --- a/Lantean.QBTMudBlade/Pages/Login.razor.cs +++ b/Lantean.QBTMud/Pages/Login.razor.cs @@ -1,10 +1,10 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using System.Net; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class Login { @@ -46,10 +46,12 @@ namespace Lantean.QBTMudBlade.Pages } #if DEBUG + protected override Task OnInitializedAsync() { - return DoLogin("admin", "ArmPp5MvH"); + return DoLogin("admin", "AQnwFmBzV"); } + #endif } } \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Pages/Options.razor b/Lantean.QBTMud/Pages/Options.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/Options.razor rename to Lantean.QBTMud/Pages/Options.razor diff --git a/Lantean.QBTMudBlade/Pages/Options.razor.cs b/Lantean.QBTMud/Pages/Options.razor.cs similarity index 96% rename from Lantean.QBTMudBlade/Pages/Options.razor.cs rename to Lantean.QBTMud/Pages/Options.razor.cs index 5a1b93e..2f8f50d 100644 --- a/Lantean.QBTMudBlade/Pages/Options.razor.cs +++ b/Lantean.QBTMud/Pages/Options.razor.cs @@ -1,13 +1,13 @@ using Lantean.QBitTorrentClient; using Lantean.QBitTorrentClient.Models; -using Lantean.QBTMudBlade.Components.Options; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Components.Options; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Routing; using MudBlazor; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class Options { diff --git a/Lantean.QBTMudBlade/Pages/Rss.razor b/Lantean.QBTMud/Pages/Rss.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/Rss.razor rename to Lantean.QBTMud/Pages/Rss.razor diff --git a/Lantean.QBTMudBlade/Pages/Rss.razor.cs b/Lantean.QBTMud/Pages/Rss.razor.cs similarity index 95% rename from Lantean.QBTMudBlade/Pages/Rss.razor.cs rename to Lantean.QBTMud/Pages/Rss.razor.cs index 0b65916..40130c2 100644 --- a/Lantean.QBTMudBlade/Pages/Rss.razor.cs +++ b/Lantean.QBTMud/Pages/Rss.razor.cs @@ -1,16 +1,11 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; using MudBlazor; -using System.Net; -using System; -using System.Collections.ObjectModel; -using static MudBlazor.CategoryTypes; -using Lantean.QBTMudBlade.Components.Dialogs; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class Rss : IAsyncDisposable { @@ -49,7 +44,7 @@ namespace Lantean.QBTMudBlade.Pages protected string? SelectedFeed { get; set; } protected string? SelectedArticle { get; set; } - + protected RssList? RssList { get; set; } protected Dictionary Feeds => RssList?.Feeds ?? []; diff --git a/Lantean.QBTMudBlade/Pages/Search.razor b/Lantean.QBTMud/Pages/Search.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/Search.razor rename to Lantean.QBTMud/Pages/Search.razor diff --git a/Lantean.QBTMudBlade/Pages/Search.razor.cs b/Lantean.QBTMud/Pages/Search.razor.cs similarity index 97% rename from Lantean.QBTMudBlade/Pages/Search.razor.cs rename to Lantean.QBTMud/Pages/Search.razor.cs index e45a682..bdba7f6 100644 --- a/Lantean.QBTMudBlade/Pages/Search.razor.cs +++ b/Lantean.QBTMud/Pages/Search.razor.cs @@ -1,12 +1,12 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using MudBlazor; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class Search : IDisposable { diff --git a/Lantean.QBTMudBlade/Pages/Statistics.razor b/Lantean.QBTMud/Pages/Statistics.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/Statistics.razor rename to Lantean.QBTMud/Pages/Statistics.razor diff --git a/Lantean.QBTMudBlade/Pages/Statistics.razor.cs b/Lantean.QBTMud/Pages/Statistics.razor.cs similarity index 93% rename from Lantean.QBTMudBlade/Pages/Statistics.razor.cs rename to Lantean.QBTMud/Pages/Statistics.razor.cs index a0f6037..f7ff17d 100644 --- a/Lantean.QBTMudBlade/Pages/Statistics.razor.cs +++ b/Lantean.QBTMud/Pages/Statistics.razor.cs @@ -1,9 +1,9 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class Statistics { diff --git a/Lantean.QBTMudBlade/Pages/TagManagement.razor b/Lantean.QBTMud/Pages/TagManagement.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/TagManagement.razor rename to Lantean.QBTMud/Pages/TagManagement.razor diff --git a/Lantean.QBTMudBlade/Pages/TagManagement.razor.cs b/Lantean.QBTMud/Pages/TagManagement.razor.cs similarity index 83% rename from Lantean.QBTMudBlade/Pages/TagManagement.razor.cs rename to Lantean.QBTMud/Pages/TagManagement.razor.cs index 6a68f09..66421c0 100644 --- a/Lantean.QBTMudBlade/Pages/TagManagement.razor.cs +++ b/Lantean.QBTMud/Pages/TagManagement.razor.cs @@ -1,12 +1,12 @@ using Blazored.LocalStorage; using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; using Microsoft.AspNetCore.Components; using MudBlazor; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class TagManagement { @@ -55,14 +55,20 @@ namespace Lantean.QBTMudBlade.Pages protected async Task AddTag() { - var tags = await DialogService.ShowAddTagsDialog(); + var tag = await DialogService.ShowStringFieldDialog("Add Tag", "Tag", null); - if (tags is null || tags.Count == 0) + if (tag is null) { return; } - await ApiClient.CreateTags(tags); + var existingTags = await ApiClient.GetAllTags(); + if (existingTags.Contains(tag)) + { + return; + } + + await ApiClient.CreateTags([tag]); } protected IEnumerable> Columns => GetColumnDefinitions(); diff --git a/Lantean.QBTMudBlade/Pages/TorrentList.razor b/Lantean.QBTMud/Pages/TorrentList.razor similarity index 100% rename from Lantean.QBTMudBlade/Pages/TorrentList.razor rename to Lantean.QBTMud/Pages/TorrentList.razor diff --git a/Lantean.QBTMudBlade/Pages/TorrentList.razor.cs b/Lantean.QBTMud/Pages/TorrentList.razor.cs similarity index 56% rename from Lantean.QBTMudBlade/Pages/TorrentList.razor.cs rename to Lantean.QBTMud/Pages/TorrentList.razor.cs index d0af170..6d941b6 100644 --- a/Lantean.QBTMudBlade/Pages/TorrentList.razor.cs +++ b/Lantean.QBTMud/Pages/TorrentList.razor.cs @@ -1,14 +1,13 @@ using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Components.UI; -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Components.UI; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; using Microsoft.JSInterop; using MudBlazor; -namespace Lantean.QBTMudBlade.Pages +namespace Lantean.QBTMud.Pages { public partial class TorrentList : IAsyncDisposable { @@ -17,7 +16,6 @@ namespace Lantean.QBTMudBlade.Pages private static readonly KeyboardEvent _addTorrentFileKey = new("a") { AltKey = true }; private static readonly KeyboardEvent _addTorrentLinkKey = new("l") { AltKey = true }; - [Inject] protected IApiClient ApiClient { get; set; } = default!; @@ -147,7 +145,7 @@ namespace Lantean.QBTMudBlade.Pages protected void ShowTorrentToolbar() { var torrent = SelectedItems.FirstOrDefault(); - + NavigateToTorrent(torrent); } @@ -194,71 +192,41 @@ namespace Lantean.QBTMudBlade.Pages public static List> ColumnsDefinitions { get; } = [ - CreateColumnDefinition("#", t => t.Priority), - CreateColumnDefinition("Icon", t => t.State, IconColumn, iconOnly: true, width: 25), - CreateColumnDefinition("Name", t => t.Name, width: 400), - CreateColumnDefinition("Size", t => t.Size, t => DisplayHelpers.Size(t.Size)), - CreateColumnDefinition("Total Size", t => t.TotalSize, t => DisplayHelpers.Size(t.TotalSize), enabled: false), - CreateColumnDefinition("Done", t => t.Progress, ProgressBarColumn, tdClass: "table-progress"), - CreateColumnDefinition("Status", t => t.State, t => DisplayHelpers.State(t.State)), - CreateColumnDefinition("Seeds", t => t.NumberSeeds), - CreateColumnDefinition("Peers", t => t.NumberLeeches), - CreateColumnDefinition("Down Speed", t => t.DownloadSpeed, t => DisplayHelpers.Speed(t.DownloadSpeed)), - CreateColumnDefinition("Up Speed", t => t.UploadSpeed, t => DisplayHelpers.Speed(t.UploadSpeed)), - CreateColumnDefinition("ETA", t => t.EstimatedTimeOfArrival, t => DisplayHelpers.Duration(t.EstimatedTimeOfArrival)), - CreateColumnDefinition("Ratio", t => t.Ratio, t => t.Ratio.ToString("0.00")), - CreateColumnDefinition("Category", t => t.Category), - CreateColumnDefinition("Tags", t => t.Tags, t => string.Join(", ", t.Tags)), - CreateColumnDefinition("Added On", t => t.AddedOn, t => DisplayHelpers.DateTime(t.AddedOn)), - CreateColumnDefinition("Completed On", t => t.CompletionOn, t => DisplayHelpers.DateTime(t.CompletionOn), enabled: false), - CreateColumnDefinition("Tracker", t => t.Tracker, enabled: false), - CreateColumnDefinition("Down Limit", t => t.DownloadLimit, t => DisplayHelpers.Size(t.DownloadLimit), enabled: false), - CreateColumnDefinition("Up Limit", t => t.UploadLimit, t => DisplayHelpers.Size(t.UploadLimit), enabled: false), - CreateColumnDefinition("Downloaded", t => t.Downloaded, t => DisplayHelpers.Size(t.Downloaded), enabled: false), - CreateColumnDefinition("Uploaded", t => t.Uploaded, t => DisplayHelpers.Size(t.Uploaded), enabled: false), - CreateColumnDefinition("Session Download", t => t.DownloadedSession, t => DisplayHelpers.Size(t.DownloadedSession), enabled: false), - CreateColumnDefinition("Session Upload", t => t.UploadedSession, t => DisplayHelpers.Size(t.UploadedSession), enabled: false), - CreateColumnDefinition("Remaining", t => t.AmountLeft, t => DisplayHelpers.Size(t.AmountLeft), enabled: false), - CreateColumnDefinition("Time Active", t => t.TimeActive, t => DisplayHelpers.Duration(t.TimeActive), enabled: false), - CreateColumnDefinition("Save path", t => t.SavePath, enabled: false), - CreateColumnDefinition("Completed", t => t.Completed, t => DisplayHelpers.Size(t.Completed), enabled: false), - CreateColumnDefinition("Ratio Limit", t => t.RatioLimit, t => t.Ratio.ToString("0.00"), enabled: false), - CreateColumnDefinition("Last Seen Complete", t => t.SeenComplete, t => DisplayHelpers.DateTime(t.SeenComplete), enabled: false), - CreateColumnDefinition("Last Activity", t => t.LastActivity, t => DisplayHelpers.DateTime(t.LastActivity), enabled: false), - CreateColumnDefinition("Availability", t => t.Availability, t => t.Availability.ToString("0.##"), enabled: false), - //CreateColumnDefinition("Reannounce In", t => t.Reannounce, enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("#", t => t.Priority), + ColumnDefinitionHelper.CreateColumnDefinition("Icon", t => t.State, IconColumn, iconOnly: true, width: 25), + ColumnDefinitionHelper.CreateColumnDefinition("Name", t => t.Name, width: 400), + ColumnDefinitionHelper.CreateColumnDefinition("Size", t => t.Size, t => DisplayHelpers.Size(t.Size)), + ColumnDefinitionHelper.CreateColumnDefinition("Total Size", t => t.TotalSize, t => DisplayHelpers.Size(t.TotalSize), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Done", t => t.Progress, ProgressBarColumn, tdClass: "table-progress"), + ColumnDefinitionHelper.CreateColumnDefinition("Status", t => t.State, t => DisplayHelpers.State(t.State)), + ColumnDefinitionHelper.CreateColumnDefinition("Seeds", t => t.NumberSeeds), + ColumnDefinitionHelper.CreateColumnDefinition("Peers", t => t.NumberLeeches), + ColumnDefinitionHelper.CreateColumnDefinition("Down Speed", t => t.DownloadSpeed, t => DisplayHelpers.Speed(t.DownloadSpeed)), + ColumnDefinitionHelper.CreateColumnDefinition("Up Speed", t => t.UploadSpeed, t => DisplayHelpers.Speed(t.UploadSpeed)), + ColumnDefinitionHelper.CreateColumnDefinition("ETA", t => t.EstimatedTimeOfArrival, t => DisplayHelpers.Duration(t.EstimatedTimeOfArrival)), + ColumnDefinitionHelper.CreateColumnDefinition("Ratio", t => t.Ratio, t => t.Ratio.ToString("0.00")), + ColumnDefinitionHelper.CreateColumnDefinition("Category", t => t.Category), + ColumnDefinitionHelper.CreateColumnDefinition("Tags", t => t.Tags, t => string.Join(", ", t.Tags)), + ColumnDefinitionHelper.CreateColumnDefinition("Added On", t => t.AddedOn, t => DisplayHelpers.DateTime(t.AddedOn)), + ColumnDefinitionHelper.CreateColumnDefinition("Completed On", t => t.CompletionOn, t => DisplayHelpers.DateTime(t.CompletionOn), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Tracker", t => t.Tracker, enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Down Limit", t => t.DownloadLimit, t => DisplayHelpers.Size(t.DownloadLimit), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Up Limit", t => t.UploadLimit, t => DisplayHelpers.Size(t.UploadLimit), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Downloaded", t => t.Downloaded, t => DisplayHelpers.Size(t.Downloaded), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Uploaded", t => t.Uploaded, t => DisplayHelpers.Size(t.Uploaded), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Session Download", t => t.DownloadedSession, t => DisplayHelpers.Size(t.DownloadedSession), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Session Upload", t => t.UploadedSession, t => DisplayHelpers.Size(t.UploadedSession), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Remaining", t => t.AmountLeft, t => DisplayHelpers.Size(t.AmountLeft), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Time Active", t => t.TimeActive, t => DisplayHelpers.Duration(t.TimeActive), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Save path", t => t.SavePath, enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Completed", t => t.Completed, t => DisplayHelpers.Size(t.Completed), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Ratio Limit", t => t.RatioLimit, t => t.Ratio.ToString("0.00"), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Last Seen Complete", t => t.SeenComplete, t => DisplayHelpers.DateTime(t.SeenComplete), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Last Activity", t => t.LastActivity, t => DisplayHelpers.DateTime(t.LastActivity), enabled: false), + ColumnDefinitionHelper.CreateColumnDefinition("Availability", t => t.Availability, t => t.Availability.ToString("0.##"), enabled: false), + //ColumnDefinitionHelper.CreateColumnDefinition("Reannounce In", t => t.Reannounce, enabled: false), ]; - private static ColumnDefinition CreateColumnDefinition(string name, Func selector, RenderFragment> rowTemplate, int? width = null, string? tdClass = null, bool enabled = true, bool iconOnly = false) - { - var cd = new ColumnDefinition(name, selector, rowTemplate); - cd.Class = iconOnly ? "icon-cell" : "no-wrap"; - if (tdClass is not null) - { - cd.Class += " " + tdClass; - } - cd.Width = width; - cd.Enabled = enabled; - cd.IconOnly = iconOnly; - - return cd; - } - - private static ColumnDefinition CreateColumnDefinition(string name, Func selector, Func? formatter = null, int? width = null, string? tdClass = null, bool enabled = true, bool iconOnly = false) - { - var cd = new ColumnDefinition(name, selector, formatter); - cd.Class = iconOnly ? "icon-cell" : "no-wrap"; - if (tdClass is not null) - { - cd.Class += " " + tdClass; - } - cd.Width = width; - cd.Enabled = enabled; - cd.IconOnly = iconOnly; - - return cd; - } - public async ValueTask DisposeAsync() { // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method diff --git a/Lantean.QBTMudBlade/Program.cs b/Lantean.QBTMud/Program.cs similarity index 96% rename from Lantean.QBTMudBlade/Program.cs rename to Lantean.QBTMud/Program.cs index 9300caf..f8064a3 100644 --- a/Lantean.QBTMudBlade/Program.cs +++ b/Lantean.QBTMud/Program.cs @@ -1,12 +1,12 @@ using Blazored.LocalStorage; using Lantean.QBitTorrentClient; -using Lantean.QBTMudBlade.Services; +using Lantean.QBTMud.Services; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using MudBlazor; using MudBlazor.Services; -namespace Lantean.QBTMudBlade +namespace Lantean.QBTMud { public static class Program { diff --git a/Lantean.QBTMudBlade/Properties/launchSettings.json b/Lantean.QBTMud/Properties/launchSettings.json similarity index 100% rename from Lantean.QBTMudBlade/Properties/launchSettings.json rename to Lantean.QBTMud/Properties/launchSettings.json diff --git a/Lantean.QBTMudBlade/Services/ClipboardService.cs b/Lantean.QBTMud/Services/ClipboardService.cs similarity index 91% rename from Lantean.QBTMudBlade/Services/ClipboardService.cs rename to Lantean.QBTMud/Services/ClipboardService.cs index 1825c5f..ec5786e 100644 --- a/Lantean.QBTMudBlade/Services/ClipboardService.cs +++ b/Lantean.QBTMud/Services/ClipboardService.cs @@ -1,6 +1,6 @@ using Microsoft.JSInterop; -namespace Lantean.QBTMudBlade.Services +namespace Lantean.QBTMud.Services { public class ClipboardService : IClipboardService { diff --git a/Lantean.QBTMudBlade/Services/CookieHandler.cs b/Lantean.QBTMud/Services/CookieHandler.cs similarity index 91% rename from Lantean.QBTMudBlade/Services/CookieHandler.cs rename to Lantean.QBTMud/Services/CookieHandler.cs index c4fa84f..9a9e738 100644 --- a/Lantean.QBTMudBlade/Services/CookieHandler.cs +++ b/Lantean.QBTMud/Services/CookieHandler.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Components.WebAssembly.Http; -namespace Lantean.QBTMudBlade.Services +namespace Lantean.QBTMud.Services { public class CookieHandler : DelegatingHandler { diff --git a/Lantean.QBTMudBlade/Services/DataManager.cs b/Lantean.QBTMud/Services/DataManager.cs similarity index 99% rename from Lantean.QBTMudBlade/Services/DataManager.cs rename to Lantean.QBTMud/Services/DataManager.cs index 63c5166..0401e22 100644 --- a/Lantean.QBTMudBlade/Services/DataManager.cs +++ b/Lantean.QBTMud/Services/DataManager.cs @@ -1,7 +1,7 @@ -using Lantean.QBTMudBlade.Helpers; -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Helpers; +using Lantean.QBTMud.Models; -namespace Lantean.QBTMudBlade.Services +namespace Lantean.QBTMud.Services { public class DataManager : IDataManager { diff --git a/Lantean.QBTMud/Services/FileNameMatcher.cs b/Lantean.QBTMud/Services/FileNameMatcher.cs new file mode 100644 index 0000000..2cce30b --- /dev/null +++ b/Lantean.QBTMud/Services/FileNameMatcher.cs @@ -0,0 +1,253 @@ +using Lantean.QBTMud.Models; +using System.Text; +using System.Text.RegularExpressions; + +namespace Lantean.QBTMud.Services +{ + public record MatchOptions + { + public bool MatchAllOccurrences { get; set; } = false; + + public bool CaseSensitive { get; set; } = false; + } + + public record ReplaceOptions + { + public AppliesTo AppliesToOption { get; set; } = AppliesTo.FilenameExtension; + public bool IncludeFiles { get; set; } = true; + public bool IncludeFolders { get; set; } = false; + public bool ReplaceAll { get; set; } = false; + public int FileEnumerationStart { get; set; } = 0; + } + + public static class FileNameMatcher + { + private const int _maxMatchesPerFile = 250; + + public static Dictionary GetRenamedFiles( + IEnumerable files, + string search, + bool useRegex, + string replacement, + bool matchAllOccurrences, + bool caseSensitive, + AppliesTo appliesToOption, + bool includeFiles, + bool includeFolders, + bool replaceAll, + int fileEnumerationStart) + { + var matchedFiles = new Dictionary(); + + if (string.IsNullOrEmpty(search)) + { + return []; + } + + // Setup regex options + var options = RegexOptions.None; + if (!caseSensitive) + { + options |= RegexOptions.IgnoreCase; + } + + // Build regex pattern + var pattern = useRegex ? search : Regex.Escape(search); + var regex = new Regex(pattern, options); + + var fileEnumeration = fileEnumerationStart; + + foreach (var row in files) + { + // Filter files and folders + if (!row.IsFolder && !includeFiles) + { + continue; + } + if (row.IsFolder && !includeFolders) + { + continue; + } + + // Extract file name and extension + var fileExtension = Path.GetExtension(row.OriginalName); + var fileNameWithoutExt = Path.GetFileNameWithoutExtension(row.OriginalName); + + var targetString = string.Empty; + var offset = 0; + + switch (appliesToOption) + { + case AppliesTo.FilenameExtension: + targetString = fileNameWithoutExt + fileExtension; + break; + + case AppliesTo.Filename: + targetString = fileNameWithoutExt; + break; + + case AppliesTo.Extension: + targetString = fileExtension; + offset = fileNameWithoutExt.Length; + break; + } + + // Find matches based on MatchAllOccurrences + var matches = new List(); + var matchCount = 0; + + if (matchAllOccurrences) + { + foreach (Match match in regex.Matches(targetString)) + { + matches.Add(match); + matchCount++; + if (matchCount >= _maxMatchesPerFile) + { + break; + } + } + } + else + { + var match = regex.Match(targetString); + if (match.Success) + { + matches.Add(match); + } + } + + if (matches.Count == 0) + { + continue; + } + + var renamed = row.OriginalName; + + for (int i = matches.Count - 1; i >= 0; i--) + { + var match = matches[i]; + var replacementValue = replacement; + + // Replace numerical groups + for (var g = 0; g < match.Groups.Count; g++) + { + var groupValue = match.Groups[g].Value; + if (string.IsNullOrEmpty(groupValue)) + { + continue; + } + + replacementValue = ReplaceGroup(replacementValue, $"${g}", groupValue, "\\", false); + } + + // Replace named groups + foreach (var groupName in regex.GetGroupNames()) + { + if (int.TryParse(groupName, out _)) + { + continue; // Skip numerical group names + } + + var groupValue = match.Groups[groupName].Value; + replacementValue = ReplaceGroup(replacementValue, $"${groupName}", groupValue, "\\", false); + } + + // Replace auxiliary variables (e.g., $d, $dd, $ddd, etc.) + var v = new string('d', 8); + while (v.Length > 0) + { + var fileCount = fileEnumeration.ToString().PadLeft(v.Length, '0'); + replacementValue = ReplaceGroup(replacementValue, $"${v}", fileCount, "\\", false); + v = v.Substring(1); + } + + // Remove empty $ variable + replacementValue = ReplaceGroup(replacementValue, "$", string.Empty, "\\"); + + var matchIndex = match.Index; + var matchLength = match.Length; + var startIndex = matchIndex + offset; + var endIndex = startIndex + matchLength; + + renamed = ReplaceBetween(renamed, startIndex, endIndex, replacementValue); + } + + row.NewName = renamed; + fileEnumeration++; + matchedFiles.Add(row.Name, row); + } + + return matchedFiles; + } + + // Helper methods + private static string ReplaceGroup(string input, string search, string replacement, string escape, bool stripEscape = true) + { + var result = new StringBuilder(); + var i = 0; + var inputLength = input.Length; + var escapeLength = escape.Length; + var searchLength = search.Length; + + while (i < inputLength) + { + // Check if the current index contains the escape string + if (IsSubstringAt(input, i, escape)) + { + // Check if the escape is followed by the search string + if (IsSubstringAt(input, i + escapeLength, search)) + { + if (stripEscape) + { + result.Append(search); + i += escapeLength + searchLength; + } + else + { + result.Append(escape + search); + i += escapeLength + searchLength; + } + } + else + { + result.Append(escape); + i += escapeLength; + } + } + else if (IsSubstringAt(input, i, search)) + { + result.Append(replacement); + i += searchLength; + } + else + { + result.Append(input[i]); + i++; + } + } + + return result.ToString(); + } + + private static string ReplaceBetween(string input, int start, int end, string replacement) + { + if (start < 0 || end > input.Length || start > end) + { + return input; + } + + return string.Concat(input.AsSpan(0, start), replacement, input.AsSpan(end)); + } + + private static bool IsSubstringAt(string input, int index, string substring) + { + if (index + substring.Length > input.Length) + { + return false; + } + + return input.Substring(index, substring.Length) == substring; + } + } +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Services/HttpLogger.cs b/Lantean.QBTMud/Services/HttpLogger.cs similarity index 58% rename from Lantean.QBTMudBlade/Services/HttpLogger.cs rename to Lantean.QBTMud/Services/HttpLogger.cs index 579eefd..cfda46f 100644 --- a/Lantean.QBTMudBlade/Services/HttpLogger.cs +++ b/Lantean.QBTMud/Services/HttpLogger.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Http.Logging; -namespace Lantean.QBTMudBlade.Services +namespace Lantean.QBTMud.Services { public class HttpLogger : IHttpClientLogger { @@ -13,27 +13,26 @@ namespace Lantean.QBTMudBlade.Services public object? LogRequestStart(HttpRequestMessage request) { -//#if DEBUG -// _logger.LogInformation( -// "Sending '{Request.Method}' to '{Request.Host}{Request.Path}'", -// request.Method, -// request.RequestUri?.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped), -// request.RequestUri!.PathAndQuery); -//#endif + //#if DEBUG + // _logger.LogInformation( + // "Sending '{Request.Method}' to '{Request.Host}{Request.Path}'", + // request.Method, + // request.RequestUri?.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped), + // request.RequestUri!.PathAndQuery); + //#endif return null; - } public void LogRequestStop( object? context, HttpRequestMessage request, HttpResponseMessage response, TimeSpan elapsed) { -//#if DEBUG -// _logger.LogInformation( -// "Received '{Response.StatusCodeInt} {Response.StatusCodeString}' after {Response.ElapsedMilliseconds}ms", -// (int)response.StatusCode, -// response.StatusCode, -// elapsed.TotalMilliseconds.ToString("F1")); -//#endif + //#if DEBUG + // _logger.LogInformation( + // "Received '{Response.StatusCodeInt} {Response.StatusCodeString}' after {Response.ElapsedMilliseconds}ms", + // (int)response.StatusCode, + // response.StatusCode, + // elapsed.TotalMilliseconds.ToString("F1")); + //#endif } public void LogRequestFailed( diff --git a/Lantean.QBTMudBlade/Services/IClipboardService.cs b/Lantean.QBTMud/Services/IClipboardService.cs similarity index 70% rename from Lantean.QBTMudBlade/Services/IClipboardService.cs rename to Lantean.QBTMud/Services/IClipboardService.cs index e19bd3d..1b5e296 100644 --- a/Lantean.QBTMudBlade/Services/IClipboardService.cs +++ b/Lantean.QBTMud/Services/IClipboardService.cs @@ -1,4 +1,4 @@ -namespace Lantean.QBTMudBlade.Services +namespace Lantean.QBTMud.Services { public interface IClipboardService { diff --git a/Lantean.QBTMudBlade/Services/IDataManager.cs b/Lantean.QBTMud/Services/IDataManager.cs similarity index 93% rename from Lantean.QBTMudBlade/Services/IDataManager.cs rename to Lantean.QBTMud/Services/IDataManager.cs index 0067042..a54d0ca 100644 --- a/Lantean.QBTMudBlade/Services/IDataManager.cs +++ b/Lantean.QBTMud/Services/IDataManager.cs @@ -1,6 +1,6 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; -namespace Lantean.QBTMudBlade.Services +namespace Lantean.QBTMud.Services { public interface IDataManager { diff --git a/Lantean.QBTMudBlade/Services/IKeyboardService.cs b/Lantean.QBTMud/Services/IKeyboardService.cs similarity index 76% rename from Lantean.QBTMudBlade/Services/IKeyboardService.cs rename to Lantean.QBTMud/Services/IKeyboardService.cs index 6b860cb..38f4e0a 100644 --- a/Lantean.QBTMudBlade/Services/IKeyboardService.cs +++ b/Lantean.QBTMud/Services/IKeyboardService.cs @@ -1,13 +1,15 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; -namespace Lantean.QBTMudBlade.Services +namespace Lantean.QBTMud.Services { public interface IKeyboardService { Task Focus(); + Task UnFocus(); + Task RegisterKeypressEvent(KeyboardEvent criteria, Func onKeyPress); Task UnregisterKeypressEvent(KeyboardEvent criteria); } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Services/KeyboardService.cs b/Lantean.QBTMud/Services/KeyboardService.cs similarity index 94% rename from Lantean.QBTMudBlade/Services/KeyboardService.cs rename to Lantean.QBTMud/Services/KeyboardService.cs index e61488a..b4beecd 100644 --- a/Lantean.QBTMudBlade/Services/KeyboardService.cs +++ b/Lantean.QBTMud/Services/KeyboardService.cs @@ -1,8 +1,8 @@ -using Lantean.QBTMudBlade.Models; +using Lantean.QBTMud.Models; using Microsoft.JSInterop; using System.Collections.Concurrent; -namespace Lantean.QBTMudBlade.Services +namespace Lantean.QBTMud.Services { public class KeyboardService : IKeyboardService, IAsyncDisposable { @@ -57,7 +57,7 @@ namespace Lantean.QBTMudBlade.Services await _jSRuntime.InvokeVoidAsync("qbt.keyPressUnFocusInstance", GetObjectReference()); } - protected async virtual ValueTask DisposeAsync(bool disposing) + protected virtual async ValueTask DisposeAsync(bool disposing) { if (!_disposedValue) { @@ -83,4 +83,4 @@ namespace Lantean.QBTMudBlade.Services GC.SuppressFinalize(this); } } -} +} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/_Imports.razor b/Lantean.QBTMud/_Imports.razor similarity index 53% rename from Lantean.QBTMudBlade/_Imports.razor rename to Lantean.QBTMud/_Imports.razor index 0a83396..e421a2e 100644 --- a/Lantean.QBTMudBlade/_Imports.razor +++ b/Lantean.QBTMud/_Imports.razor @@ -7,11 +7,11 @@ @using Microsoft.AspNetCore.Components.WebAssembly.Http @using Microsoft.JSInterop @using MudBlazor -@using Lantean.QBTMudBlade -@using Lantean.QBTMudBlade.Components -@using Lantean.QBTMudBlade.Components.Dialogs -@using Lantean.QBTMudBlade.Components.Options -@using Lantean.QBTMudBlade.Components.UI -@using Lantean.QBTMudBlade.Helpers -@using Lantean.QBTMudBlade.Layout -@using Lantean.QBTMudBlade.Models \ No newline at end of file +@using Lantean.QBTMud +@using Lantean.QBTMud.Components +@using Lantean.QBTMud.Components.Dialogs +@using Lantean.QBTMud.Components.Options +@using Lantean.QBTMud.Components.UI +@using Lantean.QBTMud.Helpers +@using Lantean.QBTMud.Layout +@using Lantean.QBTMud.Models \ No newline at end of file diff --git a/Lantean.QBTMudBlade/readme.md b/Lantean.QBTMud/readme.md similarity index 95% rename from Lantean.QBTMudBlade/readme.md rename to Lantean.QBTMud/readme.md index 3cbb2d7..649f090 100644 --- a/Lantean.QBTMudBlade/readme.md +++ b/Lantean.QBTMud/readme.md @@ -4,7 +4,7 @@ - Rename multiple files dialog - ~~RSS feeds and dialogs~~ -- About +- ~~About~~ - ~~Context menu for files list/trackers list/peers list~~ - ~~Tag management page~~ - ~~Category management page~~ diff --git a/Lantean.QBTMudBlade/wwwroot/Lantean.QBTMudBlade.lib.module.js b/Lantean.QBTMud/wwwroot/Lantean.QBTMudBlade.lib.module.js similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/Lantean.QBTMudBlade.lib.module.js rename to Lantean.QBTMud/wwwroot/Lantean.QBTMudBlade.lib.module.js diff --git a/Lantean.QBTMudBlade/wwwroot/css/app.css b/Lantean.QBTMud/wwwroot/css/app.css similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/css/app.css rename to Lantean.QBTMud/wwwroot/css/app.css diff --git a/Lantean.QBTMudBlade/wwwroot/favicon.png b/Lantean.QBTMud/wwwroot/favicon.png similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/favicon.png rename to Lantean.QBTMud/wwwroot/favicon.png diff --git a/Lantean.QBTMudBlade/wwwroot/icon-192.png b/Lantean.QBTMud/wwwroot/icon-192.png similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/icon-192.png rename to Lantean.QBTMud/wwwroot/icon-192.png diff --git a/Lantean.QBTMudBlade/wwwroot/images/mascot.png b/Lantean.QBTMud/wwwroot/images/mascot.png similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/images/mascot.png rename to Lantean.QBTMud/wwwroot/images/mascot.png diff --git a/Lantean.QBTMudBlade/wwwroot/images/qbittorrent-tray.svg b/Lantean.QBTMud/wwwroot/images/qbittorrent-tray.svg similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/images/qbittorrent-tray.svg rename to Lantean.QBTMud/wwwroot/images/qbittorrent-tray.svg diff --git a/Lantean.QBTMudBlade/wwwroot/images/qbittorrent32.png b/Lantean.QBTMud/wwwroot/images/qbittorrent32.png similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/images/qbittorrent32.png rename to Lantean.QBTMud/wwwroot/images/qbittorrent32.png diff --git a/Lantean.QBTMudBlade/wwwroot/index.html b/Lantean.QBTMud/wwwroot/index.html similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/index.html rename to Lantean.QBTMud/wwwroot/index.html diff --git a/Lantean.QBTMudBlade/wwwroot/js/interop.js b/Lantean.QBTMud/wwwroot/js/interop.js similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/js/interop.js rename to Lantean.QBTMud/wwwroot/js/interop.js diff --git a/Lantean.QBTMudBlade/wwwroot/js/longpress.js b/Lantean.QBTMud/wwwroot/js/longpress.js similarity index 100% rename from Lantean.QBTMudBlade/wwwroot/js/longpress.js rename to Lantean.QBTMud/wwwroot/js/longpress.js diff --git a/Lantean.QBTMudBlade/wwwroot/js/piecesbar.js b/Lantean.QBTMud/wwwroot/js/piecesbar.js similarity index 99% rename from Lantean.QBTMudBlade/wwwroot/js/piecesbar.js rename to Lantean.QBTMud/wwwroot/js/piecesbar.js index 0c0120a..e4d293f 100644 --- a/Lantean.QBTMudBlade/wwwroot/js/piecesbar.js +++ b/Lantean.QBTMud/wwwroot/js/piecesbar.js @@ -52,7 +52,7 @@ class PiecesBar { this.borderSize = 1; this.borderColor = '#999'; - if (parameters && (typeof(parameters) === 'object')) { + if (parameters && (typeof (parameters) === 'object')) { Object.assign(this, parameters) } diff --git a/Lantean.QBTMudBlade/Components/Dialogs/RenameFilesDialog.razor b/Lantean.QBTMudBlade/Components/Dialogs/RenameFilesDialog.razor deleted file mode 100644 index 08f153b..0000000 --- a/Lantean.QBTMudBlade/Components/Dialogs/RenameFilesDialog.razor +++ /dev/null @@ -1,16 +0,0 @@ -@inherits SubmittableDialog - - - - - - - - - - - - Close - Rename - - \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Components/Dialogs/RenameFilesDialog.razor.cs b/Lantean.QBTMudBlade/Components/Dialogs/RenameFilesDialog.razor.cs deleted file mode 100644 index ceccc49..0000000 --- a/Lantean.QBTMudBlade/Components/Dialogs/RenameFilesDialog.razor.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Lantean.QBTMudBlade.Models; -using Microsoft.AspNetCore.Components; -using MudBlazor; - -namespace Lantean.QBTMudBlade.Components.Dialogs -{ - public partial class RenameFilesDialog - { - [CascadingParameter] - public MudDialogInstance MudDialog { get; set; } = default!; - - protected void Cancel() - { - MudDialog.Cancel(); - } - - protected void Submit() - { - MudDialog.Close(); - } - - protected override Task Submit(KeyboardEvent keyboardEvent) - { - Submit(); - - return Task.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Lantean.QBTMudBlade/Pages/About.razor b/Lantean.QBTMudBlade/Pages/About.razor deleted file mode 100644 index eee1803..0000000 --- a/Lantean.QBTMudBlade/Pages/About.razor +++ /dev/null @@ -1,102 +0,0 @@ -@page "/about" -@layout OtherLayout - - - @if (!DrawerOpen) - { - - - } - About - - - - -
- - - -
- qBittorrent @QBittorrentVersion -
-
- - - An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar. - - - - Copyright © 2006-2024 The qBittorrent project - - - - Home Page - - - https://www.qbittorrent.org - - - - Bug Tracker - - - https://bugs.qbittorrent.org - - - - Forum - - - https://forum.qbittorrent.org - -
-
-
- - - - Current maintainer - - - Name - - - Sledgehammer999 - - - Nationality - - - Greece - - - E-mail - - - sledgehammer999@qbittorrent.org - - - - Original author - - - Name - - - Christophe Dumez - - - Nationality - - - France - - - E-mail - - - chris@qbittorrent.org - - - -
\ No newline at end of file diff --git a/Lantean.QBitTorrentClient/ApiClient.cs b/Lantean.QBitTorrentClient/ApiClient.cs index c5c4691..c149691 100644 --- a/Lantean.QBitTorrentClient/ApiClient.cs +++ b/Lantean.QBitTorrentClient/ApiClient.cs @@ -40,7 +40,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("auth/login", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); var responseContent = await response.Content.ReadAsStringAsync(); if (responseContent == "Fails.") @@ -53,7 +53,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.PostAsync("auth/logout", null); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } #endregion Authentication @@ -64,7 +64,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync("app/version"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await response.Content.ReadAsStringAsync(); } @@ -73,7 +73,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync("app/webapiVersion"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await response.Content.ReadAsStringAsync(); } @@ -82,7 +82,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync("app/buildInfo"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJson(response.Content); } @@ -91,14 +91,14 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.PostAsync("app/shutdown", null); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task GetApplicationPreferences() { var response = await _httpClient.GetAsync("app/preferences"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJson(response.Content); } @@ -113,14 +113,14 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("app/setPreferences", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task GetDefaultSavePath() { var response = await _httpClient.GetAsync("app/defaultSavePath"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await response.Content.ReadAsStringAsync(); } @@ -129,7 +129,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync("app/networkInterfaceList"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -138,7 +138,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"app/networkInterfaceAddressList?iface={@interface}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -173,7 +173,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.GetAsync($"log/main", query); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -188,7 +188,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.GetAsync($"log/peers", query); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -201,7 +201,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"sync/maindata?rid={requestId}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJson(response.Content); } @@ -210,7 +210,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"sync/torrentPeers?hash={hash}&rid={requestId}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJson(response.Content); } @@ -223,7 +223,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync("transfer/info"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJson(response.Content); } @@ -232,7 +232,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync("transfer/speedLimitsMode"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); var value = await response.Content.ReadAsStringAsync(); @@ -243,14 +243,14 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.PostAsync("transfer/toggleSpeedLimitsMode", null); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task GetGlobalDownloadLimit() { var response = await _httpClient.GetAsync("transfer/downloadLimit"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); var value = await response.Content.ReadAsStringAsync(); @@ -265,14 +265,14 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("transfer/setDownloadLimit", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task GetGlobalUploadLimit() { var response = await _httpClient.GetAsync("transfer/uploadLimit"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); var value = await response.Content.ReadAsStringAsync(); @@ -287,7 +287,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("transfer/setUploadLimit", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task BanPeers(IEnumerable peers) @@ -298,7 +298,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("transfer/banPeers", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } #endregion Transfer info @@ -343,7 +343,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.GetAsync("torrents/info", query); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -352,7 +352,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"torrents/properties?hash={hash}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJson(response.Content); } @@ -361,7 +361,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"torrents/trackers?hash={hash}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -370,7 +370,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"torrents/webseeds?hash={hash}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -385,7 +385,7 @@ namespace Lantean.QBitTorrentClient } var response = await _httpClient.GetAsync("torrents/files", query); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -394,7 +394,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"torrents/pieceStates?hash={hash}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -403,7 +403,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"torrents/pieceHashes?hash={hash}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -416,7 +416,18 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/pause", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); + } + + public async Task StopTorrents(bool? all = null, params string[] hashes) + { + var content = new FormUrlEncodedBuilder() + .AddAllOrPipeSeparated("hashes", all, hashes) + .ToFormUrlEncodedContent(); + + var response = await _httpClient.PostAsync("torrents/stop", content); + + await ThrowIfNotSuccessfulStatusCode(response); } public async Task ResumeTorrents(bool? all = null, params string[] hashes) @@ -427,7 +438,18 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/resume", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); + } + + public async Task StartTorrents(bool? all = null, params string[] hashes) + { + var content = new FormUrlEncodedBuilder() + .AddAllOrPipeSeparated("hashes", all, hashes) + .ToFormUrlEncodedContent(); + + var response = await _httpClient.PostAsync("torrents/start", content); + + await ThrowIfNotSuccessfulStatusCode(response); } public async Task DeleteTorrents(bool? all = null, bool deleteFiles = false, params string[] hashes) @@ -439,7 +461,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/delete", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RecheckTorrents(bool? all = null, params string[] hashes) @@ -450,7 +472,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/recheck", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task ReannounceTorrents(bool? all = null, params string[] hashes) @@ -461,7 +483,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/reannounce", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task AddTorrent(IEnumerable? urls = null, Dictionary? torrents = null, string? savePath = null, string? cookie = null, string? category = null, IEnumerable? tags = null, bool? skipChecking = null, bool? paused = null, string? contentLayout = null, string? renameTorrent = null, long? uploadLimit = null, long? downloadLimit = null, float? ratioLimit = null, int? seedingTimeLimit = null, bool? autoTorrentManagement = null, bool? sequentialDownload = null, bool? firstLastPiecePriority = null) @@ -541,7 +563,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/add", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task AddTrackersToTorrent(string hash, IEnumerable urls) @@ -553,7 +575,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/addTrackers", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task EditTracker(string hash, string originalUrl, string newUrl) @@ -566,7 +588,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/editTracker", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RemoveTrackers(string hash, IEnumerable urls) @@ -578,7 +600,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/removeTrackers", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task AddPeers(IEnumerable hashes, IEnumerable peers) @@ -590,7 +612,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/addPeers", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task IncreaseTorrentPriority(bool? all = null, params string[] hashes) @@ -601,7 +623,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/increasePrio", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task DecreaseTorrentPriority(bool? all = null, params string[] hashes) @@ -612,7 +634,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/decreasePrio", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task MaximalTorrentPriority(bool? all = null, params string[] hashes) @@ -623,7 +645,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/topPrio", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task MinimalTorrentPriority(bool? all = null, params string[] hashes) @@ -634,7 +656,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/bottomPrio", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetFilePriority(string hash, IEnumerable id, Priority priority) @@ -647,7 +669,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/filePrio", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task> GetTorrentDownloadLimit(bool? all = null, params string[] hashes) @@ -658,7 +680,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/downloadLimit", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonDictionary(response.Content); } @@ -672,7 +694,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/setDownloadLimit", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetTorrentShareLimit(float ratioLimit, float seedingTimeLimit, float inactiveSeedingTimeLimit, bool? all = null, params string[] hashes) @@ -686,7 +708,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/setShareLimits", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task> GetTorrentUploadLimit(bool? all = null, params string[] hashes) @@ -697,7 +719,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/uploadLimit", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonDictionary(response.Content); } @@ -711,7 +733,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/setUploadLimit", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetTorrentLocation(string location, bool? all = null, params string[] hashes) @@ -723,7 +745,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/setLocation", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetTorrentName(string name, string hash) @@ -735,7 +757,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/rename", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetTorrentCategory(string category, bool? all = null, params string[] hashes) @@ -747,14 +769,14 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/setCategory", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task> GetAllCategories() { var response = await _httpClient.GetAsync("torrents/categories"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonDictionary(response.Content); } @@ -768,7 +790,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/createCategory", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task EditCategory(string category, string savePath) @@ -780,7 +802,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/editCategory", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RemoveCategories(params string[] categories) @@ -791,7 +813,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/removeCategories", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task AddTorrentTags(IEnumerable tags, bool? all = null, params string[] hashes) @@ -803,7 +825,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/addTags", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RemoveTorrentTags(IEnumerable tags, bool? all = null, params string[] hashes) @@ -815,14 +837,14 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/removeTags", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task> GetAllTags() { var response = await _httpClient.GetAsync("torrents/tags"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -835,7 +857,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/createTags", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task DeleteTags(params string[] tags) @@ -846,7 +868,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/deleteTags", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetAutomaticTorrentManagement(bool enable, bool? all = null, params string[] hashes) @@ -858,7 +880,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/setAutoManagement", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task ToggleSequentialDownload(bool? all = null, params string[] hashes) @@ -869,7 +891,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/toggleSequentialDownload", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetFirstLastPiecePriority(bool? all = null, params string[] hashes) @@ -880,7 +902,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/toggleFirstLastPiecePrio", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetForceStart(bool value, bool? all = null, params string[] hashes) @@ -892,7 +914,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/setForceStart", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetSuperSeeding(bool value, bool? all = null, params string[] hashes) @@ -904,7 +926,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/setSuperSeeding", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RenameFile(string hash, string oldPath, string newPath) @@ -917,7 +939,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/renameFile", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RenameFolder(string hash, string oldPath, string newPath) @@ -930,7 +952,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("torrents/renameFolder", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public Task GetExportUrl(string hash) @@ -950,7 +972,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/addFolder", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task AddRssFeed(string url, string? path = null) @@ -962,7 +984,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/addFeed", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RemoveRssItem(string path) @@ -973,7 +995,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/removeItem", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task MoveRssItem(string itemPath, string destPath) @@ -985,7 +1007,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/moveItem", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task> GetAllRssItems(bool? withData = null) @@ -995,7 +1017,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.GetAsync("rss/items", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonDictionary(response.Content); } @@ -1009,7 +1031,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/markAsRead", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RefreshRssItem(string itemPath) @@ -1020,7 +1042,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/refreshItem", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task SetRssAutoDownloadingRule(string ruleName, AutoDownloadingRule ruleDef) @@ -1032,7 +1054,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/setRule", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RenameRssAutoDownloadingRule(string ruleName, string newRuleName) @@ -1044,7 +1066,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/renameRule", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task RemoveRssAutoDownloadingRule(string ruleName) @@ -1055,14 +1077,14 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("rss/removeRule", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task> GetAllRssAutoDownloadingRules() { var response = await _httpClient.GetAsync("rss/rules"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonDictionary(response.Content); } @@ -1074,7 +1096,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.GetAsync($"rss/matchingArticles{query}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); var dictionary = await GetJsonDictionary>(response.Content); @@ -1095,7 +1117,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("search/start", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); var obj = await GetJson>(response.Content); @@ -1110,7 +1132,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("search/stop", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task GetSearchStatus(int id) @@ -1124,7 +1146,7 @@ namespace Lantean.QBitTorrentClient return null; } - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return (await GetJsonList(response.Content)).FirstOrDefault(); } @@ -1133,7 +1155,7 @@ namespace Lantean.QBitTorrentClient { var response = await _httpClient.GetAsync($"search/status"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -1153,7 +1175,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.GetAsync($"search/results{query}"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJson(response.Content); } @@ -1166,14 +1188,14 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("search/delete", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task> GetSearchPlugins() { var response = await _httpClient.GetAsync($"search/plugins"); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); return await GetJsonList(response.Content); } @@ -1186,7 +1208,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("search/installPlugin", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task UninstallSearchPlugins(params string[] names) @@ -1197,7 +1219,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("search/uninstallPlugin", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task EnableSearchPlugins(params string[] names) @@ -1209,7 +1231,7 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("search/enablePlugin", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task DisableSearchPlugins(params string[] names) @@ -1221,14 +1243,14 @@ namespace Lantean.QBitTorrentClient var response = await _httpClient.PostAsync("search/enablePlugin", content); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } public async Task UpdateSearchPlugins() { var response = await _httpClient.PostAsync("search/updatePlugins", null); - response.EnsureSuccessStatusCode(); + await ThrowIfNotSuccessfulStatusCode(response); } #endregion Search @@ -1265,5 +1287,16 @@ namespace Lantean.QBitTorrentClient return new Dictionary().AsReadOnly(); } } + + private async Task ThrowIfNotSuccessfulStatusCode(HttpResponseMessage response) + { + if (response.IsSuccessStatusCode) + { + return response; + } + + var errorMessage = await response.Content.ReadAsStringAsync(); + throw new HttpRequestException(errorMessage, null, response.StatusCode); + } } } \ No newline at end of file diff --git a/Lantean.QBitTorrentClient/ApiClientExtensions.cs b/Lantean.QBitTorrentClient/ApiClientExtensions.cs index c6c3e46..fa4d34c 100644 --- a/Lantean.QBitTorrentClient/ApiClientExtensions.cs +++ b/Lantean.QBitTorrentClient/ApiClientExtensions.cs @@ -19,6 +19,21 @@ namespace Lantean.QBitTorrentClient return apiClient.PauseTorrents(true); } + public static Task StopTorrent(this IApiClient apiClient, string hash) + { + return apiClient.StopTorrents(null, hash); + } + + public static Task StopTorrents(this IApiClient apiClient, IEnumerable hashes) + { + return apiClient.StopTorrents(null, hashes.ToArray()); + } + + public static Task StopAllTorrents(this IApiClient apiClient) + { + return apiClient.StopTorrents(true); + } + public static Task ResumeTorrent(this IApiClient apiClient, string hash) { return apiClient.ResumeTorrents(null, hash); @@ -34,6 +49,21 @@ namespace Lantean.QBitTorrentClient return apiClient.ResumeTorrents(true); } + public static Task StartTorrent(this IApiClient apiClient, string hash) + { + return apiClient.StartTorrents(null, hash); + } + + public static Task StartTorrents(this IApiClient apiClient, IEnumerable hashes) + { + return apiClient.StartTorrents(null, hashes.ToArray()); + } + + public static Task StartAllTorrents(this IApiClient apiClient) + { + return apiClient.StartTorrents(true); + } + public static Task DeleteTorrent(this IApiClient apiClient, string hash, bool deleteFiles) { return apiClient.DeleteTorrents(null, deleteFiles, hash); diff --git a/Lantean.QBitTorrentClient/IApiClient.cs b/Lantean.QBitTorrentClient/IApiClient.cs index f748484..c21e4e0 100644 --- a/Lantean.QBitTorrentClient/IApiClient.cs +++ b/Lantean.QBitTorrentClient/IApiClient.cs @@ -92,6 +92,10 @@ namespace Lantean.QBitTorrentClient Task ResumeTorrents(bool? all = null, params string[] hashes); + Task StartTorrents(bool? all = null, params string[] hashes); + + Task StopTorrents(bool? all = null, params string[] hashes); + Task DeleteTorrents(bool? all = null, bool deleteFiles = false, params string[] hashes); Task RecheckTorrents(bool? all = null, params string[] hashes); diff --git a/Lantean.QBitTorrentClient/Models/RssArticle.cs b/Lantean.QBitTorrentClient/Models/RssArticle.cs index 41c0423..373a9b5 100644 --- a/Lantean.QBitTorrentClient/Models/RssArticle.cs +++ b/Lantean.QBitTorrentClient/Models/RssArticle.cs @@ -59,4 +59,4 @@ namespace Lantean.QBitTorrentClient.Models [JsonPropertyName("isRead")] public bool IsRead { get; } } -} +} \ No newline at end of file diff --git a/Lantean.QBitTorrentClient/Models/RssItem.cs b/Lantean.QBitTorrentClient/Models/RssItem.cs index 6b07038..95233f7 100644 --- a/Lantean.QBitTorrentClient/Models/RssItem.cs +++ b/Lantean.QBitTorrentClient/Models/RssItem.cs @@ -44,4 +44,4 @@ namespace Lantean.QBitTorrentClient.Models [JsonPropertyName("url")] public string Url { get; } } -} +} \ No newline at end of file