Skip to content

Commit

Permalink
[skip ci]update downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
moonheart committed Jun 2, 2024
1 parent f7cd31e commit 58773ad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions MementoMori.AssetDownloader/AssetDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,18 @@ private async Task ConvertAndUpload(CancellationToken stoppingToken)
throw new Exception("Failed to execute AssetStudioCLI");
}
}

// delete duplicate files, end with _#\d+
foreach (var file in Directory.GetFiles(exportedAssetsPath, "*", SearchOption.AllDirectories))
{
var filename = Path.GetFileNameWithoutExtension(file);
if (Regex.IsMatch(filename, @"_#\d+$"))
{
_logger.LogInformation($"Delete duplicate file {file}");
File.Delete(file);
}
}


var aListApi = new AListApi(_downloaderOption.AListUrl);
await aListApi.AuthLogin(_downloaderOption.AlistUsername, _downloaderOption.AlistPassword);
Expand Down Expand Up @@ -286,7 +289,7 @@ private async Task CopyFilesRecursively(AListApi aListApi, DirectoryInfo source,
if (ct.IsCancellationRequested)
return;
var existedFile = existedFiles.FirstOrDefault(f => f.Name == file.Name);
if (existedFile != null && file.Length != existedFile.Size)
if (existedFile != null && file.Length == existedFile.Size)
{
_logger.LogInformation($"Skip {file.FullName}");
continue;
Expand Down

0 comments on commit 58773ad

Please sign in to comment.