diff --git a/gui/Resources/Die.png b/gui/Resources/Die.png
new file mode 100644
index 0000000..9aa3b5c
Binary files /dev/null and b/gui/Resources/Die.png differ
diff --git a/gui/SlunkCryptGUI.csproj b/gui/SlunkCryptGUI.csproj
index 417d997..e79c0f6 100644
--- a/gui/SlunkCryptGUI.csproj
+++ b/gui/SlunkCryptGUI.csproj
@@ -192,6 +192,9 @@
+
+
+
copy /Y "$(SolutionDir)\etc\deps\cpu-capabilities\*.dll" "$(TargetDir)"
diff --git a/gui/SlunkCryptGUI.xaml b/gui/SlunkCryptGUI.xaml
index d5da2fd..9e9db71 100644
--- a/gui/SlunkCryptGUI.xaml
+++ b/gui/SlunkCryptGUI.xaml
@@ -20,18 +20,18 @@
PreviewKeyDown="Window_PreviewKeyDown">
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
pack://application:,,,/Resources/Fonts/#Hack
@@ -94,7 +94,7 @@
-
+
diff --git a/gui/SlunkCryptGUI.xaml.cs b/gui/SlunkCryptGUI.xaml.cs
index 5936348..fdf593c 100644
--- a/gui/SlunkCryptGUI.xaml.cs
+++ b/gui/SlunkCryptGUI.xaml.cs
@@ -158,11 +158,11 @@ namespace com.muldersoft.slunkcrypt.gui
{
using (BusyManager busy = new BusyManager(this))
{
- Edit_Encrypt_Password.Password = string.Empty;
+ Button_Encrypt_Toggle.IsChecked = true;
+ Edit_Encrypt_Password.Password = "...";
string password;
if (!string.IsNullOrEmpty(password = await GeneratePassword()))
{
- Button_Encrypt_Toggle.IsChecked = true;
Edit_Encrypt_Password.Password = password;
}
}
@@ -851,6 +851,8 @@ namespace com.muldersoft.slunkcrypt.gui
.AppendLine(VersionInfo.VersionStr)
.AppendLine("This work has been released under the \u201CCC0 1.0\u201D license!")
.AppendLine()
+ .AppendLine("Official web-site: http://slunkcrypt.osdn.io/")
+ .AppendLine()
.AppendLine(Environment.OSVersion.VersionString)
.AppendLine(string.Format("Operating System Bitness: {0:D}, Process Bitness: {1:D}", Environment.Is64BitOperatingSystem ? 64 : 32, Environment.Is64BitProcess ? 64 : 32))
.AppendLine(".NET Runtime Version: " + Environment.Version)
diff --git a/gui/Utilities/ProcessRunner.cs b/gui/Utilities/ProcessRunner.cs
index b5de147..ea55985 100644
--- a/gui/Utilities/ProcessRunner.cs
+++ b/gui/Utilities/ProcessRunner.cs
@@ -26,9 +26,9 @@ namespace com.muldersoft.slunkcrypt.gui.utils
public const bool STDOUT = false, STDERR = true;
private readonly Process m_process = new Process();
- private readonly TaskCompletionSource m_hasExited = new TaskCompletionSource();
private readonly Dispatcher m_dispatcher;
private readonly ProcessPriorityClass? m_priorityClass;
+ private readonly Task m_hasExited;
private volatile bool m_running = false, m_finished = false, m_aborted = false, m_disposed = false;
@@ -50,6 +50,40 @@ namespace com.muldersoft.slunkcrypt.gui.utils
}
}
+ // =============================================================================
+ // Event handler class
+ // =============================================================================
+
+ private class ProcessExitHandler
+ {
+ private readonly TaskCompletionSource completionSource = new TaskCompletionSource();
+
+ public ProcessExitHandler(Process process)
+ {
+ if (ReferenceEquals(process, null))
+ {
+ throw new ArgumentNullException("Process must not be null!");
+ }
+ process.Exited += OnProcessExit;
+ }
+
+ public Task Task
+ {
+ get
+ {
+ return completionSource.Task;
+ }
+ }
+
+ protected void OnProcessExit(object sender, EventArgs e)
+ {
+ if (sender is Process)
+ {
+ completionSource.TrySetResult(((Process)sender).ExitCode);
+ }
+ }
+ }
+
// =============================================================================
// Constructor
// =============================================================================
@@ -64,7 +98,7 @@ namespace com.muldersoft.slunkcrypt.gui.utils
{
throw new ArgumentException("The given ProcessPriorityClass is undefined!");
}
- InitializeProcess(m_process, m_hasExited, true);
+ m_hasExited = InitializeProcess(m_process, true);
}
~ProcessRunner()
@@ -101,11 +135,11 @@ namespace com.muldersoft.slunkcrypt.gui.utils
public static async Task> ExecAsnyc(string executableFile, string[] arguments = null, IReadOnlyDictionary environmentVariables = null, ProcessPriorityClass? priorityClass = null, TimeSpan? timeout = null)
{
- TaskCompletionSource completionSource = new TaskCompletionSource();
+
using (Process process = new Process())
{
- InitializeProcess(process, completionSource);
- return await DoExecAsnyc(process, completionSource.Task, executableFile, arguments, environmentVariables, priorityClass, timeout);
+ Task hasExitedTask = InitializeProcess(process);
+ return await DoExecAsnyc(process, hasExitedTask, executableFile, arguments, environmentVariables, priorityClass, timeout);
}
}
@@ -146,7 +180,7 @@ namespace com.muldersoft.slunkcrypt.gui.utils
// Internal methods
// =============================================================================
- private static void InitializeProcess(Process process, TaskCompletionSource completionSource = null, bool redirStdErr = false)
+ private static Task InitializeProcess(Process process, bool redirStdErr = false)
{
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
@@ -157,11 +191,8 @@ namespace com.muldersoft.slunkcrypt.gui.utils
process.StartInfo.RedirectStandardError = true;
process.StartInfo.StandardErrorEncoding = Encoding.UTF8;
}
- if (!ReferenceEquals(completionSource, null))
- {
- process.EnableRaisingEvents = true;
- process.Exited += (sndr, e) => completionSource.TrySetResult(process.ExitCode);
- }
+ process.EnableRaisingEvents = true;
+ return new ProcessExitHandler(process).Task;
}
private async Task DoExecAsnyc(string executablePath, string[] arguments, IReadOnlyDictionary environmentVariables)
@@ -205,15 +236,15 @@ namespace com.muldersoft.slunkcrypt.gui.utils
{
Task readStdOutTask = Task.Run(() => ReadProcessOutput(m_process.StandardOutput, (line) => HandleOutput(line, STDOUT)));
Task readStdErrTask = Task.Run(() => ReadProcessOutput(m_process.StandardError, (line) => HandleOutput(line, STDERR)));
- Task hasExited = m_hasExited.Task;
- await Task.WhenAll(readStdOutTask, readStdErrTask, hasExited);
+ await Task.WhenAll(readStdOutTask, readStdErrTask, m_hasExited);
if (m_aborted || m_disposed)
{
NotifyOutputAvailable("\u2192 Process has been aborted !!!", true);
throw new ProcessInterruptedException("Process has been aborted!");
}
- NotifyOutputAvailable(string.Format("\u2192 Process terminated normally [Exit status: {0:D}]", hasExited.Result), false);
- return hasExited.Result;
+ int processExitCode = m_hasExited.Result;
+ NotifyOutputAvailable(string.Format("\u2192 Process terminated normally [Exit status: {0:D}]", processExitCode), false);
+ return processExitCode;
}
private static async Task WaitForExit(Process process, Task hasExited, TimeSpan timeout)