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")
{
//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 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 version = "2.4";
public static bool isRpcRunning = false;
public static string defaultRpcClient;
public static bool alwaysOnTop;
public static bool showElapsedTime;
public static bool copySelectedToClipboard;
public static bool autoStartRpc;
public static bool settings_alwaysOnTop;
public static bool settings_copySelectedToClipboard;
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>();

View file

@ -50,9 +50,9 @@ namespace WeeXnes.MVVM.View
private void CheckForAutostart()
{
if (Globals.autoStartRpc)
if (Globals.info_RpcAutoStart)
{
Globals.autoStartRpc = false;
Globals.info_RpcAutoStart = false;
runBackgroundWorker();
}
@ -150,7 +150,7 @@ namespace WeeXnes.MVVM.View
public void generateNewGame()
{
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);
}
public string generateIncrementalName()
@ -161,7 +161,7 @@ namespace WeeXnes.MVVM.View
}
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", "pname", game.ProcessName);
rpcFile.SetValue("config", "id", game.id);
@ -177,7 +177,7 @@ namespace WeeXnes.MVVM.View
{
try
{
File.Delete(Globals.RpcListPath + "\\" + game.fileName);
File.Delete(Globals.settings_RpcItemsPath + "\\" + game.fileName);
}
catch (Exception e)
{
@ -187,12 +187,12 @@ namespace WeeXnes.MVVM.View
}
public void readRpcFileDirectory()
{
bool Empty = funcs.IsDirectoryEmpty(Globals.RpcListPath);
bool Empty = funcs.IsDirectoryEmpty(Globals.settings_RpcItemsPath);
List<Game> readGames = new List<Game>();
if (!Empty)
{
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)
{
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);
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) };
/*
INIFile newini = new INIFile(filename, true);
@ -119,9 +119,9 @@ namespace WeeXnes.MVVM.View
{
KeyManagerLib.KeyList.Clear();
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)
{
Console.WriteLine(file);
@ -154,10 +154,10 @@ namespace WeeXnes.MVVM.View
Directory.CreateDirectory(Globals.AppDataPath);
Console.WriteLine("Created AppDataPath");
}
if (!Directory.Exists(Globals.KeyListPath))
if (!Directory.Exists(Globals.settings_KeyManagerItemsPath))
{
Directory.CreateDirectory(Globals.KeyListPath);
Console.WriteLine("Created KeyListPath");
Directory.CreateDirectory(Globals.settings_KeyManagerItemsPath);
Console.WriteLine("Created settings_KeyManagerItemsPath");
}
}
@ -186,7 +186,7 @@ namespace WeeXnes.MVVM.View
if(selectedItem != null)
{
Console.WriteLine(selectedItem.name + ": " + selectedItem.value);
if (Globals.copySelectedToClipboard)
if (Globals.settings_copySelectedToClipboard)
{
Clipboard.SetText(selectedItem.value);
}
@ -199,7 +199,7 @@ namespace WeeXnes.MVVM.View
KeyItem selectedItem = (KeyItem)KeyListView.SelectedItem;
Console.WriteLine("Doubleclicked " + selectedItem.name);
KeyManagerLib.KeyList.Remove(selectedItem);
string[] files = SaveInterface.GetFilesInDir(Globals.KeyListPath);
string[] files = SaveInterface.GetFilesInDir(Globals.settings_KeyManagerItemsPath);
foreach (string file in files)
{
Console.WriteLine(file);

View file

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

View file

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