diff --git a/Aria2Fast/Aria2Fast.csproj b/Aria2Fast/Aria2Fast.csproj index 0b350fa..3ecd1ae 100644 --- a/Aria2Fast/Aria2Fast.csproj +++ b/Aria2Fast/Aria2Fast.csproj @@ -39,12 +39,12 @@ - + - + - + @@ -52,8 +52,8 @@ - - + + diff --git a/Aria2Fast/MainWindow.xaml.cs b/Aria2Fast/MainWindow.xaml.cs index cbc7130..37a999f 100644 --- a/Aria2Fast/MainWindow.xaml.cs +++ b/Aria2Fast/MainWindow.xaml.cs @@ -57,7 +57,7 @@ public partial class MainWindow : FluentWindow new NavigationViewItem("订阅源", SymbolRegular.StarAdd24, null) { NavigationCacheMode = NavigationCacheMode.Required, - MenuItems = new object[] + MenuItemsSource = new object[] { new NavigationViewItem("Mikan", typeof(AnimeListView)) { diff --git a/Aria2Fast/Service/Aria2ApiManager.cs b/Aria2Fast/Service/Aria2ApiManager.cs index 1c6c88d..2e68685 100644 --- a/Aria2Fast/Service/Aria2ApiManager.cs +++ b/Aria2Fast/Service/Aria2ApiManager.cs @@ -271,7 +271,7 @@ private void SetupEvent() /// 从一个BT的URL添加到下载中(用于订阅的下载) /// /// - public async Task DownloadBtFileUrl(string url, string path, string taskName = "") + public async Task DownloadBtFileUrl(string url, string path, string taskName = "") { //先下载BT文件 @@ -301,18 +301,18 @@ public async Task DownloadBtFileUrl(string url, string path, { "dir", System.IO.Path.Combine(path, taskName)} }; - WkyDownloadResult downloadResult = new WkyDownloadResult(); + Aria2FastDownloadResult downloadResult = new Aria2FastDownloadResult(); if (data.Length > 0) { var result = await _client.AddTorrentAsync(data, options: config, position: 0); Debug.WriteLine($"DownloadBtFileUrl结果:{result}"); - - downloadResult.isSuccessed = IsGid(result); + downloadResult.IsSuccessed = IsGid(result); downloadResult.Gid = result; } else { - downloadResult.isSuccessed = false; + downloadResult.IsSuccessed = false; + downloadResult.ErrorMessage = "无法下载BT文件"; } return downloadResult; @@ -324,7 +324,7 @@ public async Task DownloadBtFileUrl(string url, string path, { "dir", System.IO.Path.Combine(path, taskName)} }; - WkyDownloadResult downloadResult = new WkyDownloadResult(); + Aria2FastDownloadResult downloadResult = new Aria2FastDownloadResult(); var result = await _client.AddUriAsync(new List { url }, options: config, position: 0); Debug.WriteLine($"DownloadBtFileUrl结果#2:{result}"); @@ -336,7 +336,7 @@ public async Task DownloadBtFileUrl(string url, string path, downloadResult.InfoHash = statusResult.InfoHash; } - downloadResult.isSuccessed = IsGid(result); + downloadResult.IsSuccessed = IsGid(result); downloadResult.Gid = result; return downloadResult; @@ -345,7 +345,7 @@ public async Task DownloadBtFileUrl(string url, string path, } - public async Task DownloadUrl(string url, string savePath = "") + public async Task DownloadUrl(string url, string savePath = "") { var result = await _client.AddUriAsync(new List { @@ -359,15 +359,15 @@ public async Task DownloadUrl(string url, string savePath = " Debug.WriteLine($"DownloadBtFileUrl结果:{result}"); - WkyDownloadResult downloadResult = new WkyDownloadResult(); - downloadResult.isSuccessed = IsGid(result); + Aria2FastDownloadResult downloadResult = new Aria2FastDownloadResult(); + downloadResult.IsSuccessed = IsGid(result); downloadResult.Gid = result; return downloadResult; } - public async Task DownloadBtFile(string filePath, string savePath = "") + public async Task DownloadBtFile(string filePath, string savePath = "") { var config = new Dictionary { @@ -378,8 +378,8 @@ public async Task DownloadBtFile(string filePath, string save Debug.WriteLine($"DownloadBtFile结果:{result}"); - WkyDownloadResult downloadResult = new WkyDownloadResult(); - downloadResult.isSuccessed = IsGid(result); + Aria2FastDownloadResult downloadResult = new Aria2FastDownloadResult(); + downloadResult.IsSuccessed = IsGid(result); downloadResult.Gid = result; diff --git a/Aria2Fast/Service/Model/DownloadResult.cs b/Aria2Fast/Service/Model/DownloadResult.cs index bd976c0..042af39 100644 --- a/Aria2Fast/Service/Model/DownloadResult.cs +++ b/Aria2Fast/Service/Model/DownloadResult.cs @@ -6,10 +6,12 @@ namespace Aria2Fast.Service.Model { - public class WkyDownloadResult + public class Aria2FastDownloadResult { //返回值非0或网络请求有异常 - public bool isSuccessed { get; set; } + public bool IsSuccessed { get; set; } + + public string ErrorMessage { get; set; } public string Gid { get; set; } diff --git a/Aria2Fast/Service/SubscriptionManager.cs b/Aria2Fast/Service/SubscriptionManager.cs index 5ab73c6..a167810 100644 --- a/Aria2Fast/Service/SubscriptionManager.cs +++ b/Aria2Fast/Service/SubscriptionManager.cs @@ -458,7 +458,7 @@ public async Task CheckSubscriptionOne(SubscriptionModel subscription) EasyLogManager.Logger.Info($"添加下载完毕"); - if (aria2Result.isSuccessed) + if (aria2Result.IsSuccessed) { TaskUrlToSubscriptionName[aria2Result.Gid] = subject; if (!string.IsNullOrWhiteSpace(aria2Result.InfoHash)) @@ -467,7 +467,7 @@ public async Task CheckSubscriptionOne(SubscriptionModel subscription) } } - if (aria2Result.isSuccessed) + if (aria2Result.IsSuccessed) { subscription.AlreadyAddedDownloadModel.Add(new SubscriptionSubTaskModel() { Name = subject, Url = downloadUrl, Time = DateTime.Now }); EasyLogManager.Logger.Info($"添加成功"); diff --git a/Aria2Fast/View/AddTaskView.xaml.cs b/Aria2Fast/View/AddTaskView.xaml.cs index cea0f06..17d3be4 100644 --- a/Aria2Fast/View/AddTaskView.xaml.cs +++ b/Aria2Fast/View/AddTaskView.xaml.cs @@ -82,7 +82,7 @@ private async void ConfirmButton_Click(object sender, RoutedEventArgs e) try { var result = await Aria2ApiManager.Instance.DownloadUrl(file, PathComboBox.Text); - if (result.isSuccessed) + if (result.IsSuccessed) { EasyLogManager.Logger.Info($"任务已添加:{file}"); count++; @@ -173,7 +173,7 @@ private async void UrlTextBox_Drop(object sender, DragEventArgs e) try { var result = await Aria2ApiManager.Instance.DownloadBtFile(file, PathComboBox.Text); - if (result.isSuccessed) + if (result.IsSuccessed) { EasyLogManager.Logger.Info($"任务已添加:{file}"); count++; diff --git a/Aria2Fast/View/WkyTaskListView.xaml.cs b/Aria2Fast/View/WkyTaskListView.xaml.cs index f6b3f50..e7f84f3 100644 --- a/Aria2Fast/View/WkyTaskListView.xaml.cs +++ b/Aria2Fast/View/WkyTaskListView.xaml.cs @@ -19,7 +19,6 @@ using Aria2Fast.Service; using Aria2Fast.Service.Model; using Newtonsoft.Json; -using Wpf.Ui.Styles.Controls;