示例#1
0
            protected override async Task <int> OnExecuteAuthenticatedAsync(QBittorrentClient client, CommandLineApplication app, IConsole console)
            {
                if (!string.IsNullOrEmpty(SavePath))
                {
                    var apiVersion = await client.GetApiVersionAsync();

                    if (apiVersion < new ApiVersion(2, 1))
                    {
                        console.WriteLineColored("The --save-path parameter requires qBittorrent 4.1.3 or later.",
                                                 ColorScheme.Current.Warning);
                        return(ExitCodes.Failure);
                    }

                    await client.AddCategoryAsync(Name, SavePath);
                }
                else
                {
                    await client.AddCategoryAsync(Name);
                }
                return(ExitCodes.Success);
            }