fixing shit part 1

This commit is contained in:
Bitl 2022-09-12 14:26:34 -07:00
parent 87823a1578
commit 79a903e6ce
10 changed files with 87 additions and 86 deletions

View File

@ -15,8 +15,8 @@ namespace Novetus.Bootstrapper
{
public static void LaunchApplicationExt(string filePath, string appName, string args = "")
{
GlobalFuncs.Config(LocalPaths.ConfigPath, true);
GlobalFuncs.LogPrint("Starting " + appName);
FileManagement.Config(LocalPaths.ConfigPath, true);
Util.LogPrint("Starting " + appName);
try
{
Process client = new Process();
@ -31,7 +31,7 @@ namespace Novetus.Bootstrapper
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
MessageBox.Show("Failed to launch Novetus. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

View File

@ -15,7 +15,7 @@ namespace Novetus.Bootstrapper
private void NovetusLaunchForm_Load(object sender, EventArgs e)
{
GlobalFuncs.ReadInfoFile(LocalPaths.InfoPath, true, LocalPaths.LauncherPath);
FileManagement.ReadInfoFile(LocalPaths.InfoPath, true, LocalPaths.LauncherPath);
ReadConfigValues(LocalPaths.ConfigPath);
if (GlobalVars.UserConfiguration.BootstrapperShowUI)
@ -53,7 +53,7 @@ namespace Novetus.Bootstrapper
void ReadConfigValues(string cfgpath)
{
GlobalFuncs.Config(cfgpath, false);
FileManagement.Config(cfgpath, false);
LauncherBox.Checked = !GlobalVars.UserConfiguration.BootstrapperShowUI;
}

View File

@ -47,9 +47,9 @@ class CharacterCustomizationShared
#region Form Event Functions
public void InitForm()
{
if (GlobalFuncs.HasColorsChanged())
if (FileManagement.HasColorsChanged())
{
GlobalVars.ColorsLoaded = GlobalFuncs.InitColors();
GlobalVars.ColorsLoaded = FileManagement.InitColors();
closeOnLaunch = !GlobalVars.ColorsLoaded;
}
@ -167,21 +167,21 @@ class CharacterCustomizationShared
if (File.Exists(backgroundImage))
{
Image im = GlobalFuncs.LoadImage(backgroundImage);
Image im = Util.LoadImage(backgroundImage);
CharBackground.Image = im;
}
}
//discord
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InCustomization);
ClientManagement.UpdateRichPresence(GlobalVars.LauncherState.InCustomization);
GlobalFuncs.ReloadLoadoutValue();
FileManagement.ReloadLoadoutValue();
}
public void CloseEvent()
{
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
GlobalFuncs.ReloadLoadoutValue();
ClientManagement.UpdateRichPresence(ClientManagement.GetStateForType(GlobalVars.GameOpened));
FileManagement.ReloadLoadoutValue();
SaveOutfit(false);
}
@ -579,7 +579,7 @@ class CharacterCustomizationShared
{
MessageBox.Show("Failed to load required colors for the preset.", "Novetus - Preset Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
ResetColors();
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
}
}
@ -644,7 +644,7 @@ class CharacterCustomizationShared
public void SaveOutfit(bool box = true)
{
GlobalFuncs.Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true);
FileManagement.Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true);
if (box)
{
MessageBox.Show("Outfit Saved!", "Novetus - Outfit Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
@ -661,7 +661,7 @@ class CharacterCustomizationShared
ofd.Title = "Load config_customization.ini";
if (ofd.ShowDialog() == DialogResult.OK)
{
GlobalFuncs.Customization(ofd.FileName, false);
FileManagement.Customization(ofd.FileName, false);
ReloadColors();
MessageBox.Show("Outfit Loaded!", "Novetus - Outfit Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
@ -709,7 +709,7 @@ class CharacterCustomizationShared
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
box.SelectedItem = defaultitem + ".rbxm";
}
@ -732,7 +732,7 @@ class CharacterCustomizationShared
}
else
{
outputImage.Image = GlobalFuncs.LoadImage(itemdir + @"\\" + item.Replace(".rbxm", "") + ".png", itemdir + @"\\" + defaultitem + ".png");
outputImage.Image = Util.LoadImage(itemdir + @"\\" + item.Replace(".rbxm", "") + ".png", itemdir + @"\\" + defaultitem + ".png");
}
}
@ -747,24 +747,24 @@ class CharacterCustomizationShared
public Image GetItemURLImageFromProvider(Provider provider)
{
if (provider != null)
return GlobalFuncs.LoadImage(GlobalPaths.CustomPlayerDir + @"\\" + provider.Icon, GlobalPaths.extradir + @"\\NoExtra.png");
return Util.LoadImage(GlobalPaths.CustomPlayerDir + @"\\" + provider.Icon, GlobalPaths.extradir + @"\\NoExtra.png");
return GlobalFuncs.LoadImage(GlobalPaths.extradir + @"\\NoExtra.png");
return Util.LoadImage(GlobalPaths.extradir + @"\\NoExtra.png");
}
//we launch the 3dview seperately from normal clients.
public void Launch3DView()
{
GlobalFuncs.ReloadLoadoutValue();
FileManagement.ReloadLoadoutValue();
SaveOutfit(false);
//HACK!
try
{
GlobalFuncs.ChangeGameSettings("2011E");
ClientManagement.ChangeGameSettings("2011E");
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
}
string luafile = "rbxasset://scripts\\\\CSView.lua";
@ -787,12 +787,12 @@ class CharacterCustomizationShared
try
{
GlobalFuncs.OpenClient(ScriptType.None, rbxexe, args, "", "", null, true);
ClientManagement.OpenClient(ScriptType.None, rbxexe, args, "", "", null, true);
}
catch (Exception ex)
{
MessageBox.Show("Failed to launch the 3D Preview. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
}
}
@ -805,7 +805,7 @@ class CharacterCustomizationShared
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
}
if (!string.IsNullOrWhiteSpace(icon.getInstallOutcome()))
@ -825,7 +825,7 @@ class CharacterCustomizationShared
public void LoadLocalIcon()
{
Image icon1 = GlobalFuncs.LoadImage(GlobalPaths.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png", GlobalPaths.extradir + "\\NoExtra.png");
Image icon1 = Util.LoadImage(GlobalPaths.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png", GlobalPaths.extradir + "\\NoExtra.png");
IconImage.Image = icon1;
}
@ -861,9 +861,9 @@ class CharacterCustomizationShared
}
catch (Exception ex)
{
Image icon1 = GlobalFuncs.LoadImage(GlobalPaths.extradir + "\\NoExtra.png", GlobalPaths.extradir + "\\NoExtra.png");
Image icon1 = Util.LoadImage(GlobalPaths.extradir + "\\NoExtra.png", GlobalPaths.extradir + "\\NoExtra.png");
IconImage.Image = icon1;
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
}
}
#endregion

View File

@ -103,7 +103,7 @@ class Downloader
#if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
#else
catch (Exception)
{
@ -117,7 +117,7 @@ class Downloader
if (File.Exists(name) && read > 0)
{
downloadSize = read;
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + GlobalFuncs.SizeSuffix(Convert.ToInt64(downloadSize), 2) + " written (" + downloadSize + " bytes)! " + additionalText;
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + Util.SizeSuffix(Convert.ToInt64(downloadSize), 2) + " written (" + downloadSize + " bytes)! " + additionalText;
}
else
{
@ -212,7 +212,7 @@ class Downloader
catch (Exception e)
{
#if URI || LAUNCHER || CMD || BASICLAUNCHER
GlobalFuncs.LogExceptions(e);
Util.LogExceptions(e);
#endif
if (e is WebException && bytesProcessed == 0)
{

View File

@ -87,7 +87,7 @@ public class INIFile
#if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
#else
catch (Exception)
{

View File

@ -9,6 +9,7 @@ using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using System.Security.Cryptography;
using System.Reflection;
#endregion
#region Client Management
@ -53,9 +54,9 @@ public class ClientManagement
try
{
#if LAUNCHER
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available. Novetus will attempt to generate one.", 2, box);
Util.ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available. Novetus will attempt to generate one.", 2, box);
#elif CMD
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available. Novetus will attempt to generate one.", 2);
Util.ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available. Novetus will attempt to generate one.", 2);
#endif
GenerateDefaultClientInfo(Path.GetDirectoryName(clientpath));
@ -75,11 +76,11 @@ public class ClientManagement
#endif
#if LAUNCHER
ConsolePrint("ERROR - Failed to generate default clientinfo.nov. Info: " + ex.Message, 2, box);
ConsolePrint("Loading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", 4, box);
Util.ConsolePrint("ERROR - Failed to generate default clientinfo.nov. Info: " + ex.Message, 2, box);
Util.ConsolePrint("Loading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", 4, box);
#elif CMD
ConsolePrint("ERROR - Failed to generate default clientinfo.nov. Info: " + ex.Message, 2);
ConsolePrint("Loading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", 4);
Util.ConsolePrint("ERROR - Failed to generate default clientinfo.nov. Info: " + ex.Message, 2);
Util.ConsolePrint("Loading default client '" + GlobalVars.ProgramInformation.DefaultClient + "'", 4);
#endif
name = GlobalVars.ProgramInformation.DefaultClient;
#if LAUNCHER
@ -96,9 +97,9 @@ public class ClientManagement
if (initial)
{
#if LAUNCHER
ConsolePrint("Client '" + name + "' successfully loaded.", 3, box);
Util.ConsolePrint("Client '" + name + "' successfully loaded.", 3, box);
#elif CMD
ConsolePrint("Client '" + name + "' successfully loaded.", 3);
Util.ConsolePrint("Client '" + name + "' successfully loaded.", 3);
#endif
}
}
@ -1055,10 +1056,10 @@ public class ClientManagement
#if LAUNCHER
if (box != null)
{
ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2, box);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2, box);
}
#elif CMD
ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2);
#endif
#if LAUNCHER
@ -1076,7 +1077,7 @@ public class ClientManagement
#if LAUNCHER
MessageBox.Show(hostingTips, "Novetus - Hosting Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
#elif CMD
ConsolePrint(hostingTips + "\nPress any key to continue...", 4);
Util.ConsolePrint(hostingTips + "\nPress any key to continue...", 4);
Console.ReadKey();
#endif
GlobalVars.UserConfiguration.FirstServerLaunch = false;
@ -1095,10 +1096,10 @@ public class ClientManagement
#if LAUNCHER
if (box != null)
{
ConsolePrint("ERROR - Failed to launch Novetus. (A game is already running.)", 2, box);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (A game is already running.)", 2, box);
}
#elif CMD
ConsolePrint("ERROR - Failed to launch Novetus. (A game is already running.)", 2);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (A game is already running.)", 2);
#endif
#if LAUNCHER
@ -1150,12 +1151,12 @@ public class ClientManagement
#if URI
UpdateStatus(label, "The client has been detected as modified.");
#elif LAUNCHER
if (box != null)
{
ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2, box);
}
if (box != null)
{
Util.ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2, box);
}
#elif CMD
ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2);
#endif
#if LAUNCHER
@ -1229,10 +1230,9 @@ public class ClientManagement
try
{
#if LAUNCHER
ConsolePrint("Client Loaded.", 4, box);
Util.ConsolePrint("Client Loaded.", 4, box);
#elif CMD
ConsolePrint("Client Loaded.", 4);
#elif URI
Util.ConsolePrint("Client Loaded.", 4);
#endif
if (type.Equals(ScriptType.Client))
@ -1252,10 +1252,10 @@ public class ClientManagement
#elif LAUNCHER
if (box != null)
{
ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2, box);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2, box);
}
#elif CMD
ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2);
#endif
#if LAUNCHER
@ -1296,9 +1296,9 @@ public class ClientManagement
break;
case ScriptType.Server:
#if LAUNCHER
PingMasterServer(true, "Server will now display on the defined master server.", box);
NovetusFuncs.PingMasterServer(true, "Server will now display on the defined master server.", box);
#elif CMD
PingMasterServer(true, "Server will now display on the defined master server.");
NovetusFuncs.PingMasterServer(true, "Server will now display on the defined master server.");
#endif
goto default;
default:
@ -1319,10 +1319,10 @@ public class ClientManagement
#elif LAUNCHER
if (box != null)
{
ConsolePrint("ERROR - Failed to launch Novetus. (Error: " + ex.Message + ")", 2, box);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (Error: " + ex.Message + ")", 2, box);
}
#elif CMD
ConsolePrint("ERROR - Failed to launch Novetus. (Error: " + ex.Message + ")", 2);
Util.ConsolePrint("ERROR - Failed to launch Novetus. (Error: " + ex.Message + ")", 2);
#endif
#if URI || LAUNCHER
@ -1364,7 +1364,7 @@ public class ClientManagement
#if CMD
GlobalVars.ProcessID = client.Id;
CreateTXT();
NovetusFuncs.CreateTXT();
#endif
}

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using System.Linq;
using System.Windows.Forms;
#endregion
#region Novetus Functions
@ -152,9 +153,9 @@ public class NovetusFuncs
}
#if LAUNCHER
ConsolePrint("Pinging master server. " + reason, 4, box);
Util.ConsolePrint("Pinging master server. " + reason, 4, box);
#elif CMD
ConsolePrint("Pinging master server. " + reason, 4);
Util.ConsolePrint("Pinging master server. " + reason, 4);
#endif
#if LAUNCHER
@ -175,9 +176,9 @@ public class NovetusFuncs
if (!string.IsNullOrWhiteSpace(response))
{
#if LAUNCHER
ConsolePrint(response, response.Contains("ERROR:") ? 2 : 4, box);
Util.ConsolePrint(response, response.Contains("ERROR:") ? 2 : 4, box);
#elif CMD
ConsolePrint(response, response.Contains("ERROR:") ? 2 : 4);
Util.ConsolePrint(response, response.Contains("ERROR:") ? 2 : 4);
#endif
if (response.Contains("ERROR:"))
@ -189,9 +190,9 @@ public class NovetusFuncs
if (!GlobalVars.ServerID.Equals("N/A"))
{
#if LAUNCHER
ConsolePrint("Your server's ID is " + GlobalVars.ServerID, 4, box);
Util.ConsolePrint("Your server's ID is " + GlobalVars.ServerID, 4, box);
#elif CMD
ConsolePrint("Your server's ID is " + GlobalVars.ServerID, 4);
Util.ConsolePrint("Your server's ID is " + GlobalVars.ServerID, 4);
#endif
}
@ -235,7 +236,7 @@ public class NovetusFuncs
string txt = GlobalPaths.BasePath + "\\" + GlobalVars.ServerInfoFileName;
File.WriteAllLines(txt, text);
ConsolePrint("Server Information sent to file " + txt, 4);
Util.ConsolePrint("Server Information sent to file " + txt, 4);
}
}
#endif

