-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d83de24
commit 5264f53
Showing
13 changed files
with
124 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+668 Bytes
(110%)
src/DiffEngineTray.Tests/MenuBuilderTest.DiffTempTarget.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+795 Bytes
(120%)
src/DiffEngineTray.Tests/MenuBuilderTest.Empty.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+668 Bytes
(110%)
src/DiffEngineTray.Tests/MenuBuilderTest.Full.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+664 Bytes
(110%)
src/DiffEngineTray.Tests/MenuBuilderTest.FullGrouped.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+661 Bytes
(110%)
src/DiffEngineTray.Tests/MenuBuilderTest.Grouped.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+672 Bytes
(100%)
src/DiffEngineTray.Tests/MenuBuilderTest.Many.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+675 Bytes
(110%)
src/DiffEngineTray.Tests/MenuBuilderTest.OnlyDelete.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+671 Bytes
(110%)
src/DiffEngineTray.Tests/MenuBuilderTest.OnlyMove.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
static class FilePurger | ||
{ | ||
public static void Launch() | ||
{ | ||
var thread = new Thread(Inner); | ||
thread.SetApartmentState(ApartmentState.STA); | ||
thread.Start(); | ||
} | ||
|
||
static void Inner() | ||
{ | ||
using var dialog = new FolderBrowserDialog(); | ||
var directoryResult = dialog.ShowDialog(); | ||
|
||
var path = dialog.SelectedPath; | ||
if (directoryResult != DialogResult.OK || | ||
string.IsNullOrWhiteSpace(path)) | ||
{ | ||
return; | ||
} | ||
|
||
var files = Directory.GetFiles(path, "*.verified.*", SearchOption.AllDirectories); | ||
|
||
if (files.Length == 0) | ||
{ | ||
MessageBox.Show($"No *.verified.* files found in {path}"); | ||
return; | ||
} | ||
|
||
if (Confirm(files)) | ||
{ | ||
DeleteFiles(files); | ||
} | ||
} | ||
|
||
static bool Confirm(string[] files) | ||
{ | ||
var result = AskQuestion( | ||
$""" | ||
Files found: {files.Length}. | ||
Delete files? | ||
""", | ||
"Confirm", | ||
MessageBoxButtons.OKCancel); | ||
return result == DialogResult.OK; | ||
} | ||
|
||
static void DeleteFiles(string[] files) | ||
{ | ||
for (var index = 0; index < files.Length; index++) | ||
{ | ||
var file = files[index]; | ||
try | ||
{ | ||
if (File.Exists(file)) | ||
{ | ||
File.Delete(file); | ||
} | ||
} | ||
catch (Exception exception) | ||
{ | ||
var failedResult = AskQuestion( | ||
$""" | ||
Could not delete file: {file} | ||
Exception: {exception.Message} | ||
""", | ||
"Delete failed", | ||
MessageBoxButtons.AbortRetryIgnore); | ||
|
||
if (failedResult == DialogResult.Abort) | ||
{ | ||
return; | ||
} | ||
|
||
if (failedResult == DialogResult.Retry) | ||
{ | ||
index--; | ||
} | ||
} | ||
} | ||
} | ||
|
||
static DialogResult AskQuestion(string text, string caption, MessageBoxButtons buttons) => | ||
MessageBox.Show( | ||
text, | ||
caption, | ||
buttons, | ||
MessageBoxIcon.Question, | ||
MessageBoxDefaultButton.Button1, | ||
MessageBoxOptions.DefaultDesktopOnly); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters