diff --git a/DownKyi.Core/Aria2cNet/Client/AriaClient.cs b/DownKyi.Core/Aria2cNet/Client/AriaClient.cs index dd1b5fa..86bf74a 100644 --- a/DownKyi.Core/Aria2cNet/Client/AriaClient.cs +++ b/DownKyi.Core/Aria2cNet/Client/AriaClient.cs @@ -18,8 +18,10 @@ namespace DownKyi.Core.Aria2cNet.Client private static readonly string JSONRPC = "2.0"; private const string LOCAL_HOST = "http://localhost"; private const string TOKEN = "downkyi"; + private const int LISTEN_PORT = 6800; private static string host = LOCAL_HOST; - private static string token = TOKEN; + private static string token = TOKEN; + private static int listenPort = LISTEN_PORT; /// /// This method adds a new download. @@ -1039,13 +1041,18 @@ namespace DownKyi.Core.Aria2cNet.Client AriaClient.host = host; } + public static void SetListenPort(int listenPort = LISTEN_PORT) + { + AriaClient.listenPort = listenPort; + } + /// /// 获取jsonrpc的地址 /// /// - private static string GetRpcUri(int listenPort = 6800) + private static string GetRpcUri() { - return $"{host}:{listenPort}/jsonrpc"; + return $"{host}:{AriaClient.listenPort}/jsonrpc"; } /// diff --git a/DownKyi/Services/Download/AriaDownloadService.cs b/DownKyi/Services/Download/AriaDownloadService.cs index 57ede1b..03925b2 100644 --- a/DownKyi/Services/Download/AriaDownloadService.cs +++ b/DownKyi/Services/Download/AriaDownloadService.cs @@ -236,6 +236,8 @@ namespace DownKyi.Services.Download AriaClient.SetToken(); // 设置aria host AriaClient.SetHost(); + // 设置aria listenPort + AriaClient.SetListenPort(); // 启动Aria服务器 StartAriaServer(); diff --git a/DownKyi/Services/Download/CustomAriaDownloadService.cs b/DownKyi/Services/Download/CustomAriaDownloadService.cs index d30e429..5dbf0c4 100644 --- a/DownKyi/Services/Download/CustomAriaDownloadService.cs +++ b/DownKyi/Services/Download/CustomAriaDownloadService.cs @@ -235,6 +235,8 @@ namespace DownKyi.Services.Download AriaClient.SetToken(SettingsManager.GetInstance().GetAriaToken()); // 设置aria host AriaClient.SetHost(SettingsManager.GetInstance().GetAriaHost()); + // 设置aria listenPort + AriaClient.SetListenPort(SettingsManager.GetInstance().GetAriaListenPort()); // 启动基本服务 BaseStart();