View File

@ -54,7 +54,7 @@ namespace NovetusURI
handlers.requestCallback += RequestCallback;
DiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, "");
GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.LoadingURI, true);
ClientManagement.UpdateRichPresence(GlobalVars.LauncherState.LoadingURI, true);
}
}
#endregion
@ -69,18 +69,18 @@ namespace NovetusURI
#region Form Events
void LoaderFormLoad(object sender, EventArgs e)
{
GlobalFuncs.UpdateStatus(label1, "Initializing...");
ClientManagement.UpdateStatus(label1, "Initializing...");
if (GlobalVars.UserConfiguration.URIQuickConfigure)
{
GlobalFuncs.UpdateStatus(label1, "Loading Player Configuration Menu....");
ClientManagement.UpdateStatus(label1, "Loading Player Configuration Menu....");
QuickConfigure main = new QuickConfigure();
main.ShowDialog();
}
else
{
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
GlobalFuncs.ReadClientValues();
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
ClientManagement.ReadClientValues();
LocalVars.ReadyToLaunch = true;
}
@ -91,12 +91,12 @@ namespace NovetusURI
{
try
{
GlobalFuncs.LaunchRBXClient(ScriptType.Client, false, true, new EventHandler(ClientExited), label1);
ClientManagement.LaunchRBXClient(ScriptType.Client, false, true, new EventHandler(ClientExited), label1);
Visible = false;
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
Util.LogExceptions(ex);
Close();
}
}
@ -107,7 +107,7 @@ namespace NovetusURI
{
GlobalVars.GameOpened = ScriptType.None;
}
GlobalFuncs.UpdateRichPresence(GlobalFuncs.GetStateForType(GlobalVars.GameOpened));
ClientManagement.UpdateRichPresence(ClientManagement.GetStateForType(GlobalVars.GameOpened));
Close();
}
@ -119,15 +119,15 @@ namespace NovetusURI
}
else
{
GlobalFuncs.UpdateStatus(label1, "Ready to launch.");
ClientManagement.UpdateStatus(label1, "Ready to launch.");
Visible = true;
CenterToScreen();
if (GlobalVars.UserConfiguration.DiscordPresence)
{
GlobalFuncs.UpdateStatus(label1, "Starting Discord Rich Presence...");
ClientManagement.UpdateStatus(label1, "Starting Discord Rich Presence...");
StartDiscord();
}
GlobalFuncs.UpdateStatus(label1, "Launching Game...");
ClientManagement.UpdateStatus(label1, "Launching Game...");
LocalFuncs.SetupURIValues();
StartGame();
}

