Fixed potential issue with duplicate categories.
This commit is contained in:
parent
a8dc196dfe
commit
732e8d9691
1 changed files with 24 additions and 14 deletions
|
|
@ -198,6 +198,7 @@ namespace RdtClient.Service.Services
|
|||
public String AppDefaultSavePath()
|
||||
{
|
||||
var downloadPath = Settings.Get.MappedPath;
|
||||
|
||||
downloadPath = downloadPath.TrimEnd('\\')
|
||||
.TrimEnd('/');
|
||||
|
||||
|
|
@ -215,6 +216,7 @@ namespace RdtClient.Service.Services
|
|||
var torrents = await _torrents.Get();
|
||||
|
||||
var prio = 0;
|
||||
|
||||
foreach (var torrent in torrents)
|
||||
{
|
||||
var downloadPath = savePath;
|
||||
|
|
@ -311,6 +313,7 @@ namespace RdtClient.Service.Services
|
|||
|
||||
return results;
|
||||
}
|
||||
|
||||
public async Task<IList<TorrentFileItem>> TorrentFileContents(String hash)
|
||||
{
|
||||
var results = new List<TorrentFileItem>();
|
||||
|
|
@ -439,10 +442,11 @@ namespace RdtClient.Service.Services
|
|||
|
||||
var torrentsToGroup = torrents.Where(m => !String.IsNullOrWhiteSpace(m.Category))
|
||||
.Select(m => m.Category.ToLower())
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
var categories = Settings.Get.Categories.Split(",", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).Distinct();
|
||||
var categories = Settings.Get
|
||||
.Categories
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
|
||||
torrentsToGroup.AddRange(categories);
|
||||
|
||||
|
|
@ -450,7 +454,8 @@ namespace RdtClient.Service.Services
|
|||
|
||||
if (torrentsToGroup.Count > 0)
|
||||
{
|
||||
results = torrentsToGroup.ToDictionary(m => m,
|
||||
results = torrentsToGroup.Distinct(StringComparer.CurrentCultureIgnoreCase)
|
||||
.ToDictionary(m => m,
|
||||
m => new TorrentCategory
|
||||
{
|
||||
Name = m,
|
||||
|
|
@ -471,7 +476,10 @@ namespace RdtClient.Service.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
var categoryList = categoriesSetting.Split(",", StringSplitOptions.RemoveEmptyEntries).Distinct().ToList();
|
||||
var categoryList = categoriesSetting
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||
.Distinct(StringComparer.CurrentCultureIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
if (!categoryList.Contains(category))
|
||||
{
|
||||
|
|
@ -493,7 +501,9 @@ namespace RdtClient.Service.Services
|
|||
return;
|
||||
}
|
||||
|
||||
var categoryList = categoriesSetting.Split(",", StringSplitOptions.RemoveEmptyEntries).Distinct().ToList();
|
||||
var categoryList = categoriesSetting.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||
.Distinct(StringComparer.CurrentCultureIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
categoryList = categoryList.Where(m => m != category).ToList();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue