cleaned variable names

This commit is contained in:
WeeXnes 2022-04-28 22:19:27 +02:00
parent 41aeae17ad
commit fddfd1ce6b
6 changed files with 63 additions and 57 deletions

View file

@ -18,7 +18,7 @@ namespace WeeXnes
if (e.Args[i] == "-autostart") if (e.Args[i] == "-autostart")
{ {
//MessageBox.Show("Launched via autostart"); //MessageBox.Show("Launched via autostart");
Globals.autoStartRpc = true; Globals.info_RpcAutoStart = true;
} }
} }

View file

@ -13,20 +13,27 @@ 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 DefaultKeyListPath = AppDataPath + "\\" + "Keys";
public static string DefaultRpcListPath = AppDataPath + "\\" + "RPC";
public static string KeyListPath = DefaultKeyListPath;
public static string RpcListPath = DefaultRpcListPath;
public static bool KeyCustomPath = false;
public static bool RpcCustomPath = false;
public static string SettingsFileName = "settings.ini"; public static string SettingsFileName = "settings.ini";
public static string version = "2.4"; public static string version = "2.4";
public static bool isRpcRunning = false; public static bool isRpcRunning = false;
public static string defaultRpcClient;
public static bool alwaysOnTop; public static bool settings_alwaysOnTop;
public static bool showElapsedTime;
public static bool copySelectedToClipboard; public static bool settings_copySelectedToClipboard;
public static bool autoStartRpc;
public static string settings_KeyManagerItemsPath_Default = AppDataPath + "\\" + "Keys";
public static bool settings_KeyManagerItemsPath_Bool = false;
public static string settings_KeyManagerItemsPath = settings_KeyManagerItemsPath_Default;
public static string settings_RpcItemsPath_Default = AppDataPath + "\\" + "RPC";
public static string settings_RpcItemsPath = settings_RpcItemsPath_Default;
public static bool settings_RpcItemsPath_Bool = false;
public static bool settings_RpcShowElapsedTime;
public static string settings_RpcDefaultClientID;
public static bool info_RpcAutoStart;
public static UpdateVar<string> searchbox_content = new UpdateVar<string>(); public static UpdateVar<string> searchbox_content = new UpdateVar<string>();

View file

