|
|
@ -28,6 +28,7 @@ using StabilityMatrix.Avalonia.ViewModels.Base; |
|
|
|
using StabilityMatrix.Avalonia.ViewModels.Dialogs; |
|
|
|
using StabilityMatrix.Avalonia.ViewModels.Dialogs; |
|
|
|
using StabilityMatrix.Avalonia.ViewModels.OutputsPage; |
|
|
|
using StabilityMatrix.Avalonia.ViewModels.OutputsPage; |
|
|
|
using StabilityMatrix.Core.Attributes; |
|
|
|
using StabilityMatrix.Core.Attributes; |
|
|
|
|
|
|
|
using StabilityMatrix.Core.Exceptions; |
|
|
|
using StabilityMatrix.Core.Extensions; |
|
|
|
using StabilityMatrix.Core.Extensions; |
|
|
|
using StabilityMatrix.Core.Helper; |
|
|
|
using StabilityMatrix.Core.Helper; |
|
|
|
using StabilityMatrix.Core.Helper.Factory; |
|
|
|
using StabilityMatrix.Core.Helper.Factory; |
|
|
@ -323,6 +324,12 @@ public partial class OutputsPageViewModel : PageViewModelBase |
|
|
|
{ |
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//Attempt to remove .txt sidecar if it exists |
|
|
|
|
|
|
|
var sideCar = new FilePath(Path.ChangeExtension(imageFile, ".txt")); |
|
|
|
|
|
|
|
if (File.Exists(sideCar)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
await notificationService.TryAsync(sideCar.DeleteAsync()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OutputsCache.Remove(item.ImageFile); |
|
|
|
OutputsCache.Remove(item.ImageFile); |
|
|
|
|
|
|
|
|
|
|
@ -388,6 +395,14 @@ public partial class OutputsPageViewModel : PageViewModelBase |
|
|
|
{ |
|
|
|
{ |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Attempt to remove .txt sidecar if it exists |
|
|
|
|
|
|
|
var sideCar = new FilePath(Path.ChangeExtension(imageFile, ".txt")); |
|
|
|
|
|
|
|
if (File.Exists(sideCar)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
await notificationService.TryAsync(sideCar.DeleteAsync()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OutputsCache.Remove(output.ImageFile); |
|
|
|
OutputsCache.Remove(output.ImageFile); |
|
|
|
|
|
|
|
|
|
|
|
// Invalidate cache |
|
|
|
// Invalidate cache |
|
|
@ -485,6 +500,14 @@ public partial class OutputsPageViewModel : PageViewModelBase |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await file.MoveToWithIncrementAsync(newPath); |
|
|
|
await file.MoveToWithIncrementAsync(newPath); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var sideCar = new FilePath(Path.ChangeExtension(file, ".txt")); |
|
|
|
|
|
|
|
//If a .txt sidecar file exists, and the image was moved successfully, try to move the sidecar along with the image |
|
|
|
|
|
|
|
if (File.Exists(newPath) && File.Exists(sideCar)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var newSidecar = new FilePath(Path.ChangeExtension(newPath, ".txt")); |
|
|
|
|
|
|
|
await sideCar.MoveToWithIncrementAsync(newSidecar); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
{ |
|
|
|