added reset times
This commit is contained in:
parent
01b2c0e5e7
commit
64a14f39c1
@ -65,7 +65,7 @@ namespace PhotoRenamer
|
||||
}
|
||||
finally
|
||||
{
|
||||
System.Threading.Interlocked.Increment(ref i);
|
||||
Interlocked.Increment(ref i);
|
||||
progressBar.Tick(i);
|
||||
}
|
||||
});
|
||||
@ -82,7 +82,8 @@ namespace PhotoRenamer
|
||||
using var child = progressBar.Spawn(100, destination.FullName, _childOptions);
|
||||
using var client = new WebClient();
|
||||
|
||||
void OnClientOnDownloadProgressChanged(object o, DownloadProgressChangedEventArgs args) => child.Tick(args.ProgressPercentage);
|
||||
void OnClientOnDownloadProgressChanged(object o, DownloadProgressChangedEventArgs args) =>
|
||||
child.Tick(args.ProgressPercentage);
|
||||
|
||||
client.DownloadProgressChanged += OnClientOnDownloadProgressChanged;
|
||||
client.DownloadFileAsync(new Uri(source.FullName), destination.FullName);
|
||||
@ -90,10 +91,21 @@ namespace PhotoRenamer
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
client.DownloadProgressChanged -= OnClientOnDownloadProgressChanged;
|
||||
ResetTimes(destination, source);
|
||||
|
||||
child.Tick(100);
|
||||
}
|
||||
|
||||
private static void ResetTimes(FileSystemInfo destination, FileSystemInfo source)
|
||||
{
|
||||
destination.LastWriteTime = source.LastWriteTime;
|
||||
destination.LastWriteTimeUtc = source.LastWriteTimeUtc;
|
||||
destination.CreationTime = source.CreationTime;
|
||||
destination.CreationTimeUtc = source.CreationTimeUtc;
|
||||
}
|
||||
|
||||
private string CreateFolder(DateTime dateTime)
|
||||
{
|
||||
var folder = Path.Combine(_targetPath, dateTime.Year.ToString(), dateTime.Month.ToString("D2"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user