@ -50,9 +50,9 @@ namespace WeeXnes.MVVM.View
private void CheckForAutostart() private void CheckForAutostart()
{ {
if (Globals.autoStartRpc) if (Globals.info_RpcAutoStart)
{ {
Globals.autoStartRpc = false; Globals.info_RpcAutoStart = false;
runBackgroundWorker(); runBackgroundWorker();
} }
@ -150,7 +150,7 @@ namespace WeeXnes.MVVM.View
public void generateNewGame() public void generateNewGame()
{ {
string filename = Guid.NewGuid().ToString() + ".rpc"; string filename = Guid.NewGuid().ToString() + ".rpc";
Game newGame = new Game(filename, generateIncrementalName(), null, Globals.defaultRpcClient); Game newGame = new Game(filename, generateIncrementalName(), null, Globals.settings_RpcDefaultClientID);
saveGameToFile(newGame); saveGameToFile(newGame);
} }
public string generateIncrementalName() public string generateIncrementalName()
@ -161,7 +161,7 @@ namespace WeeXnes.MVVM.View
} }
public void saveGameToFile(Game game) public void saveGameToFile(Game game)
{ {
INIFile rpcFile = new INIFile(Globals.RpcListPath + "\\" + game.fileName, true); INIFile rpcFile = new INIFile(Globals.settings_RpcItemsPath + "\\" + game.fileName, true);
rpcFile.SetValue("config", "name", game.Name); rpcFile.SetValue("config", "name", game.Name);
rpcFile.SetValue("config", "pname", game.ProcessName); rpcFile.SetValue("config", "pname", game.ProcessName);
rpcFile.SetValue("config", "id", game.id); rpcFile.SetValue("config", "id", game.id);
@ -177,7 +177,7 @@ namespace WeeXnes.MVVM.View
{ {
try try
{ {
File.Delete(Globals.RpcListPath + "\\" + game.fileName); File.Delete(Globals.settings_RpcItemsPath + "\\" + game.fileName);
} }
catch (Exception e) catch (Exception e)
{ {
@ -187,12 +187,12 @@ namespace WeeXnes.MVVM.View
} }
public void readRpcFileDirectory() public void readRpcFileDirectory()
{ {
bool Empty = funcs.IsDirectoryEmpty(Globals.RpcListPath); bool Empty = funcs.IsDirectoryEmpty(Globals.settings_RpcItemsPath);
List<Game> readGames = new List<Game>(); List<Game> readGames = new List<Game>();
if (!Empty) if (!Empty)
{ {
Console.WriteLine("RpcDir is not Empty, Reading content"); Console.WriteLine("RpcDir is not Empty, Reading content");
string[] files = Directory.GetFiles(Globals.RpcListPath, "*.rpc", SearchOption.AllDirectories); string[] files = Directory.GetFiles(Globals.settings_RpcItemsPath, "*.rpc", SearchOption.AllDirectories);
foreach (string file in files) foreach (string file in files)
{ {
INIFile rpcFile = new INIFile(file); INIFile rpcFile = new INIFile(file);

View file

@ -85,7 +85,7 @@ namespace WeeXnes.MVVM.View
{ {
KeyItem newkey = new KeyItem(Textbox_Name.Text, Textbox_Value.Text); KeyItem newkey = new KeyItem(Textbox_Name.Text, Textbox_Value.Text);
KeyManagerLib.KeyList.Add(newkey); KeyManagerLib.KeyList.Add(newkey);
string filename = Globals.KeyListPath + "\\" + Guid.NewGuid().ToString() + ".wx"; string filename = Globals.settings_KeyManagerItemsPath + "\\" + Guid.NewGuid().ToString() + ".wx";
string[] filecontent = new string[] { "##WXfile##", newkey.name, EncryptionLib.EncryptorLibary.encrypt(Globals.encryptionKey, newkey.value) }; string[] filecontent = new string[] { "##WXfile##", newkey.name, EncryptionLib.EncryptorLibary.encrypt(Globals.encryptionKey, newkey.value) };
/* /*
INIFile newini = new INIFile(filename, true); INIFile newini = new INIFile(filename, true);
@ -119,9 +119,9 @@ namespace WeeXnes.MVVM.View
{ {
KeyManagerLib.KeyList.Clear(); KeyManagerLib.KeyList.Clear();
CheckForFolders(); CheckForFolders();
if (!SaveInterface.IsDirectoryEmpty(Globals.KeyListPath)) if (!SaveInterface.IsDirectoryEmpty(Globals.settings_KeyManagerItemsPath))
{ {
string[] files = SaveInterface.GetFilesInDir(Globals.KeyListPath); string[] files = SaveInterface.GetFilesInDir(Globals.settings_KeyManagerItemsPath);
foreach (string file in files) foreach (string file in files)
{ {
Console.WriteLine(file); Console.WriteLine(file);
@ -154,10 +154,10 @@ namespace WeeXnes.MVVM.View
Directory.CreateDirectory(Globals.AppDataPath); Directory.CreateDirectory(Globals.AppDataPath);
Console.WriteLine("Created AppDataPath"); Console.WriteLine("Created AppDataPath");
} }
if (!Directory.Exists(Globals.KeyListPath)) if (!Directory.Exists(Globals.settings_KeyManagerItemsPath))
{ {
Directory.CreateDirectory(Globals.KeyListPath); Directory.CreateDirectory(Globals.settings_KeyManagerItemsPath);
Console.WriteLine("Created KeyListPath"); Console.WriteLine("Created settings_KeyManagerItemsPath");
} }
} }
@ -186,7 +186,7 @@ namespace WeeXnes.MVVM.View
if(selectedItem != null) if(selectedItem != null)
{ {
Console.WriteLine(selectedItem.name + ": " + selectedItem.value); Console.WriteLine(selectedItem.name + ": " + selectedItem.value);
if (Globals.copySelectedToClipboard) if (Globals.settings_copySelectedToClipboard)
{ {
Clipboard.SetText(selectedItem.value); Clipboard.SetText(selectedItem.value);
} }
@ -199,7 +199,7 @@ namespace WeeXnes.MVVM.View
KeyItem selectedItem = (KeyItem)KeyListView.SelectedItem; KeyItem selectedItem = (KeyItem)KeyListView.SelectedItem;
Console.WriteLine("Doubleclicked " + selectedItem.name); Console.WriteLine("Doubleclicked " + selectedItem.name);
KeyManagerLib.KeyList.Remove(selectedItem); KeyManagerLib.KeyList.Remove(selectedItem);
string[] files = SaveInterface.GetFilesInDir(Globals.KeyListPath); string[] files = SaveInterface.GetFilesInDir(Globals.settings_KeyManagerItemsPath);
foreach (string file in files) foreach (string file in files)
{ {
Console.WriteLine(file); Console.WriteLine(file);

View file

@ -48,16 +48,16 @@ namespace WeeXnes.MVVM.View
private void LoadUiFromSettingsFile() private void LoadUiFromSettingsFile()
{ {
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true); INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName, true);
if (Globals.alwaysOnTop) if (Globals.settings_alwaysOnTop)
{ {
AlwaysOnTopSwitch.IsChecked = true; AlwaysOnTopSwitch.IsChecked = true;
} }
if (Globals.showElapsedTime) if (Globals.settings_RpcShowElapsedTime)
{ {
ShowElapsedTimeOnRpc.IsChecked = true; ShowElapsedTimeOnRpc.IsChecked = true;
} }
if (Globals.copySelectedToClipboard) if (Globals.settings_copySelectedToClipboard)
{ {
ItemToClipboardSwitch.IsChecked = true; ItemToClipboardSwitch.IsChecked = true;
} }
@ -68,7 +68,7 @@ namespace WeeXnes.MVVM.View
} }
tb_DefaultClientID.Text = Globals.defaultRpcClient; tb_DefaultClientID.Text = Globals.settings_RpcDefaultClientID;
} }
public static void CheckSetting() public static void CheckSetting()
{ {
@ -87,40 +87,40 @@ namespace WeeXnes.MVVM.View
{ {
INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName); INIFile SettingsFile = new INIFile(Globals.AppDataPath + "\\" + Globals.SettingsFileName);
Globals.alwaysOnTop = Convert.ToBoolean(SettingsFile.GetValue("General", "AlwaysOnTop")); Globals.settings_alwaysOnTop = Convert.ToBoolean(SettingsFile.GetValue("General", "AlwaysOnTop"));
Console.WriteLine(Globals.alwaysOnTop); Console.WriteLine(Globals.settings_alwaysOnTop);
Globals.showElapsedTime = Convert.ToBoolean(SettingsFile.GetValue("RPC", "showElapsedTime")); Globals.settings_RpcShowElapsedTime = Convert.ToBoolean(SettingsFile.GetValue("RPC", "showElapsedTime"));
Console.WriteLine(Globals.showElapsedTime); Console.WriteLine(Globals.settings_RpcShowElapsedTime);
Globals.copySelectedToClipboard = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "copyToClipboard")); Globals.settings_copySelectedToClipboard = Convert.ToBoolean(SettingsFile.GetValue("KeyManager", "copyToClipboard"));
Console.WriteLine(Globals.copySelectedToClipboard); Console.WriteLine(Globals.settings_copySelectedToClipboard);
Globals.defaultRpcClient = SettingsFile.GetValue("RPC", "defaultID"); Globals.settings_RpcDefaultClientID = SettingsFile.GetValue("RPC", "defaultID");
Console.WriteLine(Globals.defaultRpcClient); Console.WriteLine(Globals.settings_RpcDefaultClientID);
Globals.alwaysOnTop = Convert.ToBoolean(SettingsFile.GetValue("General", "AlwaysOnTop")); Globals.settings_alwaysOnTop = Convert.ToBoolean(SettingsFile.GetValue("General", "AlwaysOnTop"));
Globals.KeyCustomPath = Convert.ToBoolean(SettingsFile.GetValue("KeyFiles", "CustomKeyLocation")); Globals.settings_KeyManagerItemsPath_Bool = Convert.ToBoolean(SettingsFile.GetValue("KeyFiles", "CustomKeyLocation"));
if (Globals.KeyCustomPath) if (Globals.settings_KeyManagerItemsPath_Bool)
{ {
Globals.KeyListPath = SettingsFile.GetValue("KeyFiles", "KeyPath"); Globals.settings_KeyManagerItemsPath = SettingsFile.GetValue("KeyFiles", "KeyPath");
} }
else else
{ {
Globals.KeyListPath = Globals.DefaultKeyListPath; Globals.settings_KeyManagerItemsPath = Globals.settings_KeyManagerItemsPath_Default;
} }
Globals.RpcCustomPath = Convert.ToBoolean(SettingsFile.GetValue("rpc", "CustomRpcLocation")); Globals.settings_RpcItemsPath_Bool = Convert.ToBoolean(SettingsFile.GetValue("rpc", "CustomRpcLocation"));
if (Globals.RpcCustomPath) if (Globals.settings_RpcItemsPath_Bool)
{ {
Globals.RpcListPath = SettingsFile.GetValue("rpc", "RpcPath"); Globals.settings_RpcItemsPath = SettingsFile.GetValue("rpc", "RpcPath");
} }
else else
{ {
Globals.RpcListPath = Globals.DefaultRpcListPath; Globals.settings_RpcItemsPath = Globals.settings_RpcItemsPath_Default;
} }
} }
@ -255,8 +255,8 @@ namespace WeeXnes.MVVM.View
private void UpdatePathsOnUi() private void UpdatePathsOnUi()
{ {
RpcPathLabel.Content = Globals.RpcListPath; RpcPathLabel.Content = Globals.settings_RpcItemsPath;
KeyPathLabel.Content = Globals.KeyListPath; KeyPathLabel.Content = Globals.settings_KeyManagerItemsPath;
} }
private void SetKeyLocationDefault_OnClick(object sender, RoutedEventArgs e) private void SetKeyLocationDefault_OnClick(object sender, RoutedEventArgs e)

View file

@ -7,7 +7,6 @@ using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using WeeXnes.Core; using WeeXnes.Core;
using WeeXnes.MVVM.View; using WeeXnes.MVVM.View;
using Nocksoft.IO.ConfigFiles;
namespace WeeXnes namespace WeeXnes
{ {
@ -73,7 +72,7 @@ namespace WeeXnes
{ {
HomeMenuButton.Command.Execute(null); HomeMenuButton.Command.Execute(null);
HomeMenuButton.IsChecked = true; HomeMenuButton.IsChecked = true;
Globals.autoStartRpc = true; Globals.info_RpcAutoStart = true;
RpcMenuButton.Command.Execute(null); RpcMenuButton.Command.Execute(null);
RpcMenuButton.IsChecked = true; RpcMenuButton.IsChecked = true;
} }
@ -125,7 +124,7 @@ namespace WeeXnes
private void CheckForAutoStartup() private void CheckForAutoStartup()
{ {
if (Globals.autoStartRpc) if (Globals.info_RpcAutoStart)
{ {
WindowState = WindowState.Minimized; WindowState = WindowState.Minimized;
RpcMenuButton.Command.Execute(null); RpcMenuButton.Command.Execute(null);
@ -140,17 +139,17 @@ namespace WeeXnes
Directory.CreateDirectory(Globals.AppDataPath); Directory.CreateDirectory(Globals.AppDataPath);
Console.WriteLine("Created AppDataPath"); Console.WriteLine("Created AppDataPath");
} }
if (!Directory.Exists(Globals.RpcListPath)) if (!Directory.Exists(Globals.settings_RpcItemsPath))
{ {
Directory.CreateDirectory(Globals.RpcListPath); Directory.CreateDirectory(Globals.settings_RpcItemsPath);
Console.WriteLine("Created RpcListPath"); Console.WriteLine("Created settings_RpcItemsPath");
} }
} }
private void Window_Deactivated(object sender, EventArgs e) private void Window_Deactivated(object sender, EventArgs e)
{ {
Window window = (Window)sender; Window window = (Window)sender;
if (Globals.alwaysOnTop) if (Globals.settings_alwaysOnTop)
{ {
window.Topmost = true; window.Topmost = true;
} }