From 7323dbb009905cde0d35dc6a72acd187908384d5 Mon Sep 17 00:00:00 2001 From: WeeXnes Date: Thu, 5 May 2022 17:31:27 +0200 Subject: [PATCH] added the option to hide the keys visually --- WeeXnes/Core/Globals.cs | 21 +++++++++++++++++++-- WeeXnes/MVVM/View/KeyManagerView.xaml | 6 ++++-- WeeXnes/MVVM/View/KeyManagerView.xaml.cs | 13 +++++++++++++ WeeXnes/MVVM/View/SettingView.xaml | 13 +++++++++++++ WeeXnes/MVVM/View/SettingView.xaml.cs | 15 +++++++++++++++ 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/WeeXnes/Core/Globals.cs b/WeeXnes/Core/Globals.cs index 160322d..58aa651 100644 --- a/WeeXnes/Core/Globals.cs +++ b/WeeXnes/Core/Globals.cs @@ -15,7 +15,7 @@ namespace WeeXnes.Core public static string encryptionKey = "8zf5#RdyQ]$4x4_"; public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes"); public static string SettingsFileName = "settings.ini"; - public static string version = "2.7.8"; + public static string version = "2.7.9"; public static bool info_isRpcRunning = false; public static bool info_RpcAutoStart; public static string apiUrl = "http://www.weexnes.com:5169/"; @@ -27,7 +27,8 @@ namespace WeeXnes.Core public static string settings_KeyManagerItemsPath_Default = AppDataPath + "\\" + "Keys"; public static UpdateVar settings_KeyManagerItemsPath = new UpdateVar(); public static UpdateVar settings_KeyManagerItemsPath_Bool = new UpdateVar(); - + public static UpdateVar settings_KeyManagerCensorKeys = new UpdateVar(); + public static string settings_RpcItemsPath_Default = AppDataPath + "\\" + "RPC"; public static UpdateVar settings_RpcItemsPath = new UpdateVar(); public static UpdateVar settings_RpcItemsPath_Bool = new UpdateVar(); @@ -63,6 +64,7 @@ namespace WeeXnes.Core Globals.settings_copySelectedToClipboard.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "copySelectedToClipboard")); Globals.settings_KeyManagerItemsPath_Bool.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "KeyManagerItemsPath_Bool")); + Globals.settings_KeyManagerCensorKeys.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "CensorKeys")); if (Globals.settings_KeyManagerItemsPath_Bool.Value) { Globals.settings_KeyManagerItemsPath.Value = SettingsFile.GetValue("KeyManager", "KeyManagerItemsPath"); @@ -119,6 +121,21 @@ namespace WeeXnes.Core SettingsFile.SetValue("KeyManager", "KeyManagerItemsPath", ""); } }; + + + Globals.settings_KeyManagerCensorKeys.ValueChanged += () => + { + if (Globals.settings_KeyManagerCensorKeys.Value) + { + SettingsFile.SetValue("KeyManager", "CensorKeys", "true"); + } + else + { + SettingsFile.SetValue("KeyManager", "CensorKeys", "false"); + } + }; + + Globals.settings_RpcItemsPath_Bool.ValueChanged += () => { if (Globals.settings_RpcItemsPath_Bool.Value) diff --git a/WeeXnes/MVVM/View/KeyManagerView.xaml b/WeeXnes/MVVM/View/KeyManagerView.xaml index dfb29a2..8391125 100644 --- a/WeeXnes/MVVM/View/KeyManagerView.xaml +++ b/WeeXnes/MVVM/View/KeyManagerView.xaml @@ -38,9 +38,11 @@ + Grid.Column="0"/> + Grid.Column="1" + Name="monkeman" + Loaded="Monkeman_OnLoaded"/> diff --git a/WeeXnes/MVVM/View/KeyManagerView.xaml.cs b/WeeXnes/MVVM/View/KeyManagerView.xaml.cs index b865406..dd8bc4d 100644 --- a/WeeXnes/MVVM/View/KeyManagerView.xaml.cs +++ b/WeeXnes/MVVM/View/KeyManagerView.xaml.cs @@ -236,6 +236,19 @@ namespace WeeXnes.MVVM.View Console.WriteLine("fnmgikegnmek"); } + + private void Monkeman_OnLoaded(object sender, RoutedEventArgs e) + { + if (Globals.settings_KeyManagerCensorKeys.Value) + { + TextBlock tb = (TextBlock)sender; + int text_size = tb.Text.Length; + string censored_string = ""; + for (int i = 0; i <= text_size; i++) + censored_string = censored_string + "•"; + tb.Text = censored_string; + } + } } public static class SaveInterface { diff --git a/WeeXnes/MVVM/View/SettingView.xaml b/WeeXnes/MVVM/View/SettingView.xaml index c67e6b5..60575b4 100644 --- a/WeeXnes/MVVM/View/SettingView.xaml +++ b/WeeXnes/MVVM/View/SettingView.xaml @@ -169,6 +169,19 @@ FontSize="15" Foreground="White"/> + + +