added the option to hide the keys visually

This commit is contained in:
WeeXnes 2022-05-05 17:31:27 +02:00
parent 97b0b9e071
commit 7323dbb009
5 changed files with 64 additions and 4 deletions

View file

@ -15,7 +15,7 @@ namespace WeeXnes.Core
public static string encryptionKey = "8zf5#RdyQ]$4x4_"; public static string encryptionKey = "8zf5#RdyQ]$4x4_";
public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes"); public static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WeeXnes");
public static string SettingsFileName = "settings.ini"; 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_isRpcRunning = false;
public static bool info_RpcAutoStart; public static bool info_RpcAutoStart;
public static string apiUrl = "http://www.weexnes.com:5169/"; 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 string settings_KeyManagerItemsPath_Default = AppDataPath + "\\" + "Keys";
public static UpdateVar<string> settings_KeyManagerItemsPath = new UpdateVar<string>(); public static UpdateVar<string> settings_KeyManagerItemsPath = new UpdateVar<string>();
public static UpdateVar<bool> settings_KeyManagerItemsPath_Bool = new UpdateVar<bool>(); public static UpdateVar<bool> settings_KeyManagerItemsPath_Bool = new UpdateVar<bool>();
public static UpdateVar<bool> settings_KeyManagerCensorKeys = new UpdateVar<bool>();
public static string settings_RpcItemsPath_Default = AppDataPath + "\\" + "RPC"; public static string settings_RpcItemsPath_Default = AppDataPath + "\\" + "RPC";
public static UpdateVar<string> settings_RpcItemsPath = new UpdateVar<string>(); public static UpdateVar<string> settings_RpcItemsPath = new UpdateVar<string>();
public static UpdateVar<bool> settings_RpcItemsPath_Bool = new UpdateVar<bool>(); public static UpdateVar<bool> settings_RpcItemsPath_Bool = new UpdateVar<bool>();
@ -63,6 +64,7 @@ namespace WeeXnes.Core
Globals.settings_copySelectedToClipboard.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "copySelectedToClipboard")); Globals.settings_copySelectedToClipboard.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "copySelectedToClipboard"));
Globals.settings_KeyManagerItemsPath_Bool.Value = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "KeyManagerItemsPath_Bool")); 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) if (Globals.settings_KeyManagerItemsPath_Bool.Value)
{ {
Globals.settings_KeyManagerItemsPath.Value = SettingsFile.GetValue("KeyManager", "KeyManagerItemsPath"); Globals.settings_KeyManagerItemsPath.Value = SettingsFile.GetValue("KeyManager", "KeyManagerItemsPath");
@ -119,6 +121,21 @@ namespace WeeXnes.Core
SettingsFile.SetValue("KeyManager", "KeyManagerItemsPath", ""); 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 += () => Globals.settings_RpcItemsPath_Bool.ValueChanged += () =>
{ {
if (Globals.settings_RpcItemsPath_Bool.Value) if (Globals.settings_RpcItemsPath_Bool.Value)

View file

@ -38,9 +38,11 @@
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="{Binding name}" <TextBlock Text="{Binding name}"
Grid.Column="0"/> Grid.Column="0"/>
<TextBlock Text="{Binding value}" <TextBlock Text="{Binding value}"
Grid.Column="1"/> Grid.Column="1"
Name="monkeman"
Loaded="Monkeman_OnLoaded"/>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>

View file

@ -236,6 +236,19 @@ namespace WeeXnes.MVVM.View
Console.WriteLine("fnmgikegnmek"); 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 public static class SaveInterface
{ {

View file

@ -169,6 +169,19 @@
FontSize="15" FontSize="15"
Foreground="White"/> Foreground="White"/>
</CheckBox> </CheckBox>
<CheckBox VerticalAlignment="Top"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center"
Name="CensorKeysSwitch"
Checked="CensorKeysSwitch_OnChecked"
Unchecked="CensorKeysSwitch_OnUnchecked"
Margin="10,10,0,0">
<TextBlock
Text="Censor Keys Visually"
VerticalAlignment="Center"
FontSize="15"
Foreground="White"/>
</CheckBox>
<Label Content="Placeholder" HorizontalAlignment="Center" <Label Content="Placeholder" HorizontalAlignment="Center"
FontSize="8" FontSize="8"
Foreground="White" Foreground="White"

View file

@ -81,6 +81,11 @@ namespace WeeXnes.MVVM.View
{ {
ItemToClipboardSwitch.IsChecked = true; ItemToClipboardSwitch.IsChecked = true;
} }
if (Globals.settings_KeyManagerCensorKeys.Value)
{
CensorKeysSwitch.IsChecked = true;
}
tb_DefaultClientID.Text = Globals.settings_RpcDefaultClientID.Value; tb_DefaultClientID.Text = Globals.settings_RpcDefaultClientID.Value;
} }
@ -311,5 +316,15 @@ namespace WeeXnes.MVVM.View
message.Show(); message.Show();
} }
} }
private void CensorKeysSwitch_OnChecked(object sender, RoutedEventArgs e)
{
Globals.settings_KeyManagerCensorKeys.Value = true;
}
private void CensorKeysSwitch_OnUnchecked(object sender, RoutedEventArgs e)
{
Globals.settings_KeyManagerCensorKeys.Value = false;
}
} }
} }