View File

@ -31,7 +31,7 @@ namespace NovetusURI
void ReadConfigValues(string cfgpath)
{
GlobalFuncs.Config(cfgpath, false);
FileManagement.Config(cfgpath, false);
DontShowBox.Checked = !GlobalVars.UserConfiguration.URIQuickConfigure;
IDBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
TripcodeLabel.Text = GlobalVars.PlayerTripcode.ToString();
@ -40,7 +40,7 @@ namespace NovetusURI
void GeneratePlayerID()
{
GlobalFuncs.GeneratePlayerID();
NovetusFuncs.GeneratePlayerID();
IDBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
}
@ -71,7 +71,7 @@ namespace NovetusURI
void Button1Click(object sender, EventArgs e)
{
GlobalFuncs.LaunchCharacterCustomization();
NovetusFuncs.LaunchCharacterCustomization();
}
void Button2Click(object sender, EventArgs e)
@ -86,8 +86,8 @@ namespace NovetusURI
void QuickConfigureClose(object sender, CancelEventArgs e)
{
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
GlobalFuncs.ReadClientValues();
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
ClientManagement.ReadClientValues();
LocalVars.ReadyToLaunch = true;
}
#endregion

View File

@ -30,9 +30,9 @@ namespace NovetusURI
config.AddRuleForAllLevels(logfile);
LogManager.Configuration = config;
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName);
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
GlobalVars.ColorsLoaded = GlobalFuncs.InitColors();
FileManagement.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName);
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
GlobalVars.ColorsLoaded = FileManagement.InitColors();
if (args.Length == 0)
{
Application.Run(new InstallForm());