new config system part 1 (NON FUNCTIONAL)

This commit is contained in:
Bitl 2023-04-21 15:06:49 -07:00
parent 5d943adbbc
commit 97fc2370f7
33 changed files with 646 additions and 964 deletions

View File

@ -16,7 +16,6 @@ namespace Novetus.Bootstrapper
{ {
public static void LaunchApplicationExt(string filePath, string appName, string args = "") public static void LaunchApplicationExt(string filePath, string appName, string args = "")
{ {
FileManagement.Config(LocalPaths.ConfigPath, true);
Util.LogPrint("Starting " + appName); Util.LogPrint("Starting " + appName);
try try
{ {
@ -39,7 +38,7 @@ namespace Novetus.Bootstrapper
public static void LaunchApplication(string appName, string args = "") public static void LaunchApplication(string appName, string args = "")
{ {
LaunchApplicationExt(LocalPaths.FixedBinDir, appName, args); LaunchApplicationExt(GlobalPaths.BinDir, appName, args);
} }
} }
#endregion #endregion

View File

@ -10,11 +10,6 @@ namespace Novetus.Bootstrapper
public class LocalPaths public class LocalPaths
{ {
public static readonly string FixedBinDir = GlobalPaths.BasePathLauncher + @"\\bin";
public static readonly string FixedConfigDir = GlobalPaths.BasePathLauncher + @"\\config";
public static readonly string FixedLogDir = GlobalPaths.BasePathLauncher + @"\\logs";
public static readonly string FixedDataDir = FixedBinDir + @"\\data";
#region File Names #region File Names
public static readonly string LauncherName = "Novetus.exe"; public static readonly string LauncherName = "Novetus.exe";
public static readonly string URIName = "NovetusURI.exe"; public static readonly string URIName = "NovetusURI.exe";
@ -22,10 +17,10 @@ namespace Novetus.Bootstrapper
#endregion #endregion
#region File Paths #region File Paths
public static readonly string LauncherPath = FixedBinDir + "\\" + LauncherName; public static readonly string LauncherPath = GlobalPaths.BinDir + "\\" + LauncherName;
public static readonly string InfoPath = FixedConfigDir + "\\" + GlobalPaths.InfoName; public static readonly string InfoPath = GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName;
public static readonly string VersionTermList = FixedConfigDir + "\\" + GlobalPaths.TermListFileName; public static readonly string VersionTermList = GlobalPaths.ConfigDir + "\\" + GlobalPaths.TermListFileName;
public static readonly string ConfigPath = FixedConfigDir + "\\" + GlobalPaths.ConfigName; public static readonly string ConfigPath = GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName;
#endregion #endregion
} }
#endregion #endregion

View File

@ -1,5 +1,6 @@
#region Usings #region Usings
using NLog; using NLog;
using Novetus.Core;
using System; using System;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -18,13 +19,13 @@ namespace Novetus.Bootstrapper
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
if (!Directory.Exists(LocalPaths.FixedLogDir)) if (!Directory.Exists(GlobalPaths.LogDir))
{ {
Directory.CreateDirectory(LocalPaths.FixedLogDir); Directory.CreateDirectory(GlobalPaths.LogDir);
} }
var config = new NLog.Config.LoggingConfiguration(); var config = new NLog.Config.LoggingConfiguration();
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = LocalPaths.FixedLogDir + "\\Bootstrapper-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" }; var logfile = new NLog.Targets.FileTarget("logfile") { FileName = GlobalPaths.LogDir + "\\Bootstrapper-log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".log" };
config.AddRuleForAllLevels(logfile); config.AddRuleForAllLevels(logfile);
LogManager.Configuration = config; LogManager.Configuration = config;

View File

@ -25,7 +25,7 @@ namespace Novetus.Bootstrapper
ReadConfigValues(LocalPaths.ConfigPath); ReadConfigValues(LocalPaths.ConfigPath);
} }
if (GlobalVars.UserConfiguration.BootstrapperShowUI) if (GlobalVars.UserConfiguration.ReadSettingBool("BootstrapperShowUI"))
{ {
//use novetus font for label!! //use novetus font for label!!
@ -63,8 +63,7 @@ namespace Novetus.Bootstrapper
void ReadConfigValues(string cfgpath) void ReadConfigValues(string cfgpath)
{ {
FileManagement.Config(cfgpath, false); LauncherBox.Checked = !GlobalVars.UserConfiguration.ReadSettingBool("BootstrapperShowUI");
LauncherBox.Checked = !GlobalVars.UserConfiguration.BootstrapperShowUI;
} }
private void LaunchNovetusButton_Click(object sender, EventArgs e) private void LaunchNovetusButton_Click(object sender, EventArgs e)
@ -115,7 +114,7 @@ namespace Novetus.Bootstrapper
private void LauncherBox_CheckedChanged(object sender, EventArgs e) private void LauncherBox_CheckedChanged(object sender, EventArgs e)
{ {
GlobalVars.UserConfiguration.BootstrapperShowUI = !LauncherBox.Checked; GlobalVars.UserConfiguration.SaveSettingBool("BootstrapperShowUI", !LauncherBox.Checked);
} }
} }
} }

View File

@ -74,32 +74,32 @@ class CharacterCustomizationShared
} }
//face //face
if (GlobalVars.UserCustomization.Face.Contains("http://") || GlobalVars.UserCustomization.Face.Contains("https://")) if (GlobalVars.UserCustomization.ReadSetting("Face").Contains("http://") || GlobalVars.UserCustomization.ReadSetting("Face").Contains("https://"))
{ {
Provider faceProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.Face); Provider faceProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.ReadSetting("Face"));
FaceIDBox.Text = GlobalVars.UserCustomization.Face.Replace(faceProvider.URL, ""); FaceIDBox.Text = GlobalVars.UserCustomization.ReadSetting("Face").Replace(faceProvider.URL, "");
FaceTypeBox.SelectedItem = faceProvider.Name; FaceTypeBox.SelectedItem = faceProvider.Name;
} }
//clothing //clothing
if (GlobalVars.UserCustomization.TShirt.Contains("http://") || GlobalVars.UserCustomization.TShirt.Contains("https://")) if (GlobalVars.UserCustomization.ReadSetting("TShirt").Contains("http://") || GlobalVars.UserCustomization.ReadSetting("TShirt").Contains("https://"))
{ {
Provider tShirtProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.TShirt); Provider tShirtProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.ReadSetting("TShirt"));
TShirtsIDBox.Text = GlobalVars.UserCustomization.TShirt.Replace(tShirtProvider.URL, ""); TShirtsIDBox.Text = GlobalVars.UserCustomization.ReadSetting("TShirt").Replace(tShirtProvider.URL, "");
TShirtsTypeBox.SelectedItem = tShirtProvider.Name; TShirtsTypeBox.SelectedItem = tShirtProvider.Name;
} }
if (GlobalVars.UserCustomization.Shirt.Contains("http://") || GlobalVars.UserCustomization.Shirt.Contains("https://")) if (GlobalVars.UserCustomization.ReadSetting("Shirt").Contains("http://") || GlobalVars.UserCustomization.ReadSetting("Shirt").Contains("https://"))
{ {
Provider shirtProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.Shirt); Provider shirtProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.ReadSetting("Shirt"));
ShirtsIDBox.Text = GlobalVars.UserCustomization.Shirt.Replace(shirtProvider.URL, ""); ShirtsIDBox.Text = GlobalVars.UserCustomization.ReadSetting("Shirt").Replace(shirtProvider.URL, "");
ShirtsTypeBox.SelectedItem = shirtProvider.Name; ShirtsTypeBox.SelectedItem = shirtProvider.Name;
} }
if (GlobalVars.UserCustomization.Pants.Contains("http://") || GlobalVars.UserCustomization.Pants.Contains("https://")) if (GlobalVars.UserCustomization.ReadSetting("Pants").Contains("http://") || GlobalVars.UserCustomization.ReadSetting("Pants").Contains("https://"))
{ {
Provider pantsProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.Pants); Provider pantsProvider = OnlineClothing.FindContentProviderByURL(contentProviders, GlobalVars.UserCustomization.ReadSetting("Pants"));
PantsIDBox.Text = GlobalVars.UserCustomization.Pants.Replace(pantsProvider.URL, ""); PantsIDBox.Text = GlobalVars.UserCustomization.ReadSetting("Pants").Replace(pantsProvider.URL, "");
PantsTypeBox.SelectedItem = pantsProvider.Name; PantsTypeBox.SelectedItem = pantsProvider.Name;
} }
} }
@ -123,21 +123,21 @@ class CharacterCustomizationShared
ReloadColors(); ReloadColors();
//icon //icon
if (GlobalVars.UserCustomization.Icon.Contains("http://") || GlobalVars.UserCustomization.Icon.Contains("https://")) if (GlobalVars.UserCustomization.ReadSetting("Icon").Contains("http://") || GlobalVars.UserCustomization.ReadSetting("Icon").Contains("https://"))
{ {
IconLabel.Text = "NBC"; IconLabel.Text = "NBC";
} }
else else
{ {
IconLabel.Text = GlobalVars.UserCustomization.Icon; IconLabel.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
} }
//charid //charid
CharacterIDBox.Text = GlobalVars.UserCustomization.CharacterID; CharacterIDBox.Text = GlobalVars.UserCustomization.ReadSetting("CharacterID");
ShowHatsInExtraBox.Checked = GlobalVars.UserCustomization.ShowHatsInExtra; ShowHatsInExtraBox.Checked = GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra");
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish) if (GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle") == (int)Settings.Style.Stylish)
{ {
Color robBlue = Color.FromArgb(110, 152, 200); Color robBlue = Color.FromArgb(110, 152, 200);
if (FormStyle == Settings.Style.Extended) if (FormStyle == Settings.Style.Extended)
@ -221,9 +221,9 @@ class CharacterCustomizationShared
FaceList.Items.Clear(); FaceList.Items.Clear();
ExtraItemList.Items.Clear(); ExtraItemList.Items.Clear();
if (GlobalVars.UserCustomization.Icon.Contains("http://") || GlobalVars.UserCustomization.Icon.Contains("https://")) if (GlobalVars.UserCustomization.ReadSetting("Icon").Contains("http://") || GlobalVars.UserCustomization.ReadSetting("Icon").Contains("https://"))
{ {
IconURLBox.Text = GlobalVars.UserCustomization.Icon; IconURLBox.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
LoadRemoteIcon(); LoadRemoteIcon();
} }
else else
@ -246,7 +246,7 @@ class CharacterCustomizationShared
ExtraItemList.Items.Clear(); ExtraItemList.Items.Clear();
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Hat1, GlobalVars.UserCustomization.ReadSetting("Hat1"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
Hat1Image, Hat1Image,
@ -256,7 +256,7 @@ class CharacterCustomizationShared
); );
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Hat2, GlobalVars.UserCustomization.ReadSetting("Hat2"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
Hat2Image, Hat2Image,
@ -266,7 +266,7 @@ class CharacterCustomizationShared
); );
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Hat3, GlobalVars.UserCustomization.ReadSetting("Hat3"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
Hat3Image, Hat3Image,
@ -293,7 +293,7 @@ class CharacterCustomizationShared
ExtraItemList.Items.Clear(); ExtraItemList.Items.Clear();
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Face, GlobalVars.UserCustomization.ReadSetting("Face"),
GlobalPaths.facedir, GlobalPaths.facedir,
"DefaultFace", "DefaultFace",
FaceImage, FaceImage,
@ -320,7 +320,7 @@ class CharacterCustomizationShared
ExtraItemList.Items.Clear(); ExtraItemList.Items.Clear();
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.TShirt, GlobalVars.UserCustomization.ReadSetting("TShirt"),
GlobalPaths.tshirtdir, GlobalPaths.tshirtdir,
"NoTShirt", "NoTShirt",
TShirtImage, TShirtImage,
@ -347,7 +347,7 @@ class CharacterCustomizationShared
ExtraItemList.Items.Clear(); ExtraItemList.Items.Clear();
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Shirt, GlobalVars.UserCustomization.ReadSetting("Shirt"),
GlobalPaths.shirtdir, GlobalPaths.shirtdir,
"NoShirt", "NoShirt",
ShirtImage, ShirtImage,
@ -374,7 +374,7 @@ class CharacterCustomizationShared
ExtraItemList.Items.Clear(); ExtraItemList.Items.Clear();
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Pants, GlobalVars.UserCustomization.ReadSetting("Pants"),
GlobalPaths.pantsdir, GlobalPaths.pantsdir,
"NoPants", "NoPants",
PantsImage, PantsImage,
@ -401,7 +401,7 @@ class CharacterCustomizationShared
ExtraItemList.Items.Clear(); ExtraItemList.Items.Clear();
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Head, GlobalVars.UserCustomization.ReadSetting("Head"),
GlobalPaths.headdir, GlobalPaths.headdir,
"DefaultHead", "DefaultHead",
HeadImage, HeadImage,
@ -427,7 +427,7 @@ class CharacterCustomizationShared
FaceList.Items.Clear(); FaceList.Items.Clear();
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.extradir, GlobalPaths.extradir,
"NoExtra", "NoExtra",
ExtraItemImage, ExtraItemImage,
@ -436,17 +436,17 @@ class CharacterCustomizationShared
true true
); );
if (GlobalVars.UserCustomization.ShowHatsInExtra) if (GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra"))
{ {
ChangeItem( ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
ExtraItemImage, ExtraItemImage,
ExtraItemDesc, ExtraItemDesc,
ExtraItemList, ExtraItemList,
true, true,
GlobalVars.UserCustomization.ShowHatsInExtra GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra")
); );
} }
break; break;
@ -472,12 +472,12 @@ class CharacterCustomizationShared
#region Part/Color Funcs #region Part/Color Funcs
public void ReloadColors() public void ReloadColors()
{ {
HeadButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.HeadColorString); HeadButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("HeadColorString"));
TorsoButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.TorsoColorString); TorsoButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("TorsoColorString"));
RightArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.RightArmColorString); RightArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("RightArmColorString"));
LeftArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.LeftArmColorString); LeftArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("LeftArmColorString"));
RightLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.RightLegColorString); RightLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("RightLegColorString"));
LeftLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.LeftLegColorString); LeftLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("LeftLegColorString"));
} }
public void ColorButton() public void ColorButton()
@ -523,34 +523,34 @@ class CharacterCustomizationShared
switch (part) switch (part)
{ {
case "Head": case "Head":
GlobalVars.UserCustomization.HeadColorID = ColorID; GlobalVars.UserCustomization.SaveSettingInt("HeadColorID", ColorID);
GlobalVars.UserCustomization.HeadColorString = ButtonColor.ToString(); GlobalVars.UserCustomization.SaveSetting("HeadColorString", ButtonColor.ToString());
HeadButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.HeadColorString); HeadButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("HeadColorString"));
break; break;
case "Torso": case "Torso":
GlobalVars.UserCustomization.TorsoColorID = ColorID; GlobalVars.UserCustomization.SaveSettingInt("TorsoColorID", ColorID);
GlobalVars.UserCustomization.TorsoColorString = ButtonColor.ToString(); GlobalVars.UserCustomization.SaveSetting("TorsoColorString", ButtonColor.ToString());
TorsoButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.TorsoColorString); TorsoButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("TorsoColorString"));
break; break;
case "Right Arm": case "Right Arm":
GlobalVars.UserCustomization.RightArmColorID = ColorID; GlobalVars.UserCustomization.SaveSettingInt("RightArmColorID", ColorID);
GlobalVars.UserCustomization.RightArmColorString = ButtonColor.ToString(); GlobalVars.UserCustomization.SaveSetting("RightArmColorString", ButtonColor.ToString());
RightArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.RightArmColorString); RightArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("RightArmColorString"));
break; break;
case "Left Arm": case "Left Arm":
GlobalVars.UserCustomization.LeftArmColorID = ColorID; GlobalVars.UserCustomization.SaveSettingInt("LeftArmColorID", ColorID);
GlobalVars.UserCustomization.LeftArmColorString = ButtonColor.ToString(); GlobalVars.UserCustomization.SaveSetting("LeftArmColorString", ButtonColor.ToString());
LeftArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.LeftArmColorString); LeftArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("LeftArmColorString"));
break; break;
case "Right Leg": case "Right Leg":
GlobalVars.UserCustomization.RightLegColorID = ColorID; GlobalVars.UserCustomization.SaveSettingInt("RightLegColorID", ColorID);
GlobalVars.UserCustomization.RightLegColorString = ButtonColor.ToString(); GlobalVars.UserCustomization.SaveSetting("RightLegColorString", ButtonColor.ToString());
RightLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.RightLegColorString); RightLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("RightLegColorString"));
break; break;
case "Left Leg": case "Left Leg":
GlobalVars.UserCustomization.LeftLegColorID = ColorID; GlobalVars.UserCustomization.SaveSettingInt("LeftLegColorID", ColorID);
GlobalVars.UserCustomization.LeftLegColorString = ButtonColor.ToString(); GlobalVars.UserCustomization.SaveSetting("LeftLegColorString", ButtonColor.ToString());
LeftLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.LeftLegColorString); LeftLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("LeftLegColorString"));
break; break;
default: default:
break; break;
@ -589,25 +589,13 @@ class CharacterCustomizationShared
public void ResetColors() public void ResetColors()
{ {
ColorView.SelectedIndices.Clear(); ColorView.SelectedIndices.Clear();
GlobalVars.UserCustomization.HeadColorID = 24; GlobalVars.UserCustomization.CreateFile();
GlobalVars.UserCustomization.TorsoColorID = 23; HeadButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("HeadColorString"));
GlobalVars.UserCustomization.LeftArmColorID = 24; TorsoButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("TorsoColorString"));
GlobalVars.UserCustomization.RightArmColorID = 24; RightArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("RightArmColorString"));
GlobalVars.UserCustomization.LeftLegColorID = 119; LeftArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("LeftArmColorString"));
GlobalVars.UserCustomization.RightLegColorID = 119; RightLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("RightLegColorString"));
GlobalVars.UserCustomization.CharacterID = ""; LeftLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.ReadSetting("LeftLegColorString"));
GlobalVars.UserCustomization.HeadColorString = "Color [A=255, R=245, G=205, B=47]";
GlobalVars.UserCustomization.TorsoColorString = "Color [A=255, R=13, G=105, B=172]";
GlobalVars.UserCustomization.LeftArmColorString = "Color [A=255, R=245, G=205, B=47]";
GlobalVars.UserCustomization.RightArmColorString = "Color [A=255, R=245, G=205, B=47]";
GlobalVars.UserCustomization.LeftLegColorString = "Color [A=255, R=164, G=189, B=71]";
GlobalVars.UserCustomization.RightLegColorString = "Color [A=255, R=164, G=189, B=71]";
HeadButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.HeadColorString);
TorsoButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.TorsoColorString);
RightArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.RightArmColorString);
LeftArmButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.LeftArmColorString);
RightLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.RightLegColorString);
LeftLegButton.BackColor = ConvertStringtoColor(GlobalVars.UserCustomization.LeftLegColorString);
} }
public void RandomizeColors() public void RandomizeColors()
@ -645,9 +633,10 @@ class CharacterCustomizationShared
} }
} }
// TODO: we don't really need these....
public void SaveOutfit(bool box = true) public void SaveOutfit(bool box = true)
{ {
FileManagement.Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true); //FileManagement.Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true);
if (box) if (box)
{ {
MessageBox.Show("Outfit Saved!", "Novetus - Outfit Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Outfit Saved!", "Novetus - Outfit Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
@ -664,7 +653,8 @@ class CharacterCustomizationShared
ofd.Title = "Load config_customization.ini"; ofd.Title = "Load config_customization.ini";
if (ofd.ShowDialog() == DialogResult.OK) if (ofd.ShowDialog() == DialogResult.OK)
{ {
FileManagement.Customization(ofd.FileName, false); //FileManagement.Customization(ofd.FileName, false);
GlobalVars.UserCustomization.LoadAllSettings(ofd.FileName);
ReloadColors(); ReloadColors();
MessageBox.Show("Outfit Loaded!", "Novetus - Outfit Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Outfit Loaded!", "Novetus - Outfit Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
@ -774,7 +764,7 @@ class CharacterCustomizationShared
string mapfile = GlobalPaths.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl"; string mapfile = GlobalPaths.BasePathLauncher + "\\preview\\content\\fonts\\3DView.rbxl";
string rbxexe = GlobalPaths.BasePathLauncher + (GlobalVars.AdminMode ? "\\preview\\3DView_studio.exe" : "\\preview\\3DView.exe"); string rbxexe = GlobalPaths.BasePathLauncher + (GlobalVars.AdminMode ? "\\preview\\3DView_studio.exe" : "\\preview\\3DView.exe");
string quote = "\""; string quote = "\"";
string script = "_G.CS3DView(0,'" + GlobalVars.UserConfiguration.PlayerName + "'," + GlobalVars.Loadout + ");"; string script = "_G.CS3DView(0,'" + GlobalVars.UserConfiguration.ReadSetting("PlayerName") + "'," + GlobalVars.Loadout + ");";
if (GlobalVars.AdminMode) if (GlobalVars.AdminMode)
{ {
@ -828,7 +818,7 @@ class CharacterCustomizationShared
public void LoadLocalIcon() public void LoadLocalIcon()
{ {
Image icon1 = Util.LoadImage(GlobalPaths.extradirIcons + "\\" + GlobalVars.UserConfiguration.PlayerName + ".png", GlobalPaths.extradir + "\\NoExtra.png"); Image icon1 = Util.LoadImage(GlobalPaths.extradirIcons + "\\" + GlobalVars.UserConfiguration.ReadSetting("PlayerName") + ".png", GlobalPaths.extradir + "\\NoExtra.png");
IconImage.Image = icon1; IconImage.Image = icon1;
SaveOutfit(false); SaveOutfit(false);
@ -843,15 +833,15 @@ class CharacterCustomizationShared
IconURLBox.Text.Contains("NBC")) IconURLBox.Text.Contains("NBC"))
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "NBC"; GlobalVars.UserCustomization.SaveSetting("Icon", "NBC");
IconLabel.Text = GlobalVars.UserCustomization.Icon; IconLabel.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
BrowseIconButton.Enabled = true; BrowseIconButton.Enabled = true;
LoadLocalIcon(); LoadLocalIcon();
return; return;
} }
else if (IconURLBox.Text.Contains("http://") || IconURLBox.Text.Contains("https://")) else if (IconURLBox.Text.Contains("http://") || IconURLBox.Text.Contains("https://"))
{ {
GlobalVars.UserCustomization.Icon = IconURLBox.Text; GlobalVars.UserCustomization.SaveSetting("Icon", IconURLBox.Text);
IconLabel.Text = "NBC"; IconLabel.Text = "NBC";
BrowseIconButton.Enabled = false; BrowseIconButton.Enabled = false;
} }

View File

@ -39,15 +39,14 @@ public partial class CharacterCustomizationCompact : Form
} }
#region Hats #region Hats
void ListBox1SelectedIndexChanged(object sender, EventArgs e) void ListBox1SelectedIndexChanged(object sender, EventArgs e)
{ {
if (Directory.Exists(GlobalPaths.hatdir)) if (Directory.Exists(GlobalPaths.hatdir))
{ {
GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Hat1", listBox1.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Hat1, GlobalVars.UserCustomization.ReadSetting("Hat1"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox1, pictureBox1,
@ -62,10 +61,10 @@ public partial class CharacterCustomizationCompact : Form
{ {
if (Directory.Exists(GlobalPaths.hatdir)) if (Directory.Exists(GlobalPaths.hatdir))
{ {
GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Hat2", listBox2.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Hat2, GlobalVars.UserCustomization.ReadSetting("Hat1"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox2, pictureBox2,
@ -80,10 +79,10 @@ public partial class CharacterCustomizationCompact : Form
{ {
if (Directory.Exists(GlobalPaths.hatdir)) if (Directory.Exists(GlobalPaths.hatdir))
{ {
GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Hat3", listBox3.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Hat3, GlobalVars.UserCustomization.ReadSetting("Hat3"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox3, pictureBox3,
@ -139,10 +138,10 @@ public partial class CharacterCustomizationCompact : Form
} }
} }
listBox4.SelectedItem = previtem; listBox4.SelectedItem = previtem;
GlobalVars.UserCustomization.Face = previtem; GlobalVars.UserCustomization.SaveSetting("Face", previtem);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Face, GlobalVars.UserCustomization.ReadSetting("Face"),
GlobalPaths.facedir, GlobalPaths.facedir,
"DefaultFace", "DefaultFace",
pictureBox4, pictureBox4,
@ -188,16 +187,16 @@ public partial class CharacterCustomizationCompact : Form
if (!string.IsNullOrWhiteSpace(FaceIDBox.Text)) if (!string.IsNullOrWhiteSpace(FaceIDBox.Text))
{ {
GlobalVars.UserCustomization.Face = characterCustomizationForm.Custom_Face_URL + FaceIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Face", characterCustomizationForm.Custom_Face_URL + FaceIDBox.Text);
FaceIDBox.Focus(); FaceIDBox.Focus();
} }
else else
{ {
GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Face", listBox4.SelectedItem.ToString());
} }
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Face, GlobalVars.UserCustomization.ReadSetting("Face"),
GlobalPaths.facedir, GlobalPaths.facedir,
"DefaultFace", "DefaultFace",
pictureBox4, pictureBox4,
@ -220,9 +219,9 @@ public partial class CharacterCustomizationCompact : Form
if (!string.IsNullOrWhiteSpace(FaceIDBox.Text)) if (!string.IsNullOrWhiteSpace(FaceIDBox.Text))
{ {
GlobalVars.UserCustomization.Face = characterCustomizationForm.Custom_Face_URL + FaceIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Face", characterCustomizationForm.Custom_Face_URL + FaceIDBox.Text);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Face, GlobalVars.UserCustomization.ReadSetting("Face"),
GlobalPaths.facedir, GlobalPaths.facedir,
"DefaultFace", "DefaultFace",
pictureBox4, pictureBox4,
@ -252,10 +251,10 @@ public partial class CharacterCustomizationCompact : Form
} }
} }
listBox5.SelectedItem = previtem; listBox5.SelectedItem = previtem;
GlobalVars.UserCustomization.TShirt = previtem; GlobalVars.UserCustomization.SaveSetting("TShirt", previtem);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.TShirt, GlobalVars.UserCustomization.ReadSetting("TShirt"),
GlobalPaths.tshirtdir, GlobalPaths.tshirtdir,
"NoTShirt", "NoTShirt",
pictureBox5, pictureBox5,
@ -301,16 +300,16 @@ public partial class CharacterCustomizationCompact : Form
if (!string.IsNullOrWhiteSpace(TShirtsIDBox.Text)) if (!string.IsNullOrWhiteSpace(TShirtsIDBox.Text))
{ {
GlobalVars.UserCustomization.TShirt = characterCustomizationForm.Custom_T_Shirt_URL + TShirtsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("TShirt", characterCustomizationForm.Custom_T_Shirt_URL + TShirtsIDBox.Text);
TShirtsIDBox.Focus(); TShirtsIDBox.Focus();
} }
else else
{ {
GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("TShirt", listBox5.SelectedItem.ToString());
} }
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.TShirt, GlobalVars.UserCustomization.ReadSetting("TShirt"),
GlobalPaths.tshirtdir, GlobalPaths.tshirtdir,
"NoTShirt", "NoTShirt",
pictureBox5, pictureBox5,
@ -333,9 +332,9 @@ public partial class CharacterCustomizationCompact : Form
if (!string.IsNullOrWhiteSpace(TShirtsIDBox.Text)) if (!string.IsNullOrWhiteSpace(TShirtsIDBox.Text))
{ {
GlobalVars.UserCustomization.TShirt = characterCustomizationForm.Custom_T_Shirt_URL + TShirtsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("TShirt", characterCustomizationForm.Custom_T_Shirt_URL + TShirtsIDBox.Text);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.TShirt, GlobalVars.UserCustomization.ReadSetting("TShirt"),
GlobalPaths.tshirtdir, GlobalPaths.tshirtdir,
"NoTShirt", "NoTShirt",
pictureBox5, pictureBox5,
@ -364,10 +363,10 @@ public partial class CharacterCustomizationCompact : Form
} }
} }
listBox6.SelectedItem = previtem; listBox6.SelectedItem = previtem;
GlobalVars.UserCustomization.Shirt = previtem; GlobalVars.UserCustomization.SaveSetting("Shirt", previtem);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Shirt, GlobalVars.UserCustomization.ReadSetting("Shirt"),
GlobalPaths.shirtdir, GlobalPaths.shirtdir,
"NoShirt", "NoShirt",
pictureBox6, pictureBox6,
@ -413,16 +412,16 @@ public partial class CharacterCustomizationCompact : Form
if (!string.IsNullOrWhiteSpace(ShirtsIDBox.Text)) if (!string.IsNullOrWhiteSpace(ShirtsIDBox.Text))
{ {
GlobalVars.UserCustomization.Shirt = characterCustomizationForm.Custom_Shirt_URL + ShirtsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Shirt", characterCustomizationForm.Custom_Shirt_URL + ShirtsIDBox.Text);
ShirtsIDBox.Focus(); ShirtsIDBox.Focus();
} }
else else
{ {
GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Shirt", listBox6.SelectedItem.ToString());
} }
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Shirt, GlobalVars.UserCustomization.ReadSetting("Shirt"),
GlobalPaths.shirtdir, GlobalPaths.shirtdir,
"NoShirt", "NoShirt",
pictureBox6, pictureBox6,
@ -445,9 +444,9 @@ public partial class CharacterCustomizationCompact : Form
if (!string.IsNullOrWhiteSpace(ShirtsIDBox.Text)) if (!string.IsNullOrWhiteSpace(ShirtsIDBox.Text))
{ {
GlobalVars.UserCustomization.Shirt = characterCustomizationForm.Custom_Shirt_URL + ShirtsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Shirt", characterCustomizationForm.Custom_Shirt_URL + ShirtsIDBox.Text);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Shirt, GlobalVars.UserCustomization.ReadSetting("Shirt"),
GlobalPaths.shirtdir, GlobalPaths.shirtdir,
"NoShirt", "NoShirt",
pictureBox6, pictureBox6,
@ -476,10 +475,10 @@ public partial class CharacterCustomizationCompact : Form
} }
} }
listBox7.SelectedItem = previtem; listBox7.SelectedItem = previtem;
GlobalVars.UserCustomization.Pants = previtem; GlobalVars.UserCustomization.SaveSetting("Pants", previtem);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Pants, GlobalVars.UserCustomization.ReadSetting("Pants"),
GlobalPaths.pantsdir, GlobalPaths.pantsdir,
"NoPants", "NoPants",
pictureBox7, pictureBox7,
@ -525,16 +524,16 @@ public partial class CharacterCustomizationCompact : Form
if (!string.IsNullOrWhiteSpace(PantsIDBox.Text)) if (!string.IsNullOrWhiteSpace(PantsIDBox.Text))
{ {
GlobalVars.UserCustomization.Pants = characterCustomizationForm.Custom_Pants_URL + PantsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Pants", characterCustomizationForm.Custom_Pants_URL + PantsIDBox.Text);
PantsIDBox.Focus(); PantsIDBox.Focus();
} }
else else
{ {
GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Pants", listBox7.SelectedItem.ToString());
} }
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Pants, GlobalVars.UserCustomization.ReadSetting("Pants"),
GlobalPaths.pantsdir, GlobalPaths.pantsdir,
"NoPants", "NoPants",
pictureBox7, pictureBox7,
@ -557,9 +556,9 @@ public partial class CharacterCustomizationCompact : Form
if (!string.IsNullOrWhiteSpace(PantsIDBox.Text)) if (!string.IsNullOrWhiteSpace(PantsIDBox.Text))
{ {
GlobalVars.UserCustomization.Pants = characterCustomizationForm.Custom_Pants_URL + PantsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Pants", characterCustomizationForm.Custom_Pants_URL + PantsIDBox.Text);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Pants, GlobalVars.UserCustomization.ReadSetting("Pants"),
GlobalPaths.pantsdir, GlobalPaths.pantsdir,
"NoPants", "NoPants",
pictureBox7, pictureBox7,
@ -578,10 +577,10 @@ public partial class CharacterCustomizationCompact : Form
{ {
if (Directory.Exists(GlobalPaths.headdir)) if (Directory.Exists(GlobalPaths.headdir))
{ {
GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Head", listBox8.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Head, GlobalVars.UserCustomization.ReadSetting("Head"),
GlobalPaths.headdir, GlobalPaths.headdir,
"DefaultHead", "DefaultHead",
pictureBox8, pictureBox8,
@ -616,10 +615,10 @@ public partial class CharacterCustomizationCompact : Form
{ {
if (Directory.Exists(GlobalPaths.extradir)) if (Directory.Exists(GlobalPaths.extradir))
{ {
GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Extra", listBox9.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.extradir, GlobalPaths.extradir,
"NoExtra", "NoExtra",
pictureBox9, pictureBox9,
@ -628,17 +627,17 @@ public partial class CharacterCustomizationCompact : Form
false false
); );
if (GlobalVars.UserCustomization.ShowHatsInExtra) if (GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra"))
{ {
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox9, pictureBox9,
textBox10, textBox10,
listBox9, listBox9,
false, false,
GlobalVars.UserCustomization.ShowHatsInExtra GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra")
); );
} }
} }
@ -664,11 +663,11 @@ public partial class CharacterCustomizationCompact : Form
void CheckBox1CheckedChanged(object sender, EventArgs e) void CheckBox1CheckedChanged(object sender, EventArgs e)
{ {
GlobalVars.UserCustomization.ShowHatsInExtra = checkBox1.Checked; GlobalVars.UserCustomization.SaveSettingBool("ShowHatsInExtra", checkBox1.Checked);
listBox9.Items.Clear(); listBox9.Items.Clear();
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.extradir, GlobalPaths.extradir,
"NoExtra", "NoExtra",
pictureBox9, pictureBox9,
@ -677,17 +676,17 @@ public partial class CharacterCustomizationCompact : Form
true true
); );
if (GlobalVars.UserCustomization.ShowHatsInExtra) if (GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra"))
{ {
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox9, pictureBox9,
textBox10, textBox10,
listBox9, listBox9,
true, true,
GlobalVars.UserCustomization.ShowHatsInExtra GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra")
); );
} }
else else
@ -784,32 +783,32 @@ public partial class CharacterCustomizationCompact : Form
void Button52Click(object sender, EventArgs e) void Button52Click(object sender, EventArgs e)
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "BC"; GlobalVars.UserCustomization.SaveSetting("Icon", "BC");
label5.Text = GlobalVars.UserCustomization.Icon; label5.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
void Button53Click(object sender, EventArgs e) void Button53Click(object sender, EventArgs e)
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "TBC"; GlobalVars.UserCustomization.SaveSetting("Icon", "TBC");
label5.Text = GlobalVars.UserCustomization.Icon; label5.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
void Button54Click(object sender, EventArgs e) void Button54Click(object sender, EventArgs e)
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "OBC"; GlobalVars.UserCustomization.SaveSetting("Icon", "OBC");
label5.Text = GlobalVars.UserCustomization.Icon; label5.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
void Button55Click(object sender, EventArgs e) void Button55Click(object sender, EventArgs e)
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "NBC"; GlobalVars.UserCustomization.SaveSetting("Icon", "NBC");
label5.Text = GlobalVars.UserCustomization.Icon; label5.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
@ -841,7 +840,7 @@ public partial class CharacterCustomizationCompact : Form
void TextBox1TextChanged(object sender, EventArgs e) void TextBox1TextChanged(object sender, EventArgs e)
{ {
GlobalVars.UserCustomization.CharacterID = textBox1.Text; GlobalVars.UserCustomization.SaveSetting("CharacterID", textBox1.Text);
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }

View File

@ -45,15 +45,14 @@ public partial class CharacterCustomizationExtended : Form
} }
#region Hats #region Hats
void ListBox1SelectedIndexChanged(object sender, EventArgs e) void ListBox1SelectedIndexChanged(object sender, EventArgs e)
{ {
if (Directory.Exists(GlobalPaths.hatdir)) if (Directory.Exists(GlobalPaths.hatdir))
{ {
GlobalVars.UserCustomization.Hat1 = listBox1.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Hat1", listBox1.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Hat1, GlobalVars.UserCustomization.ReadSetting("Hat1"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox1, pictureBox1,
@ -68,10 +67,10 @@ public partial class CharacterCustomizationExtended : Form
{ {
if (Directory.Exists(GlobalPaths.hatdir)) if (Directory.Exists(GlobalPaths.hatdir))
{ {
GlobalVars.UserCustomization.Hat2 = listBox2.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Hat2", listBox2.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Hat2, GlobalVars.UserCustomization.ReadSetting("Hat1"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox2, pictureBox2,
@ -86,10 +85,10 @@ public partial class CharacterCustomizationExtended : Form
{ {
if (Directory.Exists(GlobalPaths.hatdir)) if (Directory.Exists(GlobalPaths.hatdir))
{ {
GlobalVars.UserCustomization.Hat3 = listBox3.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Hat3", listBox3.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Hat3, GlobalVars.UserCustomization.ReadSetting("Hat3"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox3, pictureBox3,
@ -145,10 +144,10 @@ public partial class CharacterCustomizationExtended : Form
} }
} }
listBox4.SelectedItem = previtem; listBox4.SelectedItem = previtem;
GlobalVars.UserCustomization.Face = previtem; GlobalVars.UserCustomization.SaveSetting("Face", previtem);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Face, GlobalVars.UserCustomization.ReadSetting("Face"),
GlobalPaths.facedir, GlobalPaths.facedir,
"DefaultFace", "DefaultFace",
pictureBox4, pictureBox4,
@ -194,16 +193,16 @@ public partial class CharacterCustomizationExtended : Form
if (!string.IsNullOrWhiteSpace(FaceIDBox.Text)) if (!string.IsNullOrWhiteSpace(FaceIDBox.Text))
{ {
GlobalVars.UserCustomization.Face = characterCustomizationForm.Custom_Face_URL + FaceIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Face", characterCustomizationForm.Custom_Face_URL + FaceIDBox.Text);
FaceIDBox.Focus(); FaceIDBox.Focus();
} }
else else
{ {
GlobalVars.UserCustomization.Face = listBox4.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Face", listBox4.SelectedItem.ToString());
} }
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Face, GlobalVars.UserCustomization.ReadSetting("Face"),
GlobalPaths.facedir, GlobalPaths.facedir,
"DefaultFace", "DefaultFace",
pictureBox4, pictureBox4,
@ -226,9 +225,9 @@ public partial class CharacterCustomizationExtended : Form
if (!string.IsNullOrWhiteSpace(FaceIDBox.Text)) if (!string.IsNullOrWhiteSpace(FaceIDBox.Text))
{ {
GlobalVars.UserCustomization.Face = characterCustomizationForm.Custom_Face_URL + FaceIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Face", characterCustomizationForm.Custom_Face_URL + FaceIDBox.Text);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Face, GlobalVars.UserCustomization.ReadSetting("Face"),
GlobalPaths.facedir, GlobalPaths.facedir,
"DefaultFace", "DefaultFace",
pictureBox4, pictureBox4,
@ -258,10 +257,10 @@ public partial class CharacterCustomizationExtended : Form
} }
} }
listBox5.SelectedItem = previtem; listBox5.SelectedItem = previtem;
GlobalVars.UserCustomization.TShirt = previtem; GlobalVars.UserCustomization.SaveSetting("TShirt", previtem);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.TShirt, GlobalVars.UserCustomization.ReadSetting("TShirt"),
GlobalPaths.tshirtdir, GlobalPaths.tshirtdir,
"NoTShirt", "NoTShirt",
pictureBox5, pictureBox5,
@ -307,16 +306,16 @@ public partial class CharacterCustomizationExtended : Form
if (!string.IsNullOrWhiteSpace(TShirtsIDBox.Text)) if (!string.IsNullOrWhiteSpace(TShirtsIDBox.Text))
{ {
GlobalVars.UserCustomization.TShirt = characterCustomizationForm.Custom_T_Shirt_URL + TShirtsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("TShirt", characterCustomizationForm.Custom_T_Shirt_URL + TShirtsIDBox.Text);
TShirtsIDBox.Focus(); TShirtsIDBox.Focus();
} }
else else
{ {
GlobalVars.UserCustomization.TShirt = listBox5.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("TShirt", listBox5.SelectedItem.ToString());
} }
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.TShirt, GlobalVars.UserCustomization.ReadSetting("TShirt"),
GlobalPaths.tshirtdir, GlobalPaths.tshirtdir,
"NoTShirt", "NoTShirt",
pictureBox5, pictureBox5,
@ -339,9 +338,9 @@ public partial class CharacterCustomizationExtended : Form
if (!string.IsNullOrWhiteSpace(TShirtsIDBox.Text)) if (!string.IsNullOrWhiteSpace(TShirtsIDBox.Text))
{ {
GlobalVars.UserCustomization.TShirt = characterCustomizationForm.Custom_T_Shirt_URL + TShirtsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("TShirt", characterCustomizationForm.Custom_T_Shirt_URL + TShirtsIDBox.Text);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.TShirt, GlobalVars.UserCustomization.ReadSetting("TShirt"),
GlobalPaths.tshirtdir, GlobalPaths.tshirtdir,
"NoTShirt", "NoTShirt",
pictureBox5, pictureBox5,
@ -370,10 +369,10 @@ public partial class CharacterCustomizationExtended : Form
} }
} }
listBox6.SelectedItem = previtem; listBox6.SelectedItem = previtem;
GlobalVars.UserCustomization.Shirt = previtem; GlobalVars.UserCustomization.SaveSetting("Shirt", previtem);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Shirt, GlobalVars.UserCustomization.ReadSetting("Shirt"),
GlobalPaths.shirtdir, GlobalPaths.shirtdir,
"NoShirt", "NoShirt",
pictureBox6, pictureBox6,
@ -419,16 +418,16 @@ public partial class CharacterCustomizationExtended : Form
if (!string.IsNullOrWhiteSpace(ShirtsIDBox.Text)) if (!string.IsNullOrWhiteSpace(ShirtsIDBox.Text))
{ {
GlobalVars.UserCustomization.Shirt = characterCustomizationForm.Custom_Shirt_URL + ShirtsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Shirt", characterCustomizationForm.Custom_Shirt_URL + ShirtsIDBox.Text);
ShirtsIDBox.Focus(); ShirtsIDBox.Focus();
} }
else else
{ {
GlobalVars.UserCustomization.Shirt = listBox6.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Shirt", listBox6.SelectedItem.ToString());
} }
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Shirt, GlobalVars.UserCustomization.ReadSetting("Shirt"),
GlobalPaths.shirtdir, GlobalPaths.shirtdir,
"NoShirt", "NoShirt",
pictureBox6, pictureBox6,
@ -451,9 +450,9 @@ public partial class CharacterCustomizationExtended : Form
if (!string.IsNullOrWhiteSpace(ShirtsIDBox.Text)) if (!string.IsNullOrWhiteSpace(ShirtsIDBox.Text))
{ {
GlobalVars.UserCustomization.Shirt = characterCustomizationForm.Custom_Shirt_URL + ShirtsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Shirt", characterCustomizationForm.Custom_Shirt_URL + ShirtsIDBox.Text);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Shirt, GlobalVars.UserCustomization.ReadSetting("Shirt"),
GlobalPaths.shirtdir, GlobalPaths.shirtdir,
"NoShirt", "NoShirt",
pictureBox6, pictureBox6,
@ -482,10 +481,10 @@ public partial class CharacterCustomizationExtended : Form
} }
} }
listBox7.SelectedItem = previtem; listBox7.SelectedItem = previtem;
GlobalVars.UserCustomization.Pants = previtem; GlobalVars.UserCustomization.SaveSetting("Pants", previtem);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Pants, GlobalVars.UserCustomization.ReadSetting("Pants"),
GlobalPaths.pantsdir, GlobalPaths.pantsdir,
"NoPants", "NoPants",
pictureBox7, pictureBox7,
@ -531,16 +530,16 @@ public partial class CharacterCustomizationExtended : Form
if (!string.IsNullOrWhiteSpace(PantsIDBox.Text)) if (!string.IsNullOrWhiteSpace(PantsIDBox.Text))
{ {
GlobalVars.UserCustomization.Pants = characterCustomizationForm.Custom_Pants_URL + PantsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Pants", characterCustomizationForm.Custom_Pants_URL + PantsIDBox.Text);
PantsIDBox.Focus(); PantsIDBox.Focus();
} }
else else
{ {
GlobalVars.UserCustomization.Pants = listBox7.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Pants", listBox7.SelectedItem.ToString());
} }
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Pants, GlobalVars.UserCustomization.ReadSetting("Pants"),
GlobalPaths.pantsdir, GlobalPaths.pantsdir,
"NoPants", "NoPants",
pictureBox7, pictureBox7,
@ -563,9 +562,9 @@ public partial class CharacterCustomizationExtended : Form
if (!string.IsNullOrWhiteSpace(PantsIDBox.Text)) if (!string.IsNullOrWhiteSpace(PantsIDBox.Text))
{ {
GlobalVars.UserCustomization.Pants = characterCustomizationForm.Custom_Pants_URL + PantsIDBox.Text; GlobalVars.UserCustomization.SaveSetting("Pants", characterCustomizationForm.Custom_Pants_URL + PantsIDBox.Text);
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Pants, GlobalVars.UserCustomization.ReadSetting("Pants"),
GlobalPaths.pantsdir, GlobalPaths.pantsdir,
"NoPants", "NoPants",
pictureBox7, pictureBox7,
@ -584,10 +583,10 @@ public partial class CharacterCustomizationExtended : Form
{ {
if (Directory.Exists(GlobalPaths.headdir)) if (Directory.Exists(GlobalPaths.headdir))
{ {
GlobalVars.UserCustomization.Head = listBox8.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Head", listBox8.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Head, GlobalVars.UserCustomization.ReadSetting("Head"),
GlobalPaths.headdir, GlobalPaths.headdir,
"DefaultHead", "DefaultHead",
pictureBox8, pictureBox8,
@ -622,10 +621,10 @@ public partial class CharacterCustomizationExtended : Form
{ {
if (Directory.Exists(GlobalPaths.extradir)) if (Directory.Exists(GlobalPaths.extradir))
{ {
GlobalVars.UserCustomization.Extra = listBox9.SelectedItem.ToString(); GlobalVars.UserCustomization.SaveSetting("Extra", listBox9.SelectedItem.ToString());
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.extradir, GlobalPaths.extradir,
"NoExtra", "NoExtra",
pictureBox9, pictureBox9,
@ -634,17 +633,17 @@ public partial class CharacterCustomizationExtended : Form
false false
); );
if (GlobalVars.UserCustomization.ShowHatsInExtra) if (GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra"))
{ {
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox9, pictureBox9,
textBox10, textBox10,
listBox9, listBox9,
false, false,
GlobalVars.UserCustomization.ShowHatsInExtra GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra")
); );
} }
} }
@ -670,11 +669,11 @@ public partial class CharacterCustomizationExtended : Form
void CheckBox1CheckedChanged(object sender, EventArgs e) void CheckBox1CheckedChanged(object sender, EventArgs e)
{ {
GlobalVars.UserCustomization.ShowHatsInExtra = checkBox1.Checked; GlobalVars.UserCustomization.SaveSettingBool("ShowHatsInExtra", checkBox1.Checked);
listBox9.Items.Clear(); listBox9.Items.Clear();
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.extradir, GlobalPaths.extradir,
"NoExtra", "NoExtra",
pictureBox9, pictureBox9,
@ -683,17 +682,17 @@ public partial class CharacterCustomizationExtended : Form
true true
); );
if (GlobalVars.UserCustomization.ShowHatsInExtra) if (GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra"))
{ {
characterCustomizationForm.ChangeItem( characterCustomizationForm.ChangeItem(
GlobalVars.UserCustomization.Extra, GlobalVars.UserCustomization.ReadSetting("Extra"),
GlobalPaths.hatdir, GlobalPaths.hatdir,
"NoHat", "NoHat",
pictureBox9, pictureBox9,
textBox10, textBox10,
listBox9, listBox9,
true, true,
GlobalVars.UserCustomization.ShowHatsInExtra GlobalVars.UserCustomization.ReadSettingBool("ShowHatsInExtra")
); );
} }
else else
@ -784,38 +783,38 @@ public partial class CharacterCustomizationExtended : Form
{ {
characterCustomizationForm.ApplyPreset(9, 194, 9, 9, 119, 119); characterCustomizationForm.ApplyPreset(9, 194, 9, 9, 119, 119);
} }
#endregion #endregion
#region Icon #region Icon
void Button52Click(object sender, EventArgs e) void Button52Click(object sender, EventArgs e)
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "BC"; GlobalVars.UserCustomization.SaveSetting("Icon", "BC");
label5.Text = GlobalVars.UserCustomization.Icon; label5.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
void Button53Click(object sender, EventArgs e) void Button53Click(object sender, EventArgs e)
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "TBC"; GlobalVars.UserCustomization.SaveSetting("Icon", "TBC");
label5.Text = GlobalVars.UserCustomization.Icon; label5.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
void Button54Click(object sender, EventArgs e) void Button54Click(object sender, EventArgs e)
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "OBC"; GlobalVars.UserCustomization.SaveSetting("Icon", "OBC");
label5.Text = GlobalVars.UserCustomization.Icon; label5.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
void Button55Click(object sender, EventArgs e) void Button55Click(object sender, EventArgs e)
{ {
IconURLBox.Text = ""; IconURLBox.Text = "";
GlobalVars.UserCustomization.Icon = "NBC"; GlobalVars.UserCustomization.SaveSetting("Icon", "NBC");
label5.Text = GlobalVars.UserCustomization.Icon; label5.Text = GlobalVars.UserCustomization.ReadSetting("Icon");
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
@ -828,9 +827,9 @@ public partial class CharacterCustomizationExtended : Form
{ {
characterCustomizationForm.LoadRemoteIcon(); characterCustomizationForm.LoadRemoteIcon();
} }
#endregion #endregion
#region Navigation #region Navigation (Extended)
private void button72_Click(object sender, EventArgs e) private void button72_Click(object sender, EventArgs e)
{ {
tabControl1.SelectedTab = tabPage1; tabControl1.SelectedTab = tabPage1;
@ -909,7 +908,7 @@ public partial class CharacterCustomizationExtended : Form
void TextBox1TextChanged(object sender, EventArgs e) void TextBox1TextChanged(object sender, EventArgs e)
{ {
GlobalVars.UserCustomization.CharacterID = textBox1.Text; GlobalVars.UserCustomization.SaveSetting("CharacterID", textBox1.Text);
characterCustomizationForm.SaveOutfit(false); characterCustomizationForm.SaveOutfit(false);
} }
@ -920,7 +919,7 @@ public partial class CharacterCustomizationExtended : Form
private void label9_Paint(object sender, PaintEventArgs e) private void label9_Paint(object sender, PaintEventArgs e)
{ {
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish) if (GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle") == (int)Settings.Style.Stylish)
{ {
Util.DrawBorderSimple(e.Graphics, label9.DisplayRectangle, Color.White, ButtonBorderStyle.Solid, 1); Util.DrawBorderSimple(e.Graphics, label9.DisplayRectangle, Color.White, ButtonBorderStyle.Solid, 1);
} }
@ -928,7 +927,7 @@ public partial class CharacterCustomizationExtended : Form
private void panel1_Paint(object sender, PaintEventArgs e) private void panel1_Paint(object sender, PaintEventArgs e)
{ {
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish) if (GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle") == (int)Settings.Style.Stylish)
{ {
Util.DrawBorderSimple(e.Graphics, panel1.DisplayRectangle, Color.Black, ButtonBorderStyle.Solid, 1); Util.DrawBorderSimple(e.Graphics, panel1.DisplayRectangle, Color.Black, ButtonBorderStyle.Solid, 1);
} }

View File

@ -128,7 +128,7 @@ namespace Novetus.Core
public static void StartDiscord() public static void StartDiscord()
{ {
if (GlobalVars.UserConfiguration.DiscordPresence) if (GlobalVars.UserConfiguration.ReadSettingBool("DiscordRichPresence"))
{ {
GlobalVars.handlers = new IDiscordRPC.EventHandlers(); GlobalVars.handlers = new IDiscordRPC.EventHandlers();
GlobalVars.handlers.readyCallback = ReadyCallback; GlobalVars.handlers.readyCallback = ReadyCallback;

View File

@ -26,12 +26,17 @@ namespace Novetus.Core
/// INIFile Constructor. /// INIFile Constructor.
/// </summary> /// </summary>
/// <PARAM name="INIPath"></PARAM> /// <PARAM name="INIPath"></PARAM>
public INIFile(string INIPath) public INIFile(string INIPath, bool createNewFile = true)
{ {
path = INIPath; path = INIPath;
if (!File.Exists(path)) if (createNewFile)
{ {
if (File.Exists(path))
{
Util.FixedFileDelete(path);
}
File.Create(path).Close(); File.Create(path).Close();
} }
} }

View File

@ -16,7 +16,7 @@ namespace Novetus.Core
{ {
public virtual string Name() { return "Unnamed Object"; } public virtual string Name() { return "Unnamed Object"; }
public virtual string Version() { return "1.0.0"; } public virtual string Version() { return "1.0.0"; }
public virtual string Author() { return GlobalVars.UserConfiguration.PlayerName; } public virtual string Author() { return GlobalVars.UserConfiguration.ReadSetting("PlayerName"); }
public virtual string FullInfoString() { return (Name() + " v" + Version() + " by " + Author()); } public virtual string FullInfoString() { return (Name() + " v" + Version() + " by " + Author()); }
public virtual void OnExtensionLoad() { } public virtual void OnExtensionLoad() { }
public virtual void OnExtensionUnload() { } public virtual void OnExtensionUnload() { }

View File

@ -39,7 +39,7 @@ namespace Novetus.Core
public void DoSetup() public void DoSetup()
{ {
if (GlobalVars.UserConfiguration.WebProxyInitialSetupRequired) if (GlobalVars.UserConfiguration.ReadSettingBool("WebProxyInitialSetupRequired"))
{ {
string text = "Would you like to enable the Novetus web proxy?\n\n" + string text = "Would you like to enable the Novetus web proxy?\n\n" +
"A web proxy redirects web traffic to a different location and in some cases can act as a gateway to different sites. Novetus uses the web proxy for additional client features and asset redirection.\n\n" + "A web proxy redirects web traffic to a different location and in some cases can act as a gateway to different sites. Novetus uses the web proxy for additional client features and asset redirection.\n\n" +
@ -55,7 +55,7 @@ namespace Novetus.Core
switch (result) switch (result)
{ {
case DialogResult.Yes: case DialogResult.Yes:
GlobalVars.UserConfiguration.WebProxyEnabled = true; GlobalVars.UserConfiguration.SaveSettingBool("WebProxyEnabled", true);
Start(); Start();
break; break;
case DialogResult.No: case DialogResult.No:
@ -63,12 +63,11 @@ namespace Novetus.Core
break; break;
} }
GlobalVars.UserConfiguration.WebProxyInitialSetupRequired = false; GlobalVars.UserConfiguration.SaveSettingBool("WebProxyInitialSetupRequired", false);
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
} }
else else
{ {
if (GlobalVars.UserConfiguration.WebProxyEnabled) if (GlobalVars.UserConfiguration.ReadSettingBool("WebProxyEnabled"))
{ {
Start(); Start();
} }

View File

@ -19,7 +19,7 @@ namespace Novetus.Core
{ {
public static void ReadClientValues(bool initial = false) public static void ReadClientValues(bool initial = false)
{ {
ReadClientValues(GlobalVars.UserConfiguration.SelectedClient, initial); ReadClientValues(GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), initial);
} }
public static void ReadClientValues(string ClientName, bool initial = false) public static void ReadClientValues(string ClientName, bool initial = false)
@ -186,7 +186,7 @@ namespace Novetus.Core
throw clientNotFoundEX; throw clientNotFoundEX;
}*/ }*/
string desc = "This client information file for '" + GlobalVars.UserConfiguration.SelectedClient + string desc = "This client information file for '" + GlobalVars.UserConfiguration.ReadSetting("SelectedClient") +
"' was pre-generated by Novetus for your convienence. You will need to load this clientinfo.nov file into the Client SDK for additional options. " "' was pre-generated by Novetus for your convienence. You will need to load this clientinfo.nov file into the Client SDK for additional options. "
+ LoremIpsum(1, 128, 1, 6, 1); + LoremIpsum(1, 128, 1, 6, 1);
@ -337,20 +337,20 @@ namespace Novetus.Core
string mapname = ""; string mapname = "";
if (GlobalVars.GameOpened != ScriptType.Client) if (GlobalVars.GameOpened != ScriptType.Client)
{ {
mapname = GlobalVars.UserConfiguration.Map; mapname = GlobalVars.UserConfiguration.ReadSetting("Map");
} }
UpdateRichPresence(state, GlobalVars.UserConfiguration.SelectedClient, mapname, initial); UpdateRichPresence(state, GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), mapname, initial);
} }
public static void UpdateRichPresence(GlobalVars.LauncherState state, string mapname, bool initial = false) public static void UpdateRichPresence(GlobalVars.LauncherState state, string mapname, bool initial = false)
{ {
UpdateRichPresence(state, GlobalVars.UserConfiguration.SelectedClient, mapname, initial); UpdateRichPresence(state, GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), mapname, initial);
} }
public static void UpdateRichPresence(GlobalVars.LauncherState state, string clientname, string mapname, bool initial = false) public static void UpdateRichPresence(GlobalVars.LauncherState state, string clientname, string mapname, bool initial = false)
{ {
if (GlobalVars.UserConfiguration.DiscordPresence) if (GlobalVars.UserConfiguration.ReadSettingBool("DiscordRichPresence"))
{ {
if (initial) if (initial)
{ {
@ -367,49 +367,49 @@ namespace Novetus.Core
GlobalVars.presence.smallImageKey = GlobalVars.image_inlauncher; GlobalVars.presence.smallImageKey = GlobalVars.image_inlauncher;
GlobalVars.presence.state = "In Launcher"; GlobalVars.presence.state = "In Launcher";
GlobalVars.presence.details = "Selected " + clientname; GlobalVars.presence.details = "Selected " + clientname;
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.ReadSetting("PlayerName") + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In Launcher"; GlobalVars.presence.smallImageText = "In Launcher";
break; break;
case GlobalVars.LauncherState.InMPGame: case GlobalVars.LauncherState.InMPGame:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "In " + clientname + " Multiplayer Game"; GlobalVars.presence.state = "In " + clientname + " Multiplayer Game";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.ReadSetting("PlayerName") + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In " + clientname + " Multiplayer Game"; GlobalVars.presence.smallImageText = "In " + clientname + " Multiplayer Game";
break; break;
case GlobalVars.LauncherState.InSoloGame: case GlobalVars.LauncherState.InSoloGame:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "In " + clientname + " Solo Game"; GlobalVars.presence.state = "In " + clientname + " Solo Game";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.ReadSetting("PlayerName") + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In " + clientname + " Solo Game"; GlobalVars.presence.smallImageText = "In " + clientname + " Solo Game";
break; break;
case GlobalVars.LauncherState.InStudio: case GlobalVars.LauncherState.InStudio:
GlobalVars.presence.smallImageKey = GlobalVars.image_instudio; GlobalVars.presence.smallImageKey = GlobalVars.image_instudio;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "In " + clientname + " Studio"; GlobalVars.presence.state = "In " + clientname + " Studio";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.ReadSetting("PlayerName") + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In " + clientname + " Studio"; GlobalVars.presence.smallImageText = "In " + clientname + " Studio";
break; break;
case GlobalVars.LauncherState.InCustomization: case GlobalVars.LauncherState.InCustomization:
GlobalVars.presence.smallImageKey = GlobalVars.image_incustomization; GlobalVars.presence.smallImageKey = GlobalVars.image_incustomization;
GlobalVars.presence.details = "Customizing " + GlobalVars.UserConfiguration.PlayerName; GlobalVars.presence.details = "Customizing " + GlobalVars.UserConfiguration.ReadSetting("PlayerName");
GlobalVars.presence.state = "In Character Customization"; GlobalVars.presence.state = "In Character Customization";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.ReadSetting("PlayerName") + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "In Character Customization"; GlobalVars.presence.smallImageText = "In Character Customization";
break; break;
case GlobalVars.LauncherState.InEasterEggGame: case GlobalVars.LauncherState.InEasterEggGame:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "Reading a message."; GlobalVars.presence.state = "Reading a message.";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.ReadSetting("PlayerName") + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "Reading a message."; GlobalVars.presence.smallImageText = "Reading a message.";
break; break;
case GlobalVars.LauncherState.LoadingURI: case GlobalVars.LauncherState.LoadingURI:
GlobalVars.presence.smallImageKey = GlobalVars.image_ingame; GlobalVars.presence.smallImageKey = GlobalVars.image_ingame;
GlobalVars.presence.details = ValidMapname; GlobalVars.presence.details = ValidMapname;
GlobalVars.presence.state = "Joining a " + clientname + " Multiplayer Game"; GlobalVars.presence.state = "Joining a " + clientname + " Multiplayer Game";
GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.PlayerName + " | Novetus " + GlobalVars.ProgramInformation.Version; GlobalVars.presence.largeImageText = GlobalVars.UserConfiguration.ReadSetting("PlayerName") + " | Novetus " + GlobalVars.ProgramInformation.Version;
GlobalVars.presence.smallImageText = "Joining a " + clientname + " Multiplayer Game"; GlobalVars.presence.smallImageText = "Joining a " + clientname + " Multiplayer Game";
break; break;
default: default:
@ -435,7 +435,7 @@ namespace Novetus.Core
Util.FixedFileDelete(fullFilePath); Util.FixedFileDelete(fullFilePath);
} }
if (GlobalVars.UserConfiguration.QualityLevel != Settings.Level.Custom) if (GlobalVars.UserConfiguration.ReadSettingInt("QualityLevel") != (int)Settings.Level.Custom)
{ {
int GraphicsMode = 0; int GraphicsMode = 0;
@ -450,7 +450,7 @@ namespace Novetus.Core
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions) info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
{ {
switch (GlobalVars.UserConfiguration.GraphicsMode) switch ((Settings.Mode)GlobalVars.UserConfiguration.ReadSettingInt("GraphicsMode"))
{ {
case Settings.Mode.OpenGLStable: case Settings.Mode.OpenGLStable:
switch (info.ClientLoadOptions) switch (info.ClientLoadOptions)
@ -497,7 +497,7 @@ namespace Novetus.Core
int AA = 1; int AA = 1;
bool Shadows_2007 = true; bool Shadows_2007 = true;
switch (GlobalVars.UserConfiguration.QualityLevel) switch ((Settings.Level)GlobalVars.UserConfiguration.ReadSettingInt("QualityLevel"))
{ {
case Settings.Level.Automatic: case Settings.Level.Automatic:
//set everything to automatic. Some ultra settings will still be enabled. //set everything to automatic. Some ultra settings will still be enabled.
@ -576,7 +576,7 @@ namespace Novetus.Core
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions) info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
{ {
switch (GlobalVars.UserConfiguration.GraphicsMode) switch ((Settings.Mode)GlobalVars.UserConfiguration.ReadSettingInt("GraphicsMode"))
{ {
case Settings.Mode.OpenGLStable: case Settings.Mode.OpenGLStable:
switch (info.ClientLoadOptions) switch (info.ClientLoadOptions)
@ -651,7 +651,7 @@ namespace Novetus.Core
if (info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2007_NoGraphicsOptions || if (info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2007_NoGraphicsOptions ||
info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions) info.ClientLoadOptions != Settings.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions)
{ {
switch (GlobalVars.UserConfiguration.GraphicsMode) switch ((Settings.Mode)GlobalVars.UserConfiguration.ReadSettingInt("GraphicsMode"))
{ {
case Settings.Mode.OpenGLStable: case Settings.Mode.OpenGLStable:
switch (info.ClientLoadOptions) switch (info.ClientLoadOptions)
@ -813,7 +813,7 @@ namespace Novetus.Core
public static string GetLuaFileName(ScriptType type) public static string GetLuaFileName(ScriptType type)
{ {
return GetLuaFileName(GlobalVars.UserConfiguration.SelectedClient, type); return GetLuaFileName(GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), type);
} }
public static string GetLuaFileName(string ClientName, ScriptType type) public static string GetLuaFileName(string ClientName, ScriptType type)
@ -877,7 +877,7 @@ namespace Novetus.Core
public static string GetClientEXEDir(ScriptType type) public static string GetClientEXEDir(ScriptType type)
{ {
return GetClientEXEDir(GlobalVars.UserConfiguration.SelectedClient, type); return GetClientEXEDir(GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), type);
} }
public static string GetClientEXEDir(string ClientName, ScriptType type) public static string GetClientEXEDir(string ClientName, ScriptType type)
@ -963,12 +963,12 @@ namespace Novetus.Core
public static void DecompressMap(ScriptType type, bool nomap) public static void DecompressMap(ScriptType type, bool nomap)
{ {
if ((type != ScriptType.Client || type != ScriptType.EasterEgg) && !nomap && GlobalVars.UserConfiguration.Map.Contains(".bz2")) if ((type != ScriptType.Client || type != ScriptType.EasterEgg) && !nomap && GlobalVars.UserConfiguration.ReadSetting("Map").Contains(".bz2"))
{ {
Util.Decompress(GlobalVars.UserConfiguration.MapPath, true); Util.Decompress(GlobalVars.UserConfiguration.ReadSetting("MapPath"), true);
GlobalVars.UserConfiguration.MapPath = GlobalVars.UserConfiguration.MapPath.Replace(".bz2", ""); GlobalVars.UserConfiguration.SaveSetting("MapPath", GlobalVars.UserConfiguration.ReadSetting("MapPath").Replace(".bz2", ""));
GlobalVars.UserConfiguration.Map = GlobalVars.UserConfiguration.Map.Replace(".bz2", ""); GlobalVars.UserConfiguration.SaveSetting("Map", GlobalVars.UserConfiguration.ReadSetting("Map").Replace(".bz2", ""));
GlobalVars.isMapCompressed = true; GlobalVars.isMapCompressed = true;
} }
} }
@ -977,9 +977,9 @@ namespace Novetus.Core
{ {
if (GlobalVars.isMapCompressed) if (GlobalVars.isMapCompressed)
{ {
Util.FixedFileDelete(GlobalVars.UserConfiguration.MapPath); Util.FixedFileDelete(GlobalVars.UserConfiguration.ReadSetting("MapPath"));
GlobalVars.UserConfiguration.MapPath = GlobalVars.UserConfiguration.MapPath.Replace(".rbxlx", ".rbxlx.bz2").Replace(".rbxl", ".rbxl.bz2"); GlobalVars.UserConfiguration.SaveSetting("MapPath", GlobalVars.UserConfiguration.ReadSetting("MapPath").Replace(".rbxlx", ".rbxlx.bz2").Replace(".rbxl", ".rbxl.bz2"));
GlobalVars.UserConfiguration.Map = GlobalVars.UserConfiguration.Map.Replace(".rbxlx", ".rbxlx.bz2").Replace(".rbxl", ".rbxl.bz2"); GlobalVars.UserConfiguration.SaveSetting("Map", GlobalVars.UserConfiguration.ReadSetting("Map").Replace(".rbxlx", ".rbxlx.bz2").Replace(".rbxl", ".rbxl.bz2"));
GlobalVars.isMapCompressed = false; GlobalVars.isMapCompressed = false;
} }
} }
@ -992,9 +992,9 @@ namespace Novetus.Core
#endif #endif
{ {
#if URI #if URI
LaunchRBXClient(GlobalVars.UserConfiguration.SelectedClient, type, no3d, nomap, e, label); LaunchRBXClient(GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), type, no3d, nomap, e, label);
#else #else
LaunchRBXClient(GlobalVars.UserConfiguration.SelectedClient, type, no3d, nomap, e); LaunchRBXClient(GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), type, no3d, nomap, e);
#endif #endif
} }
@ -1010,7 +1010,7 @@ namespace Novetus.Core
string[] parsedFileParams = extractedFile.Split('|'); string[] parsedFileParams = extractedFile.Split('|');
string filePath = parsedFileParams[0]; string filePath = parsedFileParams[0];
string fileMD5 = parsedFileParams[1]; string fileMD5 = parsedFileParams[1];
string fullFilePath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\" + filePath; string fullFilePath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.ReadSetting("SelectedClient") + @"\\" + filePath;
if (!CheckMD5(fileMD5, fullFilePath)) if (!CheckMD5(fileMD5, fullFilePath))
{ {
@ -1137,7 +1137,7 @@ namespace Novetus.Core
FileManagement.ReloadLoadoutValue(true); FileManagement.ReloadLoadoutValue(true);
break; break;
case ScriptType.Server: case ScriptType.Server:
if (GlobalVars.UserConfiguration.FirstServerLaunch) if (GlobalVars.UserConfiguration.ReadSettingBool("FirstServerLaunch"))
{ {
#if LAUNCHER #if LAUNCHER
string hostingTips = "Tips for your first time:\n\nMake sure your server's port forwarded (set up in your router), going through a tunnel server, or running from UPnP.\n" + string hostingTips = "Tips for your first time:\n\nMake sure your server's port forwarded (set up in your router), going through a tunnel server, or running from UPnP.\n" +
@ -1153,7 +1153,7 @@ namespace Novetus.Core
Util.ConsolePrint("Tips: " + hostingTips, 4); Util.ConsolePrint("Tips: " + hostingTips, 4);
} }
#endif #endif
GlobalVars.UserConfiguration.FirstServerLaunch = false; GlobalVars.UserConfiguration.SaveSettingBool("FirstServerLaunch", false);
} }
break; break;
case ScriptType.Solo: case ScriptType.Solo:
@ -1167,8 +1167,8 @@ namespace Novetus.Core
string luafile = GetLuaFileName(ClientName, type); string luafile = GetLuaFileName(ClientName, type);
string rbxexe = GetClientEXEDir(ClientName, type); string rbxexe = GetClientEXEDir(ClientName, type);
bool isEasterEgg = (type.Equals(ScriptType.EasterEggServer)); bool isEasterEgg = (type.Equals(ScriptType.EasterEggServer));
string mapfile = isEasterEgg ? GlobalPaths.DataDir + "\\Appreciation.rbxl" : (nomap ? (type.Equals(ScriptType.Studio) ? GlobalPaths.ConfigDir + "\\Place1.rbxl" : "") : GlobalVars.UserConfiguration.MapPath); string mapfile = isEasterEgg ? GlobalPaths.DataDir + "\\Appreciation.rbxl" : (nomap ? (type.Equals(ScriptType.Studio) ? GlobalPaths.ConfigDir + "\\Place1.rbxl" : "") : GlobalVars.UserConfiguration.ReadSetting("MapPath"));
string mapname = isEasterEgg ? "" : (nomap ? "" : GlobalVars.UserConfiguration.Map); string mapname = isEasterEgg ? "" : (nomap ? "" : GlobalVars.UserConfiguration.ReadSetting("Map"));
FileFormat.ClientInfo info = GetClientInfoValues(ClientName); FileFormat.ClientInfo info = GetClientInfoValues(ClientName);
string quote = "\""; string quote = "\"";
string args = ""; string args = "";
@ -1364,7 +1364,7 @@ namespace Novetus.Core
client.Exited += e; client.Exited += e;
} }
client.Start(); client.Start();
client.PriorityClass = GlobalVars.UserConfiguration.Priority; client.PriorityClass = (ProcessPriorityClass)GlobalVars.UserConfiguration.ReadSettingInt("Priority");
if (!customization) if (!customization)
{ {
@ -1449,7 +1449,7 @@ namespace Novetus.Core
public static string GetScriptFuncForType(ScriptType type) public static string GetScriptFuncForType(ScriptType type)
{ {
return GetScriptFuncForType(GlobalVars.UserConfiguration.SelectedClient, type); return GetScriptFuncForType(GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), type);
} }
public static string GetScriptFuncForType(string ClientName, ScriptType type) public static string GetScriptFuncForType(string ClientName, ScriptType type)
@ -1488,33 +1488,33 @@ namespace Novetus.Core
case ScriptType.Client: case ScriptType.Client:
case ScriptType.EasterEgg: case ScriptType.EasterEgg:
return "_G.CSConnect(" return "_G.CSConnect("
+ (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + (info.UsesID ? GlobalVars.UserConfiguration.ReadSettingInt("UserID") : 0) + ",'"
+ GlobalVars.CurrentServer.ServerIP + "'," + GlobalVars.CurrentServer.ServerIP + "',"
+ GlobalVars.CurrentServer.ServerPort + ",'" + GlobalVars.CurrentServer.ServerPort + ",'"
+ (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + (info.UsesPlayerName ? GlobalVars.UserConfiguration.ReadSetting("PlayerName") : "Player") + "',"
+ GlobalVars.Loadout + "," + GlobalVars.Loadout + ","
+ md5s + ",'" + md5s + ",'"
+ GlobalVars.PlayerTripcode + GlobalVars.PlayerTripcode
+ ((GlobalVars.ValidatedExtraFiles > 0) ? "'," + GlobalVars.ValidatedExtraFiles.ToString() + "," : "',0,") + ((GlobalVars.ValidatedExtraFiles > 0) ? "'," + GlobalVars.ValidatedExtraFiles.ToString() + "," : "',0,")
+ GlobalVars.UserConfiguration.NewGUI.ToString().ToLower() + ");"; + GlobalVars.UserConfiguration.ReadSetting("NewGUI").ToLower() + ");";
case ScriptType.Server: case ScriptType.Server:
case ScriptType.EasterEggServer: case ScriptType.EasterEggServer:
return "_G.CSServer(" return "_G.CSServer("
+ GlobalVars.UserConfiguration.RobloxPort + "," + GlobalVars.UserConfiguration.ReadSetting("RobloxPort") + ","
+ GlobalVars.UserConfiguration.PlayerLimit + "," + GlobalVars.UserConfiguration.ReadSetting("PlayerLimit") + ","
+ md5s + "," + md5s + ","
+ GlobalVars.UserConfiguration.ShowServerNotifications.ToString().ToLower() + GlobalVars.UserConfiguration.ReadSetting("ShowServerNotifications").ToLower()
+ ((GlobalVars.ValidatedExtraFiles > 0) ? "," + GlobalVars.ValidatedExtraFiles.ToString() + "," : ",0,") + ((GlobalVars.ValidatedExtraFiles > 0) ? "," + GlobalVars.ValidatedExtraFiles.ToString() + "," : ",0,")
+ GlobalVars.UserConfiguration.NewGUI.ToString().ToLower() + ");"; + GlobalVars.UserConfiguration.ReadSetting("NewGUI").ToLower() + ");";
case ScriptType.Solo: case ScriptType.Solo:
return "_G.CSSolo(" return "_G.CSSolo("
+ (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'" + (info.UsesID ? GlobalVars.UserConfiguration.ReadSettingInt("UserID") : 0) + ", '"
+ (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + (info.UsesPlayerName ? GlobalVars.UserConfiguration.ReadSetting("PlayerName") : "Player") + "',"
+ GlobalVars.soloLoadout + "," + GlobalVars.soloLoadout + ","
+ GlobalVars.UserConfiguration.NewGUI.ToString().ToLower() + ");"; + GlobalVars.UserConfiguration.ReadSetting("NewGUI").ToLower() + ");";
case ScriptType.Studio: case ScriptType.Studio:
return "_G.CSStudio(" return "_G.CSStudio("
+ GlobalVars.UserConfiguration.NewGUI.ToString().ToLower() + ");"; + GlobalVars.UserConfiguration.ReadSetting("NewGUI").ToLower() + ");";
default: default:
return ""; return "";
} }
@ -1542,7 +1542,7 @@ namespace Novetus.Core
public static void GenerateScriptForClient(ScriptType type) public static void GenerateScriptForClient(ScriptType type)
{ {
GenerateScriptForClient(GlobalVars.UserConfiguration.SelectedClient, type); GenerateScriptForClient(GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), type);
} }
public static void GenerateScriptForClient(string ClientName, ScriptType type) public static void GenerateScriptForClient(string ClientName, ScriptType type)
@ -1681,7 +1681,7 @@ namespace Novetus.Core
public static int ConvertIconStringToInt() public static int ConvertIconStringToInt()
{ {
switch (GlobalVars.UserCustomization.Icon) switch (GlobalVars.UserCustomization.ReadSetting("Icon"))
{ {
case "BC": case "BC":
return 1; return 1;
@ -1738,14 +1738,14 @@ namespace Novetus.Core
public static string CopyMapToRBXAsset() public static string CopyMapToRBXAsset()
{ {
string clientcontentpath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\temp.rbxl"; string clientcontentpath = GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.ReadSetting("SelectedClient") + @"\\content\\temp.rbxl";
Util.FixedFileCopy(GlobalVars.UserConfiguration.MapPath, clientcontentpath, true); Util.FixedFileCopy(GlobalVars.UserConfiguration.ReadSetting("MapPath"), clientcontentpath, true);
return GlobalPaths.AltBaseGameDir + "temp.rbxl"; return GlobalPaths.AltBaseGameDir + "temp.rbxl";
} }
public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true) public static string CompileScript(string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true)
{ {
return CompileScript(GlobalVars.UserConfiguration.SelectedClient, code, tag, endtag, mapfile, luafile, rbxexe, usesharedtags); return CompileScript(GlobalVars.UserConfiguration.ReadSetting("SelectedClient"), code, tag, endtag, mapfile, luafile, rbxexe, usesharedtags);
} }
public static string CompileScript(string ClientName, string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true) public static string CompileScript(string ClientName, string code, string tag, string endtag, string mapfile, string luafile, string rbxexe, bool usesharedtags = true)
@ -1815,44 +1815,44 @@ namespace Novetus.Core
#else #else
string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : ""; string md5dir = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.RootPathLauncher + "\\Novetus.exe") : "";
#endif #endif
string md5script = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.SelectedClient + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : ""; string md5script = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(GlobalPaths.ClientDir + @"\\" + GlobalVars.UserConfiguration.ReadSetting("SelectedClient") + @"\\content\\scripts\\" + GlobalPaths.ScriptName + ".lua") : "";
string md5exe = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : ""; string md5exe = !info.AlreadyHasSecurity ? SecurityFuncs.GenerateMD5(rbxexe) : "";
string md5sd = "'" + md5exe + "','" + md5dir + "','" + md5script + "'"; string md5sd = "'" + md5exe + "','" + md5dir + "','" + md5script + "'";
string md5s = "'" + info.ClientMD5 + "','" + md5dir + "','" + info.ScriptMD5 + "'"; string md5s = "'" + info.ClientMD5 + "','" + md5dir + "','" + info.ScriptMD5 + "'";
string compiled = extractedCode.Replace("%version%", GlobalVars.ProgramInformation.Version) string compiled = extractedCode.Replace("%version%", GlobalVars.ProgramInformation.Version)
.Replace("%mapfile%", mapfile) .Replace("%mapfile%", mapfile)
.Replace("%luafile%", luafile) .Replace("%luafile%", luafile)
.Replace("%charapp%", GlobalVars.UserCustomization.CharacterID) .Replace("%charapp%", GlobalVars.UserCustomization.ReadSetting("CharacterID"))
.Replace("%server%", GlobalVars.CurrentServer.ToString()) .Replace("%server%", GlobalVars.CurrentServer.ToString())
.Replace("%ip%", GlobalVars.CurrentServer.ServerIP) .Replace("%ip%", GlobalVars.CurrentServer.ServerIP)
.Replace("%port%", GlobalVars.UserConfiguration.RobloxPort.ToString()) .Replace("%port%", GlobalVars.UserConfiguration.ReadSetting("RobloxPort"))
.Replace("%joinport%", GlobalVars.CurrentServer.ServerPort.ToString()) .Replace("%joinport%", GlobalVars.CurrentServer.ServerPort.ToString())
.Replace("%name%", GlobalVars.UserConfiguration.PlayerName) .Replace("%name%", GlobalVars.UserConfiguration.ReadSetting("PlayerName"))
.Replace("%icone%", ConvertIconStringToInt().ToString()) .Replace("%icone%", ConvertIconStringToInt().ToString())
.Replace("%icon%", GlobalVars.UserCustomization.Icon) .Replace("%icon%", GlobalVars.UserCustomization.ReadSetting("Icon"))
.Replace("%id%", GlobalVars.UserConfiguration.UserID.ToString()) .Replace("%id%", GlobalVars.UserConfiguration.ReadSetting("UserID"))
.Replace("%face%", GlobalVars.UserCustomization.Face) .Replace("%face%", GlobalVars.UserCustomization.ReadSetting("Face"))
.Replace("%head%", GlobalVars.UserCustomization.Head) .Replace("%head%", GlobalVars.UserCustomization.ReadSetting("Head"))
.Replace("%tshirt%", GlobalVars.UserCustomization.TShirt) .Replace("%tshirt%", GlobalVars.UserCustomization.ReadSetting("TShirt"))
.Replace("%shirt%", GlobalVars.UserCustomization.Shirt) .Replace("%shirt%", GlobalVars.UserCustomization.ReadSetting("Shirt"))
.Replace("%pants%", GlobalVars.UserCustomization.Pants) .Replace("%pants%", GlobalVars.UserCustomization.ReadSetting("Pants"))
.Replace("%hat1%", GlobalVars.UserCustomization.Hat1) .Replace("%hat1%", GlobalVars.UserCustomization.ReadSetting("Hat1"))
.Replace("%hat2%", GlobalVars.UserCustomization.Hat2) .Replace("%hat2%", GlobalVars.UserCustomization.ReadSetting("Hat2"))
.Replace("%hat3%", GlobalVars.UserCustomization.Hat3) .Replace("%hat3%", GlobalVars.UserCustomization.ReadSetting("Hat3"))
.Replace("%faced%", GlobalVars.UserCustomization.Face.Contains("http://") ? GlobalVars.UserCustomization.Face : GlobalPaths.faceGameDir + GlobalVars.UserCustomization.Face) .Replace("%faced%", GlobalVars.UserCustomization.ReadSetting("Face").Contains("http://") ? GlobalVars.UserCustomization.ReadSetting("Face") : GlobalPaths.faceGameDir + GlobalVars.UserCustomization.ReadSetting("Face"))
.Replace("%headd%", GlobalPaths.headGameDir + GlobalVars.UserCustomization.Head) .Replace("%headd%", GlobalPaths.headGameDir + GlobalVars.UserCustomization.ReadSetting("Head"))
.Replace("%tshirtd%", GlobalVars.UserCustomization.TShirt.Contains("http://") ? GlobalVars.UserCustomization.TShirt : GlobalPaths.tshirtGameDir + GlobalVars.UserCustomization.TShirt) .Replace("%tshirtd%", GlobalVars.UserCustomization.ReadSetting("TShirt").Contains("http://") ? GlobalVars.UserCustomization.ReadSetting("TShirt") : GlobalPaths.tshirtGameDir + GlobalVars.UserCustomization.ReadSetting("TShirt"))
.Replace("%shirtd%", GlobalVars.UserCustomization.Shirt.Contains("http://") ? GlobalVars.UserCustomization.Shirt : GlobalPaths.shirtGameDir + GlobalVars.UserCustomization.Shirt) .Replace("%shirtd%", GlobalVars.UserCustomization.ReadSetting("Shirt").Contains("http://") ? GlobalVars.UserCustomization.ReadSetting("Shirt") : GlobalPaths.shirtGameDir + GlobalVars.UserCustomization.ReadSetting("Shirt"))
.Replace("%pantsd%", GlobalVars.UserCustomization.Pants.Contains("http://") ? GlobalVars.UserCustomization.Pants : GlobalPaths.pantsGameDir + GlobalVars.UserCustomization.Pants) .Replace("%pantsd%", GlobalVars.UserCustomization.ReadSetting("Pants").Contains("http://") ? GlobalVars.UserCustomization.ReadSetting("Pants") : GlobalPaths.pantsGameDir + GlobalVars.UserCustomization.ReadSetting("Pants"))
.Replace("%hat1d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat1) .Replace("%hat1d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.ReadSetting("Hat1"))
.Replace("%hat2d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat2) .Replace("%hat2d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.ReadSetting("Hat1"))
.Replace("%hat3d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Hat3) .Replace("%hat3d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.ReadSetting("Hat1"))
.Replace("%headcolor%", GlobalVars.UserCustomization.HeadColorID.ToString()) .Replace("%headcolor%", GlobalVars.UserCustomization.ReadSetting("HeadColorID"))
.Replace("%torsocolor%", GlobalVars.UserCustomization.TorsoColorID.ToString()) .Replace("%torsocolor%", GlobalVars.UserCustomization.ReadSetting("TorsoColorID"))
.Replace("%larmcolor%", GlobalVars.UserCustomization.LeftArmColorID.ToString()) .Replace("%larmcolor%", GlobalVars.UserCustomization.ReadSetting("LeftArmColorID"))
.Replace("%llegcolor%", GlobalVars.UserCustomization.LeftLegColorID.ToString()) .Replace("%llegcolor%", GlobalVars.UserCustomization.ReadSetting("LeftLegColorID"))
.Replace("%rarmcolor%", GlobalVars.UserCustomization.RightArmColorID.ToString()) .Replace("%rarmcolor%", GlobalVars.UserCustomization.ReadSetting("RightArmColorID"))
.Replace("%rlegcolor%", GlobalVars.UserCustomization.RightLegColorID.ToString()) .Replace("%rlegcolor%", GlobalVars.UserCustomization.ReadSetting("RightLegColorID"))
.Replace("%md5launcher%", md5dir) .Replace("%md5launcher%", md5dir)
.Replace("%md5script%", info.ScriptMD5) .Replace("%md5script%", info.ScriptMD5)
.Replace("%md5exe%", info.ClientMD5) .Replace("%md5exe%", info.ClientMD5)
@ -1860,16 +1860,16 @@ namespace Novetus.Core
.Replace("%md5exed%", md5exe) .Replace("%md5exed%", md5exe)
.Replace("%md5s%", md5s) .Replace("%md5s%", md5s)
.Replace("%md5sd%", md5sd) .Replace("%md5sd%", md5sd)
.Replace("%limit%", GlobalVars.UserConfiguration.PlayerLimit.ToString()) .Replace("%limit%", GlobalVars.UserConfiguration.ReadSetting("PlayerLimit"))
.Replace("%extra%", GlobalVars.UserCustomization.Extra) .Replace("%extra%", GlobalVars.UserCustomization.ReadSetting("Extra"))
.Replace("%hat4%", GlobalVars.UserCustomization.Extra) .Replace("%hat4%", GlobalVars.UserCustomization.ReadSetting("Extra"))
.Replace("%extrad%", GlobalPaths.extraGameDir + GlobalVars.UserCustomization.Extra) .Replace("%extrad%", GlobalPaths.extraGameDir + GlobalVars.UserCustomization.ReadSetting("Extra"))
.Replace("%hat4d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Extra) .Replace("%hat4d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.ReadSetting("Extra"))
.Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\").Replace(@"/", @"\")) .Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.ReadSetting("MapPathSnip").Replace(@"\\", @"\").Replace(@"/", @"\"))
.Replace("%mapfilec%", extractedCode.Contains("%mapfilec%") ? CopyMapToRBXAsset() : "") .Replace("%mapfilec%", extractedCode.Contains("%mapfilec%") ? CopyMapToRBXAsset() : "")
.Replace("%tripcode%", GlobalVars.PlayerTripcode) .Replace("%tripcode%", GlobalVars.PlayerTripcode)
.Replace("%scripttype%", Generator.GetNameForType(type)) .Replace("%scripttype%", Generator.GetNameForType(type))
.Replace("%notifications%", GlobalVars.UserConfiguration.ShowServerNotifications.ToString().ToLower()) .Replace("%notifications%", GlobalVars.UserConfiguration.ReadSetting("ShowServerNotifications").ToLower())
.Replace("%loadout%", code.Contains("<solo>") ? GlobalVars.soloLoadout : GlobalVars.Loadout) .Replace("%loadout%", code.Contains("<solo>") ? GlobalVars.soloLoadout : GlobalVars.Loadout)
.Replace("%validatedextrafiles%", GlobalVars.ValidatedExtraFiles.ToString()) .Replace("%validatedextrafiles%", GlobalVars.ValidatedExtraFiles.ToString())
.Replace("%argstring%", GetRawArgsForType(type, ClientName, luafile)) .Replace("%argstring%", GetRawArgsForType(type, ClientName, luafile))
@ -1881,7 +1881,7 @@ namespace Novetus.Core
.Replace("%shirttexidlocal%", GlobalVars.ShirtTextureLocal) .Replace("%shirttexidlocal%", GlobalVars.ShirtTextureLocal)
.Replace("%pantstexidlocal%", GlobalVars.PantsTextureLocal) .Replace("%pantstexidlocal%", GlobalVars.PantsTextureLocal)
.Replace("%facetexlocal%", GlobalVars.FaceTextureLocal) .Replace("%facetexlocal%", GlobalVars.FaceTextureLocal)
.Replace("%newgui%", GlobalVars.UserConfiguration.NewGUI.ToString().ToLower()); .Replace("%newgui%", GlobalVars.UserConfiguration.ReadSetting("NewGUI").ToLower());
return compiled; return compiled;
} }

View File

@ -58,127 +58,209 @@ namespace Novetus.Core
} }
#endregion #endregion
#region Configuration #region ConfigBase
public class Config public class ConfigBase
{ {
public Config() public INIFile INI;
private string Section { get; set; }
private string Path { get; set; }
public ConfigBase(string section, string path)
{ {
SelectedClient = ""; Section = section;
Map = ""; Path = path;
CloseOnLaunch = false;
UserID = 0; bool fileExists = File.Exists(Path);
PlayerName = "Player";
RobloxPort = 53640; if (!fileExists)
PlayerLimit = 12; {
UPnP = false; CreateFile();
DisabledAssetSDKHelp = false; }
DiscordPresence = true; else
MapPath = ""; {
MapPathSnip = ""; INI = new INIFile(Path, false);
GraphicsMode = Settings.Mode.Automatic; }
QualityLevel = Settings.Level.Automatic;
LauncherStyle = Settings.Style.Stylish;
AssetSDKFixerSaveBackups = true;
AlternateServerIP = "";
ShowServerNotifications = false;
ServerBrowserServerName = "Novetus";
ServerBrowserServerAddress = "";
Priority = ProcessPriorityClass.RealTime;
FirstServerLaunch = true;
NewGUI = false;
URIQuickConfigure = true;
BootstrapperShowUI = true;
WebProxyInitialSetupRequired = true;
WebProxyEnabled = false;
} }
public string SelectedClient { get; set; } public void CreateFile()
public string Map { get; set; } {
public bool CloseOnLaunch { get; set; } INI = new INIFile(Path);
public int UserID { get; set; } GenerateDefaults();
public string PlayerName { get; set; } GenerateDefaultsEvent();
public int RobloxPort { get; set; } }
public int PlayerLimit { get; set; }
public bool UPnP { get; set; } public virtual void GenerateDefaults()
public bool DisabledAssetSDKHelp { get; set; } {
public bool DiscordPresence { get; set; } //defaults go in here.
public string MapPath { get; set; } }
public string MapPathSnip { get; set; }
public Settings.Mode GraphicsMode { get; set; } public virtual void GenerateDefaultsEvent()
public Settings.Level QualityLevel { get; set; } {
public Settings.Style LauncherStyle { get; set; } //generate default event goes in here.
public bool AssetSDKFixerSaveBackups { get; set; } }
public string AlternateServerIP { get; set; }
public bool ShowServerNotifications { get; set; } public void LoadAllSettings(string inputPath)
public string ServerBrowserServerName { get; set; } {
public string ServerBrowserServerAddress { get; set; } File.SetAttributes(Path, FileAttributes.Normal);
public ProcessPriorityClass Priority { get; set; } File.Replace(inputPath, Path, null);
public bool FirstServerLaunch { get; set; } }
public bool NewGUI { get; set; }
public bool URIQuickConfigure { get; set; } public void SaveSetting(string name, string value)
public bool BootstrapperShowUI { get; set; } {
public bool WebProxyInitialSetupRequired { get; set; } SaveSetting(Section, name, value);
public bool WebProxyEnabled { get; set; } }
public void SaveSetting(string section, string name, string value)
{
INI.IniWriteValue(section, name, value);
SaveSettingEvent();
}
public void SaveSettingInt(string name, int value)
{
SaveSettingInt(Section, name, value);
}
public void SaveSettingInt(string section, string name, int value)
{
INI.IniWriteValue(section, name, value.ToString());
SaveSettingEvent();
}
public void SaveSettingBool(string name, bool value)
{
SaveSettingBool(Section, name, value);
}
public void SaveSettingBool(string section, string name, bool value)
{
INI.IniWriteValue(section, name, value.ToString());
SaveSettingEvent();
}
public virtual void SaveSettingEvent()
{
//save setting event goes in here.
}
public string ReadSetting(string name)
{
string value = INI.IniReadValue(Section, name);
if (!string.IsNullOrWhiteSpace(value))
{
ReadSettingEvent();
return INI.IniReadValue(Section, name);
}
else
{
return "";
}
}
public int ReadSettingInt(string name)
{
return Convert.ToInt32(ReadSetting(name));
}
public bool ReadSettingBool(string name)
{
return Convert.ToBoolean(ReadSetting(name));
}
public virtual void ReadSettingEvent()
{
//read setting event.
}
}
#endregion
#region Configuration
public class Config : ConfigBase
{
public Config() : base("Config", GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName) { }
public override void GenerateDefaults()
{
SaveSetting("SelectedClient", "");
SaveSetting("Map", "");
SaveSettingBool("CloseOnLaunch", false);
SaveSettingInt("UserID", NovetusFuncs.GeneratePlayerID());
SaveSetting("PlayerName", "Player");
SaveSettingInt("RobloxPort", 53640);
SaveSettingInt("PlayerLimit", 12);
SaveSettingBool("UPnP", false);
SaveSettingBool("DisabledAssetSDKHelp", false);
SaveSettingBool("DiscordRichPresence", true);
SaveSetting("MapPath", "");
SaveSetting("MapPathSnip", "");
SaveSettingInt("GraphicsMode", (int)Settings.Mode.Automatic);
SaveSettingInt("QualityLevel", (int)Settings.Level.Automatic);
if (Util.IsWineRunning())
{
SaveSettingInt("LauncherStyle", (int)Settings.Style.Extended);
}
else
{
SaveSettingInt("LauncherStyle", (int)Settings.Style.Stylish);
}
SaveSettingBool("AssetSDKFixerSaveBackups", true);
SaveSetting("AlternateServerIP", "");
SaveSettingBool("ShowServerNotifications", false);
SaveSetting("ServerBrowserServerName", "Novetus");
SaveSetting("ServerBrowserServerAddress", "");
SaveSettingInt("Priority", (int)ProcessPriorityClass.RealTime);
SaveSettingBool("FirstServerLaunch", true);
SaveSettingBool("NewGUI", false);
SaveSettingBool("URIQuickConfigure", true);
SaveSettingBool("BootstrapperShowUI", true);
SaveSettingBool("WebProxyInitialSetupRequired", true);
SaveSettingBool("WebProxyEnabled", false);
}
} }
#endregion #endregion
#region Customization Configuration #region Customization Configuration
public class CustomizationConfig public class CustomizationConfig : ConfigBase
{ {
public CustomizationConfig() public CustomizationConfig() : base("Items", GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization) { }
public override void GenerateDefaults()
{ {
Hat1 = "NoHat.rbxm"; SaveSetting("Items", "Hat1", "NoHat.rbxm");
Hat2 = "NoHat.rbxm"; SaveSetting("Items", "Hat2", "NoHat.rbxm");
Hat3 = "NoHat.rbxm"; SaveSetting("Items", "Hat3", "NoHat.rbxm");
Face = "DefaultFace.rbxm"; SaveSetting("Items", "Face", "DefaultFace.rbxm");
Head = "DefaultHead.rbxm"; SaveSetting("Items", "Head", "DefaultHead.rbxm");
TShirt = "NoTShirt.rbxm"; SaveSetting("Items", "TShirt", "NoTShirt.rbxm");
Shirt = "NoShirt.rbxm"; SaveSetting("Items", "Shirt", "NoShirt.rbxm");
Pants = "NoPants.rbxm"; SaveSetting("Items", "Pants", "NoPants.rbxm");
Icon = "NBC"; SaveSetting("Items", "Icon", "NBC");
Extra = "NoExtra.rbxm"; SaveSetting("Items", "Extra", "NoExtra.rbxm");
HeadColorID = 24; SaveSettingInt("Colors", "HeadColorID", 24);
TorsoColorID = 23; SaveSettingInt("Colors", "TorsoColorID", 23);
LeftArmColorID = 24; SaveSettingInt("Colors", "LeftArmColorID", 24);
RightArmColorID = 24; SaveSettingInt("Colors", "RightArmColorID", 24);
LeftLegColorID = 119; SaveSettingInt("Colors", "LeftLegColorID", 119);
RightLegColorID = 119; SaveSettingInt("Colors", "RightLegColorID", 119);
HeadColorString = "Color [A=255, R=245, G=205, B=47]"; SaveSetting("Colors", "HeadColorString", "Color [A=255, R=245, G=205, B=47]");
TorsoColorString = "Color [A=255, R=13, G=105, B=172]"; SaveSetting("Colors", "TorsoColorString", "Color [A=255, R=13, G=105, B=172]");
LeftArmColorString = "Color [A=255, R=245, G=205, B=47]"; SaveSetting("Colors", "LeftArmColorString", "Color [A=255, R=245, G=205, B=47]");
RightArmColorString = "Color [A=255, R=245, G=205, B=47]"; SaveSetting("Colors", "RightArmColorString", "Color [A=255, R=245, G=205, B=47]");
LeftLegColorString = "Color [A=255, R=164, G=189, B=71]"; SaveSetting("Colors", "LeftLegColorString", "Color [A=255, R=164, G=189, B=71]");
RightLegColorString = "Color [A=255, R=164, G=189, B=71]"; SaveSetting("Colors", "RightLegColorString", "Color [A=255, R=164, G=189, B=71]");
ExtraSelectionIsHat = false; SaveSettingBool("Other", "ExtraSelectionIsHat", false);
ShowHatsInExtra = false; SaveSettingBool("Other", "ShowHatsInExtra", false);
CharacterID = ""; SaveSetting("Other", "CharacterID", "");
} }
public string Hat1 { get; set; } public override void ReadSettingEvent()
public string Hat2 { get; set; } {
public string Hat3 { get; set; } FileManagement.ReloadLoadoutValue();
public string Face { get; set; } }
public string Head { get; set; }
public string TShirt { get; set; }
public string Shirt { get; set; }
public string Pants { get; set; }
public string Icon { get; set; }
public string Extra { get; set; }
public int HeadColorID { get; set; }
public int TorsoColorID { get; set; }
public int LeftArmColorID { get; set; }
public int RightArmColorID { get; set; }
public int LeftLegColorID { get; set; }
public int RightLegColorID { get; set; }
public string HeadColorString { get; set; }
public string TorsoColorString { get; set; }
public string LeftArmColorString { get; set; }
public string RightArmColorString { get; set; }
public string LeftLegColorString { get; set; }
public string RightLegColorString { get; set; }
public bool ExtraSelectionIsHat { get; set; }
public bool ShowHatsInExtra { get; set; }
public string CharacterID { get; set; }
} }
#endregion #endregion
@ -568,7 +650,7 @@ namespace Novetus.Core
public void LoadImage() public void LoadImage()
{ {
string ItemNameFixed = ItemName.Replace(" ", ""); string ItemNameFixed = ItemName.Replace(" ", "");
string dir = CopyToItemDir ? ItemDir + "\\" + ItemNameFixed : GlobalPaths.extradir + "\\icons\\" + GlobalVars.UserConfiguration.PlayerName; string dir = CopyToItemDir ? ItemDir + "\\" + ItemNameFixed : GlobalPaths.extradir + "\\icons\\" + GlobalVars.UserConfiguration.ReadSetting("PlayerName");
if (openFileDialog1.ShowDialog() == DialogResult.OK) if (openFileDialog1.ShowDialog() == DialogResult.OK)
{ {
@ -629,7 +711,7 @@ namespace Novetus.Core
string verNumber = "Invalid File"; string verNumber = "Invalid File";
INIFile ini = new INIFile(infopath); INIFile ini = new INIFile(infopath, false);
string section = "ProgramInfo"; string section = "ProgramInfo";
@ -699,10 +781,10 @@ namespace Novetus.Core
GlobalVars.ProgramInformation.InitialBootup = Convert.ToBoolean(initialBootup); GlobalVars.ProgramInformation.InitialBootup = Convert.ToBoolean(initialBootup);
GlobalVars.ProgramInformation.VersionName = verNumber; GlobalVars.ProgramInformation.VersionName = verNumber;
GlobalVars.ProgramInformation.IsSnapshot = Convert.ToBoolean(isSnapshot); GlobalVars.ProgramInformation.IsSnapshot = Convert.ToBoolean(isSnapshot);
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient; GlobalVars.UserConfiguration.SaveSetting("SelectedClient", GlobalVars.ProgramInformation.DefaultClient);
GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("Map", GlobalVars.ProgramInformation.DefaultMap);
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("MapPath", GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap);
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("MapPathSnip", GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -714,7 +796,7 @@ namespace Novetus.Core
public static void TurnOffInitialSequence() public static void TurnOffInitialSequence()
{ {
//READ //READ
INIFile ini = new INIFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName); INIFile ini = new INIFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, false);
string section = "ProgramInfo"; string section = "ProgramInfo";
string initialBootup = ini.IniReadValue(section, "InitialBootup", "True"); string initialBootup = ini.IniReadValue(section, "InitialBootup", "True");
@ -724,409 +806,29 @@ namespace Novetus.Core
} }
} }
public static string ConfigUseOldValIfExists(INIFile ini, string section, string oldKey, string newKey, string val, bool write) public static void GenerateTripcode()
{ {
if (write) //Powered by https://github.com/davcs86/csharp-uhwid
string curval = UHWIDEngine.AdvancedUid;
if (!GlobalVars.PlayerTripcode.Equals(curval))
{ {
if (!ini.IniValueExists(newKey)) GlobalVars.PlayerTripcode = curval;
{
if (GlobalVars.ProgramInformation.InitialBootup)
{
if (ini.IniValueExists(oldKey))
{
ini.IniWriteValue(section, oldKey, val);
}
else
{
ini.IniWriteValue(section, newKey, val);
}
}
else
{
ini.IniWriteValue(section, oldKey, val);
}
}
else
{
ini.IniWriteValue(section, newKey, val);
}
return "";
}
else
{
if (ini.IniValueExists(newKey))
{
return ini.IniReadValue(section, newKey, val);
}
else
{
return ini.IniReadValue(section, oldKey, val);
}
}
}
private static int ValueInt(string val, int defaultVal)
{
int res;
if (int.TryParse(val, out res))
{
return Convert.ToInt32(val);
}
else
{
return defaultVal;
}
}
private static bool ValueBool(string val, bool defaultVal)
{
bool res;
if (bool.TryParse(val, out res))
{
return Convert.ToBoolean(val);
}
else
{
return defaultVal;
}
}
public static void Config(string cfgpath, bool write, bool doubleCheck = false)
{
bool forcewrite = false;
if (!File.Exists(cfgpath))
{
// force write mode on if the file doesn't exist.
write = true;
forcewrite = true;
}
if (write)
{
if (Util.IsWineRunning())
{
GlobalVars.UserConfiguration.LauncherStyle = Settings.Style.Extended;
}
//WRITE
INIFile ini = new INIFile(cfgpath);
string section = "Config";
ini.IniWriteValue(section, "CloseOnLaunch", GlobalVars.UserConfiguration.CloseOnLaunch.ToString());
ini.IniWriteValue(section, "UserID", GlobalVars.UserConfiguration.UserID.ToString());
ini.IniWriteValue(section, "PlayerName", GlobalVars.UserConfiguration.PlayerName.ToString());
ini.IniWriteValue(section, "SelectedClient", GlobalVars.UserConfiguration.SelectedClient.ToString());
ini.IniWriteValue(section, "Map", GlobalVars.UserConfiguration.Map.ToString());
ini.IniWriteValue(section, "RobloxPort", GlobalVars.UserConfiguration.RobloxPort.ToString());
ini.IniWriteValue(section, "PlayerLimit", GlobalVars.UserConfiguration.PlayerLimit.ToString());
ini.IniWriteValue(section, "UPnP", GlobalVars.UserConfiguration.UPnP.ToString());
ini.IniWriteValue(section, "DiscordRichPresence", GlobalVars.UserConfiguration.DiscordPresence.ToString());
ini.IniWriteValue(section, "MapPath", GlobalVars.UserConfiguration.MapPath.ToString());
ini.IniWriteValue(section, "MapPathSnip", GlobalVars.UserConfiguration.MapPathSnip.ToString());
ini.IniWriteValue(section, "GraphicsMode", ((int)GlobalVars.UserConfiguration.GraphicsMode).ToString());
ini.IniWriteValue(section, "QualityLevel", ((int)GlobalVars.UserConfiguration.QualityLevel).ToString());
ini.IniWriteValue(section, "Style", ((int)GlobalVars.UserConfiguration.LauncherStyle).ToString());
ini.IniWriteValue(section, "AlternateServerIP", GlobalVars.UserConfiguration.AlternateServerIP.ToString());
ini.IniWriteValue(section, "ShowServerNotifications", GlobalVars.UserConfiguration.ShowServerNotifications.ToString());
ini.IniWriteValue(section, "ServerBrowserServerName", GlobalVars.UserConfiguration.ServerBrowserServerName.ToString());
ini.IniWriteValue(section, "ServerBrowserServerAddress", GlobalVars.UserConfiguration.ServerBrowserServerAddress.ToString());
ini.IniWriteValue(section, "ClientLaunchPriority", ((int)GlobalVars.UserConfiguration.Priority).ToString());
ini.IniWriteValue(section, "FirstServerLaunch", GlobalVars.UserConfiguration.FirstServerLaunch.ToString());
ini.IniWriteValue(section, "NewGUI", GlobalVars.UserConfiguration.NewGUI.ToString());
ini.IniWriteValue(section, "URIQuickConfigure", GlobalVars.UserConfiguration.URIQuickConfigure.ToString());
ini.IniWriteValue(section, "BootstrapperShowUI", GlobalVars.UserConfiguration.BootstrapperShowUI.ToString());
ini.IniWriteValue(section, "WebProxyInitialSetupRequired", GlobalVars.UserConfiguration.WebProxyInitialSetupRequired.ToString());
ini.IniWriteValue(section, "WebProxyEnabled", GlobalVars.UserConfiguration.WebProxyEnabled.ToString());
ConfigUseOldValIfExists(ini, section, "ItemMakerDisableHelpMessage", "AssetSDKDisableHelpMessage", GlobalVars.UserConfiguration.DisabledAssetSDKHelp.ToString(), write);
ConfigUseOldValIfExists(ini, section, "AssetLocalizerSaveBackups", "AssetSDKFixerSaveBackups", GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups.ToString(), write);
if (forcewrite)
{
// try again....
Config(cfgpath, false, doubleCheck);
}
}
else
{
try
{
//READ
string closeonlaunch, userid, name, selectedclient,
map, port, limit, upnp,
disablehelpmessage, discord, mappath, mapsnip,
graphics, qualitylevel, style, savebackups, altIP,
showNotifs, SB_Name, SB_Address, priority,
firstServerLaunch, newgui, quickconfigure, bootstrapper,
webproxysetup, webproxy;
INIFile ini = new INIFile(cfgpath);
string section = "Config";
closeonlaunch = ini.IniReadValue(section, "CloseOnLaunch", GlobalVars.UserConfiguration.CloseOnLaunch.ToString());
userid = ini.IniReadValue(section, "UserID", GlobalVars.UserConfiguration.UserID.ToString());
name = ini.IniReadValue(section, "PlayerName", GlobalVars.UserConfiguration.PlayerName.ToString());
selectedclient = ini.IniReadValue(section, "SelectedClient", GlobalVars.UserConfiguration.SelectedClient.ToString());
map = ini.IniReadValue(section, "Map", GlobalVars.UserConfiguration.Map.ToString());
port = ini.IniReadValue(section, "RobloxPort", GlobalVars.UserConfiguration.RobloxPort.ToString());
limit = ini.IniReadValue(section, "PlayerLimit", GlobalVars.UserConfiguration.PlayerLimit.ToString());
upnp = ini.IniReadValue(section, "UPnP", GlobalVars.UserConfiguration.UPnP.ToString());
discord = ini.IniReadValue(section, "DiscordRichPresence", GlobalVars.UserConfiguration.DiscordPresence.ToString());
mappath = ini.IniReadValue(section, "MapPath", GlobalVars.UserConfiguration.MapPath.ToString());
mapsnip = ini.IniReadValue(section, "MapPathSnip", GlobalVars.UserConfiguration.MapPathSnip.ToString());
graphics = ini.IniReadValue(section, "GraphicsMode", ((int)GlobalVars.UserConfiguration.GraphicsMode).ToString());
qualitylevel = ini.IniReadValue(section, "QualityLevel", ((int)GlobalVars.UserConfiguration.QualityLevel).ToString());
style = ini.IniReadValue(section, "Style", ((int)GlobalVars.UserConfiguration.LauncherStyle).ToString());
altIP = ini.IniReadValue(section, "AlternateServerIP", GlobalVars.UserConfiguration.AlternateServerIP.ToString());
showNotifs = ini.IniReadValue(section, "ShowServerNotifications", GlobalVars.UserConfiguration.ShowServerNotifications.ToString());
SB_Name = ini.IniReadValue(section, "ServerBrowserServerName", GlobalVars.UserConfiguration.ServerBrowserServerName.ToString());
SB_Address = ini.IniReadValue(section, "ServerBrowserServerAddress", GlobalVars.UserConfiguration.ServerBrowserServerAddress.ToString());
priority = ini.IniReadValue(section, "ClientLaunchPriority", ((int)GlobalVars.UserConfiguration.Priority).ToString());
firstServerLaunch = ini.IniReadValue(section, "FirstServerLaunch", GlobalVars.UserConfiguration.FirstServerLaunch.ToString());
newgui = ini.IniReadValue(section, "NewGUI", GlobalVars.UserConfiguration.NewGUI.ToString());
quickconfigure = ini.IniReadValue(section, "URIQuickConfigure", GlobalVars.UserConfiguration.URIQuickConfigure.ToString());
bootstrapper = ini.IniReadValue(section, "BootstrapperShowUI", GlobalVars.UserConfiguration.BootstrapperShowUI.ToString());
webproxysetup = ini.IniReadValue(section, "WebProxyInitialSetupRequired", GlobalVars.UserConfiguration.WebProxyInitialSetupRequired.ToString());
webproxy = ini.IniReadValue(section, "WebProxyEnabled", GlobalVars.UserConfiguration.WebProxyEnabled.ToString());
disablehelpmessage = ConfigUseOldValIfExists(ini, section, "ItemMakerDisableHelpMessage", "AssetSDKDisableHelpMessage", GlobalVars.UserConfiguration.DisabledAssetSDKHelp.ToString(), write);
savebackups = ConfigUseOldValIfExists(ini, section, "AssetLocalizerSaveBackups", "AssetSDKFixerSaveBackups", GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups.ToString(), write);
FileFormat.Config DefaultConfiguration = new FileFormat.Config();
DefaultConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
DefaultConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap;
DefaultConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
DefaultConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.CloseOnLaunch = ValueBool(closeonlaunch, DefaultConfiguration.CloseOnLaunch);
if (userid.Equals("0"))
{
NovetusFuncs.GeneratePlayerID();
Config(cfgpath, true);
}
else
{
GlobalVars.UserConfiguration.UserID = ValueInt(userid, DefaultConfiguration.UserID);
}
GlobalVars.UserConfiguration.PlayerName = name;
GlobalVars.UserConfiguration.SelectedClient = selectedclient;
GlobalVars.UserConfiguration.Map = map;
GlobalVars.UserConfiguration.RobloxPort = ValueInt(port, DefaultConfiguration.RobloxPort);
GlobalVars.UserConfiguration.PlayerLimit = ValueInt(limit, DefaultConfiguration.PlayerLimit);
GlobalVars.UserConfiguration.UPnP = ValueBool(upnp, DefaultConfiguration.UPnP);
GlobalVars.UserConfiguration.DisabledAssetSDKHelp = ValueBool(disablehelpmessage, DefaultConfiguration.DisabledAssetSDKHelp);
GlobalVars.UserConfiguration.DiscordPresence = ValueBool(discord, DefaultConfiguration.DiscordPresence);
GlobalVars.UserConfiguration.MapPathSnip = mapsnip;
GlobalVars.UserConfiguration.GraphicsMode = (Settings.Mode)ValueInt(graphics, Convert.ToInt32(DefaultConfiguration.GraphicsMode));
GlobalVars.UserConfiguration.QualityLevel = (Settings.Level)ValueInt(qualitylevel, Convert.ToInt32(DefaultConfiguration.QualityLevel));
GlobalVars.UserConfiguration.LauncherStyle = (Settings.Style)ValueInt(style, Convert.ToInt32(DefaultConfiguration.LauncherStyle));
GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups = ValueBool(savebackups, DefaultConfiguration.AssetSDKFixerSaveBackups);
GlobalVars.UserConfiguration.AlternateServerIP = altIP;
GlobalVars.UserConfiguration.ShowServerNotifications = ValueBool(showNotifs, DefaultConfiguration.ShowServerNotifications);
GlobalVars.UserConfiguration.ServerBrowserServerName = SB_Name;
GlobalVars.UserConfiguration.ServerBrowserServerAddress = SB_Address;
GlobalVars.UserConfiguration.Priority = (ProcessPriorityClass)ValueInt(priority, Convert.ToInt32(DefaultConfiguration.Priority));
GlobalVars.UserConfiguration.FirstServerLaunch = ValueBool(firstServerLaunch, DefaultConfiguration.FirstServerLaunch);
GlobalVars.UserConfiguration.NewGUI = ValueBool(newgui, DefaultConfiguration.NewGUI);
GlobalVars.UserConfiguration.URIQuickConfigure = ValueBool(quickconfigure, DefaultConfiguration.URIQuickConfigure);
GlobalVars.UserConfiguration.BootstrapperShowUI = ValueBool(bootstrapper, DefaultConfiguration.BootstrapperShowUI);
GlobalVars.UserConfiguration.WebProxyInitialSetupRequired = ValueBool(webproxysetup, DefaultConfiguration.WebProxyInitialSetupRequired);
GlobalVars.UserConfiguration.WebProxyEnabled = ValueBool(webproxy, DefaultConfiguration.WebProxyEnabled);
string oldMapath = Path.GetDirectoryName(GlobalVars.UserConfiguration.MapPath);
//update the map path if the file doesn't exist and write to config.
if (oldMapath.Equals(GlobalPaths.MapsDir.Replace(@"\\", @"\")) && File.Exists(mappath))
{
GlobalVars.UserConfiguration.MapPath = mappath;
}
else
{
GlobalVars.UserConfiguration.MapPath = GlobalPaths.BasePath + @"\\" + GlobalVars.UserConfiguration.MapPathSnip;
Config(cfgpath, true);
}
if (ResetMapIfNecessary())
{
Config(cfgpath, true);
}
}
catch (Exception ex)
{
Util.LogExceptions(ex);
Config(cfgpath, true);
}
}
if (!forcewrite)
{
//Powered by https://github.com/davcs86/csharp-uhwid
string curval = UHWIDEngine.AdvancedUid;
if (!GlobalVars.PlayerTripcode.Equals(curval))
{
GlobalVars.PlayerTripcode = curval;
}
#if !BASICLAUNCHER
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization))
{
Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, true);
}
else
{
Customization(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization, write);
}
#endif
} }
} }
public static bool ResetMapIfNecessary() public static bool ResetMapIfNecessary()
{ {
if (!File.Exists(GlobalVars.UserConfiguration.MapPath)) if (!File.Exists(GlobalVars.UserConfiguration.ReadSetting("MapPath")))
{ {
GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("Map", GlobalVars.ProgramInformation.DefaultMap);
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("MapPath", GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap);
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("MapPathSnip", GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap);
return true; return true;
} }
return false; return false;
} }
public static void Customization(string cfgpath, bool write)
{
if (write)
{
//WRITE
INIFile ini = new INIFile(cfgpath);
string section = "Items";
ini.IniWriteValue(section, "Hat1", GlobalVars.UserCustomization.Hat1.ToString());
ini.IniWriteValue(section, "Hat2", GlobalVars.UserCustomization.Hat2.ToString());
ini.IniWriteValue(section, "Hat3", GlobalVars.UserCustomization.Hat3.ToString());
ini.IniWriteValue(section, "Face", GlobalVars.UserCustomization.Face.ToString());
ini.IniWriteValue(section, "Head", GlobalVars.UserCustomization.Head.ToString());
ini.IniWriteValue(section, "TShirt", GlobalVars.UserCustomization.TShirt.ToString());
ini.IniWriteValue(section, "Shirt", GlobalVars.UserCustomization.Shirt.ToString());
ini.IniWriteValue(section, "Pants", GlobalVars.UserCustomization.Pants.ToString());
ini.IniWriteValue(section, "Icon", GlobalVars.UserCustomization.Icon.ToString());
ini.IniWriteValue(section, "Extra", GlobalVars.UserCustomization.Extra.ToString());
string section2 = "Colors";
ini.IniWriteValue(section2, "HeadColorID", GlobalVars.UserCustomization.HeadColorID.ToString());
ini.IniWriteValue(section2, "HeadColorString", GlobalVars.UserCustomization.HeadColorString.ToString());
ini.IniWriteValue(section2, "TorsoColorID", GlobalVars.UserCustomization.TorsoColorID.ToString());
ini.IniWriteValue(section2, "TorsoColorString", GlobalVars.UserCustomization.TorsoColorString.ToString());
ini.IniWriteValue(section2, "LeftArmColorID", GlobalVars.UserCustomization.LeftArmColorID.ToString());
ini.IniWriteValue(section2, "LeftArmColorString", GlobalVars.UserCustomization.LeftArmColorString.ToString());
ini.IniWriteValue(section2, "RightArmColorID", GlobalVars.UserCustomization.RightArmColorID.ToString());
ini.IniWriteValue(section2, "RightArmColorString", GlobalVars.UserCustomization.RightArmColorString.ToString());
ini.IniWriteValue(section2, "LeftLegColorID", GlobalVars.UserCustomization.LeftLegColorID.ToString());
ini.IniWriteValue(section2, "LeftLegColorString", GlobalVars.UserCustomization.LeftLegColorString.ToString());
ini.IniWriteValue(section2, "RightLegColorID", GlobalVars.UserCustomization.RightLegColorID.ToString());
ini.IniWriteValue(section2, "RightLegColorString", GlobalVars.UserCustomization.RightLegColorString.ToString());
string section3 = "Other";
ini.IniWriteValue(section3, "CharacterID", GlobalVars.UserCustomization.CharacterID.ToString());
ini.IniWriteValue(section3, "ExtraSelectionIsHat", GlobalVars.UserCustomization.ExtraSelectionIsHat.ToString());
ini.IniWriteValue(section3, "ShowHatsOnExtra", GlobalVars.UserCustomization.ShowHatsInExtra.ToString());
}
else
{
//READ
try
{
string hat1, hat2, hat3, face,
head, tshirt, shirt, pants, icon,
extra, headcolorid, headcolorstring, torsocolorid, torsocolorstring,
larmid, larmstring, rarmid, rarmstring, llegid,
llegstring, rlegid, rlegstring, characterid, extraishat, showhatsonextra;
INIFile ini = new INIFile(cfgpath);
string section = "Items";
hat1 = ini.IniReadValue(section, "Hat1", GlobalVars.UserCustomization.Hat1.ToString());
hat2 = ini.IniReadValue(section, "Hat2", GlobalVars.UserCustomization.Hat2.ToString());
hat3 = ini.IniReadValue(section, "Hat3", GlobalVars.UserCustomization.Hat3.ToString());
face = ini.IniReadValue(section, "Face", GlobalVars.UserCustomization.Face.ToString());
head = ini.IniReadValue(section, "Head", GlobalVars.UserCustomization.Head.ToString());
tshirt = ini.IniReadValue(section, "TShirt", GlobalVars.UserCustomization.TShirt.ToString());
shirt = ini.IniReadValue(section, "Shirt", GlobalVars.UserCustomization.Shirt.ToString());
pants = ini.IniReadValue(section, "Pants", GlobalVars.UserCustomization.Pants.ToString());
icon = ini.IniReadValue(section, "Icon", GlobalVars.UserCustomization.Icon.ToString());
extra = ini.IniReadValue(section, "Extra", GlobalVars.UserCustomization.Extra.ToString());
string section2 = "Colors";
headcolorid = ini.IniReadValue(section2, "HeadColorID", GlobalVars.UserCustomization.HeadColorID.ToString());
headcolorstring = ini.IniReadValue(section2, "HeadColorString", GlobalVars.UserCustomization.HeadColorString.ToString());
torsocolorid = ini.IniReadValue(section2, "TorsoColorID", GlobalVars.UserCustomization.TorsoColorID.ToString());
torsocolorstring = ini.IniReadValue(section2, "TorsoColorString", GlobalVars.UserCustomization.TorsoColorString.ToString());
larmid = ini.IniReadValue(section2, "LeftArmColorID", GlobalVars.UserCustomization.LeftArmColorID.ToString());
larmstring = ini.IniReadValue(section2, "LeftArmColorString", GlobalVars.UserCustomization.LeftArmColorString.ToString());
rarmid = ini.IniReadValue(section2, "RightArmColorID", GlobalVars.UserCustomization.RightArmColorID.ToString());
rarmstring = ini.IniReadValue(section2, "RightArmColorString", GlobalVars.UserCustomization.RightArmColorString.ToString());
llegid = ini.IniReadValue(section2, "LeftLegColorID", GlobalVars.UserCustomization.LeftLegColorID.ToString());
llegstring = ini.IniReadValue(section2, "LeftLegColorString", GlobalVars.UserCustomization.LeftLegColorString.ToString());
rlegid = ini.IniReadValue(section2, "RightLegColorID", GlobalVars.UserCustomization.RightLegColorID.ToString());
rlegstring = ini.IniReadValue(section2, "RightLegColorString", GlobalVars.UserCustomization.RightLegColorString.ToString());
string section3 = "Other";
characterid = ini.IniReadValue(section3, "CharacterID", GlobalVars.UserCustomization.CharacterID.ToString());
extraishat = ini.IniReadValue(section3, "ExtraSelectionIsHat", GlobalVars.UserCustomization.ExtraSelectionIsHat.ToString());
showhatsonextra = ini.IniReadValue(section3, "ShowHatsOnExtra", GlobalVars.UserCustomization.ShowHatsInExtra.ToString());
FileFormat.CustomizationConfig DefaultCustomization = new FileFormat.CustomizationConfig();
GlobalVars.UserCustomization.Hat1 = hat1;
GlobalVars.UserCustomization.Hat2 = hat2;
GlobalVars.UserCustomization.Hat3 = hat3;
GlobalVars.UserCustomization.HeadColorID = ValueInt(headcolorid, DefaultCustomization.HeadColorID);
GlobalVars.UserCustomization.TorsoColorID = ValueInt(torsocolorid, DefaultCustomization.TorsoColorID);
GlobalVars.UserCustomization.LeftArmColorID = ValueInt(larmid, DefaultCustomization.LeftArmColorID);
GlobalVars.UserCustomization.RightArmColorID = ValueInt(rarmid, DefaultCustomization.RightArmColorID);
GlobalVars.UserCustomization.LeftLegColorID = ValueInt(llegid, DefaultCustomization.LeftLegColorID);
GlobalVars.UserCustomization.RightLegColorID = ValueInt(rlegid, DefaultCustomization.RightArmColorID);
GlobalVars.UserCustomization.HeadColorString = headcolorstring;
GlobalVars.UserCustomization.TorsoColorString = torsocolorstring;
GlobalVars.UserCustomization.LeftArmColorString = larmstring;
GlobalVars.UserCustomization.RightArmColorString = rarmstring;
GlobalVars.UserCustomization.LeftLegColorString = llegstring;
GlobalVars.UserCustomization.RightLegColorString = rlegstring;
GlobalVars.UserCustomization.Face = face;
GlobalVars.UserCustomization.Head = head;
GlobalVars.UserCustomization.TShirt = tshirt;
GlobalVars.UserCustomization.Shirt = shirt;
GlobalVars.UserCustomization.Pants = pants;
GlobalVars.UserCustomization.Icon = icon;
GlobalVars.UserCustomization.CharacterID = characterid;
GlobalVars.UserCustomization.Extra = extra;
GlobalVars.UserCustomization.ExtraSelectionIsHat = ValueBool(extraishat, DefaultCustomization.ExtraSelectionIsHat);
GlobalVars.UserCustomization.ShowHatsInExtra = ValueBool(showhatsonextra, DefaultCustomization.ShowHatsInExtra);
}
catch (Exception ex)
{
Util.LogExceptions(ex);
Customization(cfgpath, true);
}
}
ReloadLoadoutValue();
}
public static bool InitColors() public static bool InitColors()
{ {
try try
@ -1187,25 +889,25 @@ namespace Novetus.Core
} }
#if LAUNCHER #if LAUNCHER
public static void ResetConfigValues(Settings.Style style) public static void ResetConfigValues(Settings.Style style)
#else #else
public static void ResetConfigValues() public static void ResetConfigValues()
#endif #endif
{ {
bool WebProxySetupComplete = GlobalVars.UserConfiguration.WebProxyInitialSetupRequired; bool WebProxySetupComplete = GlobalVars.UserConfiguration.ReadSettingBool("WebProxyInitialSetupRequired");
bool WebProxy = GlobalVars.UserConfiguration.WebProxyEnabled; bool WebProxy = GlobalVars.UserConfiguration.ReadSettingBool("WebProxyEnabled");
GlobalVars.UserConfiguration = new FileFormat.Config(); GlobalVars.UserConfiguration = new FileFormat.Config();
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient; GlobalVars.UserConfiguration.SaveSetting("SelectedClient", GlobalVars.ProgramInformation.DefaultClient);
GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("Map", GlobalVars.ProgramInformation.DefaultMap);
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("MapPath", GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap);
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.SaveSetting("MapPathSnip", GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap);
#if LAUNCHER #if LAUNCHER
GlobalVars.UserConfiguration.LauncherStyle = style; GlobalVars.UserConfiguration.SaveSettingInt("LauncherStyle", (int)style);
#endif #endif
GlobalVars.UserConfiguration.WebProxyInitialSetupRequired = WebProxySetupComplete; GlobalVars.UserConfiguration.SaveSettingBool("WebProxyInitialSetupRequired", WebProxySetupComplete);
GlobalVars.UserConfiguration.WebProxyEnabled = WebProxy; GlobalVars.UserConfiguration.SaveSettingBool("WebProxyEnabled", WebProxy);
NovetusFuncs.GeneratePlayerID(); GlobalVars.UserConfiguration.SaveSettingInt("UserID", NovetusFuncs.GeneratePlayerID());
ResetCustomizationValues(); ResetCustomizationValues();
} }
@ -1214,6 +916,7 @@ namespace Novetus.Core
GlobalVars.UserCustomization = new FileFormat.CustomizationConfig(); GlobalVars.UserCustomization = new FileFormat.CustomizationConfig();
ReloadLoadoutValue(); ReloadLoadoutValue();
} }
public static string GetItemTextureLocalPath(string item, string nameprefix) public static string GetItemTextureLocalPath(string item, string nameprefix)
{ {
//don't bother, we're offline. //don't bother, we're offline.
@ -1302,51 +1005,42 @@ namespace Novetus.Core
public static void ReloadLoadoutValue(bool localizeOnlineClothing = false) public static void ReloadLoadoutValue(bool localizeOnlineClothing = false)
{ {
string hat1 = (!GlobalVars.UserCustomization.Hat1.EndsWith("-Solo.rbxm")) ? GlobalVars.UserCustomization.Hat1 : "NoHat.rbxm"; string hat1 = (!GlobalVars.UserCustomization.ReadSetting("Hat1").EndsWith("-Solo.rbxm")) ? GlobalVars.UserCustomization.ReadSetting("Hat1") : "NoHat.rbxm";
string hat2 = (!GlobalVars.UserCustomization.Hat2.EndsWith("-Solo.rbxm")) ? GlobalVars.UserCustomization.Hat2 : "NoHat.rbxm"; string hat2 = (!GlobalVars.UserCustomization.ReadSetting("Hat2").EndsWith("-Solo.rbxm")) ? GlobalVars.UserCustomization.ReadSetting("Hat2") : "NoHat.rbxm";
string hat3 = (!GlobalVars.UserCustomization.Hat3.EndsWith("-Solo.rbxm")) ? GlobalVars.UserCustomization.Hat3 : "NoHat.rbxm"; string hat3 = (!GlobalVars.UserCustomization.ReadSetting("Hat3").EndsWith("-Solo.rbxm")) ? GlobalVars.UserCustomization.ReadSetting("Hat3") : "NoHat.rbxm";
string extra = (!GlobalVars.UserCustomization.Extra.EndsWith("-Solo.rbxm")) ? GlobalVars.UserCustomization.Extra : "NoExtra.rbxm"; string extra = (!GlobalVars.UserCustomization.ReadSetting("Extra").EndsWith("-Solo.rbxm")) ? GlobalVars.UserCustomization.ReadSetting("Extra") : "NoExtra.rbxm";
string baseClothing = GlobalVars.UserCustomization.ReadSettingInt("HeadColorID") + "," +
GlobalVars.UserCustomization.ReadSettingInt("TorsoColorID") + "," +
GlobalVars.UserCustomization.ReadSettingInt("LeftArmColorID") + "," +
GlobalVars.UserCustomization.ReadSettingInt("RightArmColorID") + "," +
GlobalVars.UserCustomization.ReadSettingInt("LeftLegColorID") + "," +
GlobalVars.UserCustomization.ReadSettingInt("RightLegColorID") + ",'" +
GlobalVars.UserCustomization.ReadSetting("TShirt") + "','" +
GlobalVars.UserCustomization.ReadSetting("Shirt") + "','" +
GlobalVars.UserCustomization.ReadSetting("Pants") + "','" +
GlobalVars.UserCustomization.ReadSetting("Face") + "','" +
GlobalVars.UserCustomization.ReadSetting("Head") + "','" +
GlobalVars.UserCustomization.ReadSetting("Icon") + "','";
GlobalVars.Loadout = "'" + hat1 + "','" + GlobalVars.Loadout = "'" + hat1 + "','" +
hat2 + "','" + hat2 + "','" +
hat3 + "'," + hat3 + "'," +
GlobalVars.UserCustomization.HeadColorID + "," + baseClothing +
GlobalVars.UserCustomization.TorsoColorID + "," +
GlobalVars.UserCustomization.LeftArmColorID + "," +
GlobalVars.UserCustomization.RightArmColorID + "," +
GlobalVars.UserCustomization.LeftLegColorID + "," +
GlobalVars.UserCustomization.RightLegColorID + ",'" +
GlobalVars.UserCustomization.TShirt + "','" +
GlobalVars.UserCustomization.Shirt + "','" +
GlobalVars.UserCustomization.Pants + "','" +
GlobalVars.UserCustomization.Face + "','" +
GlobalVars.UserCustomization.Head + "','" +
GlobalVars.UserCustomization.Icon + "','" +
extra + "'"; extra + "'";
GlobalVars.soloLoadout = "'" + GlobalVars.UserCustomization.Hat1 + "','" + GlobalVars.soloLoadout = "'" + GlobalVars.UserCustomization.ReadSetting("Hat1") + "','" +
GlobalVars.UserCustomization.Hat2 + "','" + GlobalVars.UserCustomization.ReadSetting("Hat2") + "','" +
GlobalVars.UserCustomization.Hat3 + "'," + GlobalVars.UserCustomization.ReadSetting("Hat3") + "'," +
GlobalVars.UserCustomization.HeadColorID + "," + baseClothing +
GlobalVars.UserCustomization.TorsoColorID + "," + GlobalVars.UserCustomization.ReadSetting("Extra") + "'";
GlobalVars.UserCustomization.LeftArmColorID + "," +
GlobalVars.UserCustomization.RightArmColorID + "," +
GlobalVars.UserCustomization.LeftLegColorID + "," +
GlobalVars.UserCustomization.RightLegColorID + ",'" +
GlobalVars.UserCustomization.TShirt + "','" +
GlobalVars.UserCustomization.Shirt + "','" +
GlobalVars.UserCustomization.Pants + "','" +
GlobalVars.UserCustomization.Face + "','" +
GlobalVars.UserCustomization.Head + "','" +
GlobalVars.UserCustomization.Icon + "','" +
GlobalVars.UserCustomization.Extra + "'";
if (localizeOnlineClothing) if (localizeOnlineClothing)
{ {
GlobalVars.TShirtTextureID = GetItemTextureID(GlobalVars.UserCustomization.TShirt, "TShirt", new AssetCacheDefBasic("ShirtGraphic", new string[] { "Graphic" })); GlobalVars.TShirtTextureID = GetItemTextureID(GlobalVars.UserCustomization.ReadSetting("TShirt"), "TShirt", new AssetCacheDefBasic("ShirtGraphic", new string[] { "Graphic" }));
GlobalVars.ShirtTextureID = GetItemTextureID(GlobalVars.UserCustomization.Shirt, "Shirt", new AssetCacheDefBasic("Shirt", new string[] { "ShirtTemplate" })); GlobalVars.ShirtTextureID = GetItemTextureID(GlobalVars.UserCustomization.ReadSetting("Shirt"), "Shirt", new AssetCacheDefBasic("Shirt", new string[] { "ShirtTemplate" }));
GlobalVars.PantsTextureID = GetItemTextureID(GlobalVars.UserCustomization.Pants, "Pants", new AssetCacheDefBasic("Pants", new string[] { "PantsTemplate" })); GlobalVars.PantsTextureID = GetItemTextureID(GlobalVars.UserCustomization.ReadSetting("Pants"), "Pants", new AssetCacheDefBasic("Pants", new string[] { "PantsTemplate" }));
GlobalVars.FaceTextureID = GetItemTextureID(GlobalVars.UserCustomization.Face, "Face", new AssetCacheDefBasic("Decal", new string[] { "Texture" })); GlobalVars.FaceTextureID = GetItemTextureID(GlobalVars.UserCustomization.ReadSetting("Face"), "Face", new AssetCacheDefBasic("Decal", new string[] { "Texture" }));
GlobalVars.TShirtTextureLocal = GetItemTextureLocalPath(GlobalVars.TShirtTextureID, "TShirt"); GlobalVars.TShirtTextureLocal = GetItemTextureLocalPath(GlobalVars.TShirtTextureID, "TShirt");
GlobalVars.ShirtTextureLocal = GetItemTextureLocalPath(GlobalVars.ShirtTextureID, "Shirt"); GlobalVars.ShirtTextureLocal = GetItemTextureLocalPath(GlobalVars.ShirtTextureID, "Shirt");

View File

@ -13,7 +13,11 @@ namespace Novetus.Core
public static readonly string RootPathLauncher = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); public static readonly string RootPathLauncher = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static readonly string BasePathLauncher = RootPathLauncher.Replace(@"\", @"\\"); public static readonly string BasePathLauncher = RootPathLauncher.Replace(@"\", @"\\");
public static readonly string RootPath = Directory.GetParent(RootPathLauncher).ToString(); public static readonly string RootPath = Directory.GetParent(RootPathLauncher).ToString();
#if BASICLAUNCHER
public static readonly string BasePath = BasePathLauncher;
#else
public static readonly string BasePath = RootPath.Replace(@"\", @"\\"); public static readonly string BasePath = RootPath.Replace(@"\", @"\\");
#endif
public static readonly string DataPath = BasePath + @"\\shareddata"; public static readonly string DataPath = BasePath + @"\\shareddata";
public static readonly string AssetsPath = BasePath + @"\\assets"; public static readonly string AssetsPath = BasePath + @"\\assets";
public static readonly string BinDir = BasePath + @"\\bin"; public static readonly string BinDir = BasePath + @"\\bin";
@ -21,7 +25,7 @@ namespace Novetus.Core
public static readonly string LogDir = BasePath + @"\\logs"; public static readonly string LogDir = BasePath + @"\\logs";
public static readonly string ConfigDirClients = ConfigDir + @"\\clients"; public static readonly string ConfigDirClients = ConfigDir + @"\\clients";
public static readonly string ConfigDirTemplates = ConfigDir + @"\\itemtemplates"; public static readonly string ConfigDirTemplates = ConfigDir + @"\\itemtemplates";
public static readonly string DataDir = BinDir + @"\\data"; public static readonly string DataDir = ConfigDir + @"\\launcherdata";
public static readonly string ClientDir = BasePath + @"\\clients"; public static readonly string ClientDir = BasePath + @"\\clients";
public static readonly string MapsDir = BasePath + @"\\maps"; public static readonly string MapsDir = BasePath + @"\\maps";
public static readonly string AddonDir = BasePath + @"\\addons"; public static readonly string AddonDir = BasePath + @"\\addons";
@ -34,9 +38,9 @@ namespace Novetus.Core
public static readonly string BaseGameDir = "rbxasset://../../../"; public static readonly string BaseGameDir = "rbxasset://../../../";
public static readonly string AltBaseGameDir = "rbxasset://"; public static readonly string AltBaseGameDir = "rbxasset://";
public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/"; public static readonly string SharedDataGameDir = BaseGameDir + "shareddata/";
#endregion #endregion
#region Customization Paths #region Customization Paths
public static readonly string CustomPlayerDir = DataPath + "\\charcustom"; public static readonly string CustomPlayerDir = DataPath + "\\charcustom";
public static readonly string hatdir = CustomPlayerDir + "\\hats"; public static readonly string hatdir = CustomPlayerDir + "\\hats";
public static readonly string facedir = CustomPlayerDir + "\\faces"; public static readonly string facedir = CustomPlayerDir + "\\faces";
@ -55,11 +59,11 @@ namespace Novetus.Core
public static readonly string shirtGameDir = CharCustomGameDir + "shirts/"; public static readonly string shirtGameDir = CharCustomGameDir + "shirts/";
public static readonly string pantsGameDir = CharCustomGameDir + "pants/"; public static readonly string pantsGameDir = CharCustomGameDir + "pants/";
public static readonly string extraGameDir = CharCustomGameDir + "custom/"; public static readonly string extraGameDir = CharCustomGameDir + "custom/";
#endregion #endregion
#region Asset Cache Paths #region Asset Cache Paths
#region Base Paths #region Base Paths
public static readonly string DirFonts = "\\fonts"; public static readonly string DirFonts = "\\fonts";
public static readonly string DirSounds = "\\sounds"; public static readonly string DirSounds = "\\sounds";
public static readonly string DirTextures = "\\textures"; public static readonly string DirTextures = "\\textures";
@ -68,17 +72,17 @@ namespace Novetus.Core
public static readonly string SoundsGameDir = "sounds/"; public static readonly string SoundsGameDir = "sounds/";
public static readonly string TexturesGameDir = "textures/"; public static readonly string TexturesGameDir = "textures/";
public static readonly string ScriptsGameDir = "scripts/"; public static readonly string ScriptsGameDir = "scripts/";
#endregion #endregion
#region Asset Dirs #region Asset Dirs
public static string AssetCacheDir = DataPath + "\\assetcache"; public static string AssetCacheDir = DataPath + "\\assetcache";
public static string AssetCacheDirAssets = AssetCacheDir + "\\assets"; public static string AssetCacheDirAssets = AssetCacheDir + "\\assets";
public static string AssetCacheGameDir = SharedDataGameDir + "assetcache/"; public static string AssetCacheGameDir = SharedDataGameDir + "assetcache/";
public static string AssetCacheAssetsGameDir = AssetCacheGameDir + "assets/"; public static string AssetCacheAssetsGameDir = AssetCacheGameDir + "assets/";
#endregion #endregion
#region Item Dirs #region Item Dirs
public static readonly string hatdirFonts = hatdir + DirFonts; public static readonly string hatdirFonts = hatdir + DirFonts;
public static readonly string hatdirTextures = hatdir + DirTextures; public static readonly string hatdirTextures = hatdir + DirTextures;
public static readonly string hatdirSounds = hatdir + DirSounds; public static readonly string hatdirSounds = hatdir + DirSounds;
@ -100,11 +104,11 @@ namespace Novetus.Core
public static readonly string tshirtGameDirTextures = tshirtGameDir; //+ TexturesGameDir; public static readonly string tshirtGameDirTextures = tshirtGameDir; //+ TexturesGameDir;
public static readonly string shirtGameDirTextures = shirtGameDir + TexturesGameDir; public static readonly string shirtGameDirTextures = shirtGameDir + TexturesGameDir;
public static readonly string pantsGameDirTextures = pantsGameDir + TexturesGameDir; public static readonly string pantsGameDirTextures = pantsGameDir + TexturesGameDir;
#endregion #endregion
#endregion #endregion
#region File Names #region File Names
public static readonly string ConfigName = "config.ini"; public static readonly string ConfigName = "config.ini";
public static string ConfigNameCustomization = "config_customization.ini"; public static string ConfigNameCustomization = "config_customization.ini";
public static readonly string InfoName = "info.ini"; public static readonly string InfoName = "info.ini";
@ -120,7 +124,7 @@ namespace Novetus.Core
public static readonly string AddonLoaderFileName = "AddonLoader.lua"; public static readonly string AddonLoaderFileName = "AddonLoader.lua";
public static readonly string AssetFixerPatternFileName = "assetfixer_pattern.txt"; public static readonly string AssetFixerPatternFileName = "assetfixer_pattern.txt";
public static readonly string TermListFileName = "term-list.txt"; public static readonly string TermListFileName = "term-list.txt";
#endregion #endregion
} }
#endregion #endregion
} }

View File

@ -14,7 +14,7 @@ namespace Novetus.Core
{ {
public static void InitUPnP() public static void InitUPnP()
{ {
if (GlobalVars.UserConfiguration.UPnP) if (GlobalVars.UserConfiguration.ReadSettingBool("UPnP"))
{ {
try try
{ {
@ -35,10 +35,10 @@ namespace Novetus.Core
try try
{ {
INatDevice device = args.Device; INatDevice device = args.Device;
string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString(); string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.ReadSetting("AlternateServerIP")) ? GlobalVars.UserConfiguration.ReadSetting("AlternateServerIP") : device.GetExternalIP().ToString();
Util.ConsolePrint("UPnP: Device '" + IP + "' registered.", 3); Util.ConsolePrint("UPnP: Device '" + IP + "' registered.", 3);
StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.RobloxPort); StartUPnP(device, Protocol.Udp, GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort"));
StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.RobloxPort); StartUPnP(device, Protocol.Tcp, GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort"));
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -49,7 +49,7 @@ namespace Novetus.Core
public static void StartUPnP(INatDevice device, Protocol protocol, int port) public static void StartUPnP(INatDevice device, Protocol protocol, int port)
{ {
if (GlobalVars.UserConfiguration.UPnP) if (GlobalVars.UserConfiguration.ReadSettingBool("UPnP"))
{ {
try try
{ {
@ -63,7 +63,7 @@ namespace Novetus.Core
device.CreatePortMap(portmap); device.CreatePortMap(portmap);
} }
string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString(); string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.ReadSetting("AlternateServerIP")) ? GlobalVars.UserConfiguration.ReadSetting("AlternateServerIP") : device.GetExternalIP().ToString();
Util.ConsolePrint("UPnP: Port " + port + " opened on '" + IP + "' (" + protocol.ToString() + ")", 3); Util.ConsolePrint("UPnP: Port " + port + " opened on '" + IP + "' (" + protocol.ToString() + ")", 3);
} }
catch (Exception ex) catch (Exception ex)
@ -76,7 +76,7 @@ namespace Novetus.Core
public static void StopUPnP(INatDevice device, Protocol protocol, int port) public static void StopUPnP(INatDevice device, Protocol protocol, int port)
{ {
if (GlobalVars.UserConfiguration.UPnP) if (GlobalVars.UserConfiguration.ReadSettingBool("UPnP"))
{ {
try try
{ {
@ -90,7 +90,7 @@ namespace Novetus.Core
device.DeletePortMap(portmap); device.DeletePortMap(portmap);
} }
string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : device.GetExternalIP().ToString(); string IP = !string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.ReadSetting("AlternateServerIP")) ? GlobalVars.UserConfiguration.ReadSetting("AlternateServerIP") : device.GetExternalIP().ToString();
Util.ConsolePrint("UPnP: Port " + port + " closed on '" + IP + "' (" + protocol.ToString() + ")", 3); Util.ConsolePrint("UPnP: Port " + port + " closed on '" + IP + "' (" + protocol.ToString() + ")", 3);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -63,11 +63,9 @@ namespace Novetus.Core
return randomID; return randomID;
} }
public static void GeneratePlayerID() public static int GeneratePlayerID()
{ {
int randomID = GenerateRandomNumber(); return GenerateRandomNumber();
//2147483647 is max id.
GlobalVars.UserConfiguration.UserID = randomID;
} }
public static void PingMasterServer(bool online, string reason) public static void PingMasterServer(bool online, string reason)
@ -75,29 +73,31 @@ namespace Novetus.Core
if (GlobalVars.GameOpened == ScriptType.Server || GlobalVars.GameOpened == ScriptType.EasterEggServer) if (GlobalVars.GameOpened == ScriptType.Server || GlobalVars.GameOpened == ScriptType.EasterEggServer)
return; return;
if (string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.ServerBrowserServerAddress)) if (string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.ReadSetting("ServerBrowserServerAddress")))
return; return;
if (string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.ServerBrowserServerName)) if (string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.ReadSetting("ServerBrowserServerName")))
{ {
Util.ConsolePrint("Your server doesn't have a name. Please specify one for it to show on the master server list after server restart.", 2); Util.ConsolePrint("Your server doesn't have a name. Please specify one for it to show on the master server list after server restart.", 2);
return; return;
} }
string AlternateServerIP = GlobalVars.UserConfiguration.ReadSetting("AlternateServerIP");
if (online) if (online)
{ {
GlobalVars.ServerID = RandomString(30) + GenerateRandomNumber(); GlobalVars.ServerID = RandomString(30) + GenerateRandomNumber();
GlobalVars.PingURL = "http://" + GlobalVars.UserConfiguration.ServerBrowserServerAddress + GlobalVars.PingURL = "http://" + GlobalVars.UserConfiguration.ReadSetting("ServerBrowserServerAddress") +
"/list.php?name=" + GlobalVars.UserConfiguration.ServerBrowserServerName + "/list.php?name=" + GlobalVars.UserConfiguration.ReadSetting("ServerBrowserServerName") +
"&ip=" + (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : GlobalVars.ExternalIP) + "&ip=" + (!string.IsNullOrWhiteSpace(AlternateServerIP) ? AlternateServerIP : GlobalVars.ExternalIP) +
"&port=" + GlobalVars.UserConfiguration.RobloxPort + "&port=" + GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort") +
"&client=" + GlobalVars.UserConfiguration.SelectedClient + "&client=" + GlobalVars.UserConfiguration.ReadSetting("SelectedClient") +
"&version=" + GlobalVars.ProgramInformation.Version + "&version=" + GlobalVars.ProgramInformation.Version +
"&id=" + GlobalVars.ServerID; "&id=" + GlobalVars.ServerID;
} }
else else
{ {
GlobalVars.PingURL = "http://" + GlobalVars.UserConfiguration.ServerBrowserServerAddress + GlobalVars.PingURL = "http://" + GlobalVars.UserConfiguration.ReadSetting("ServerBrowserServerAddress") +
"/delist.php?id=" + GlobalVars.ServerID; "/delist.php?id=" + GlobalVars.ServerID;
GlobalVars.ServerID = "N/A"; GlobalVars.ServerID = "N/A";
} }
@ -127,25 +127,28 @@ namespace Novetus.Core
public static string[] LoadServerInformation() public static string[] LoadServerInformation()
{ {
string AlternateServerIP = GlobalVars.UserConfiguration.ReadSetting("AlternateServerIP");
int RobloxPort = GlobalVars.UserConfiguration.ReadSettingInt("RobloxPort");
string SelectedClient = GlobalVars.UserConfiguration.ReadSetting("SelectedClient");
string[] lines1 = { string[] lines1 = {
SecurityFuncs.Encode(!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : GlobalVars.ExternalIP), SecurityFuncs.Encode(!string.IsNullOrWhiteSpace(AlternateServerIP) ? AlternateServerIP : GlobalVars.ExternalIP),
SecurityFuncs.Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), SecurityFuncs.Encode(RobloxPort.ToString()),
SecurityFuncs.Encode(GlobalVars.UserConfiguration.SelectedClient) SecurityFuncs.Encode(SelectedClient)
}; };
string URI = "novetus://" + SecurityFuncs.Encode(string.Join("|", lines1), true); string URI = "novetus://" + SecurityFuncs.Encode(string.Join("|", lines1), true);
string[] lines2 = { string[] lines2 = {
SecurityFuncs.Encode("localhost"), SecurityFuncs.Encode("localhost"),
SecurityFuncs.Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), SecurityFuncs.Encode(RobloxPort.ToString()),
SecurityFuncs.Encode(GlobalVars.UserConfiguration.SelectedClient) SecurityFuncs.Encode(SelectedClient)
}; };
string URI2 = "novetus://" + SecurityFuncs.Encode(string.Join("|", lines2), true); string URI2 = "novetus://" + SecurityFuncs.Encode(string.Join("|", lines2), true);
GameServer server = new GameServer((!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : GlobalVars.ExternalIP), GameServer server = new GameServer((!string.IsNullOrWhiteSpace(AlternateServerIP) ? AlternateServerIP : GlobalVars.ExternalIP), RobloxPort);
GlobalVars.UserConfiguration.RobloxPort);
string[] text = { string[] text = {
"Server IP Address: " + server.ToString(), "Server IP Address: " + server.ToString(),
"Client: " + GlobalVars.UserConfiguration.SelectedClient, "Client: " + SelectedClient,
"Map: " + GlobalVars.UserConfiguration.Map, "Map: " + GlobalVars.UserConfiguration.ReadSetting("Map"),
"Players: " + GlobalVars.UserConfiguration.PlayerLimit, "Players: " + GlobalVars.UserConfiguration.ReadSettingInt("PlayerLimit"),
"Version: Novetus " + GlobalVars.ProgramInformation.Version, "Version: Novetus " + GlobalVars.ProgramInformation.Version,
"Online URI Link:", "Online URI Link:",
URI, URI,
@ -173,7 +176,7 @@ namespace Novetus.Core
} }
} }
switch (GlobalVars.UserConfiguration.LauncherStyle) switch ((Settings.Style)GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle"))
{ {
case Settings.Style.Extended: case Settings.Style.Extended:
CharacterCustomizationExtended ccustom = new CharacterCustomizationExtended(); CharacterCustomizationExtended ccustom = new CharacterCustomizationExtended();

View File

@ -156,8 +156,8 @@ public class Splash
CryptoRandom random = new CryptoRandom(); CryptoRandom random = new CryptoRandom();
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
return text.Replace("%name%", GlobalVars.UserConfiguration.PlayerName) return text.Replace("%name%", GlobalVars.UserConfiguration.ReadSetting("PlayerName"))
.Replace("%randomtext%", NovetusFuncs.RandomString(random.Next(2, (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish ? 64 : 32)))) .Replace("%randomtext%", NovetusFuncs.RandomString(random.Next(2, (GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle") == (int)Settings.Style.Stylish ? 64 : 32))))
.Replace("%version%", GlobalVars.ProgramInformation.Version) .Replace("%version%", GlobalVars.ProgramInformation.Version)
.Replace("%year%", now.Year.ToString()) .Replace("%year%", now.Year.ToString())
.Replace("%day%", now.Day.ToString()) .Replace("%day%", now.Day.ToString())
@ -265,14 +265,14 @@ public static class SplashReader
{ {
if (specialsplash.Compatibility == SplashCompatibility.Stylish) if (specialsplash.Compatibility == SplashCompatibility.Stylish)
{ {
if (GlobalVars.UserConfiguration.LauncherStyle != Settings.Style.Stylish) if (GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle") != (int)Settings.Style.Stylish)
{ {
continue; continue;
} }
} }
else if (specialsplash.Compatibility == SplashCompatibility.Normal) else if (specialsplash.Compatibility == SplashCompatibility.Normal)
{ {
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish) if (GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle") == (int)Settings.Style.Stylish)
{ {
continue; continue;
} }
@ -353,7 +353,7 @@ public static class SplashReader
{ {
if (generatedSplash.Compatibility == SplashCompatibility.Stylish) if (generatedSplash.Compatibility == SplashCompatibility.Stylish)
{ {
if (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish) if (GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle") == (int)Settings.Style.Stylish)
{ {
checkStylishSplash = false; checkStylishSplash = false;
} }
@ -364,7 +364,7 @@ public static class SplashReader
} }
else if (generatedSplash.Compatibility == SplashCompatibility.Normal) else if (generatedSplash.Compatibility == SplashCompatibility.Normal)
{ {
if (GlobalVars.UserConfiguration.LauncherStyle != Settings.Style.Stylish) if (GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle") != (int)Settings.Style.Stylish)
{ {
checkStylishSplash = false; checkStylishSplash = false;
} }

View File

@ -41,10 +41,12 @@ namespace NovetusLauncher
#region Form Events #region Form Events
private void CustomGraphicsOptions_Load(object sender, EventArgs e) private void CustomGraphicsOptions_Load(object sender, EventArgs e)
{ {
ClientManagement.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); string client = GlobalVars.UserConfiguration.ReadSetting("SelectedClient");
info = ClientManagement.GetClientInfoValues(GlobalVars.UserConfiguration.SelectedClient);
string terms = "_" + GlobalVars.UserConfiguration.SelectedClient; ClientManagement.ReadClientValues(client);
info = ClientManagement.GetClientInfoValues(client);
string terms = "_" + client;
bool hasFoundDir = false; bool hasFoundDir = false;
string[] dirs = Directory.GetFiles(GlobalPaths.ConfigDirClients); string[] dirs = Directory.GetFiles(GlobalPaths.ConfigDirClients);
@ -423,12 +425,12 @@ namespace NovetusLauncher
private void Style2007FolderFinder_Click(object sender, EventArgs e) private void Style2007FolderFinder_Click(object sender, EventArgs e)
{ {
Process.Start("explorer.exe", GlobalPaths.ClientDir.Replace(@"\\", @"\") + @"\" + GlobalVars.UserConfiguration.SelectedClient + @"\Styles"); Process.Start("explorer.exe", GlobalPaths.ClientDir.Replace(@"\\", @"\") + @"\" + GlobalVars.UserConfiguration.ReadSetting("SelectedClient") + @"\Styles");
} }
private void Styles2007Info_Click(object sender, EventArgs e) private void Styles2007Info_Click(object sender, EventArgs e)
{ {
MessageBox.Show("Make sure you place the styles you want in the Styles folder in " + GlobalPaths.ClientDir.Replace(@"\\", @"\") + @"\" + GlobalVars.UserConfiguration.SelectedClient + @"\Styles." + Environment.NewLine + "If the files are not placed in this directory, they will not be loaded properly.\nThis client will accept .msstyles and .cjstyles files.", "Novetus - Styles Help", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Make sure you place the styles you want in the Styles folder in " + GlobalPaths.ClientDir.Replace(@"\\", @"\") + @"\" + GlobalVars.UserConfiguration.ReadSetting("SelectedClient") + @"\Styles." + Environment.NewLine + "If the files are not placed in this directory, they will not be loaded properly.\nThis client will accept .msstyles and .cjstyles files.", "Novetus - Styles Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
private void GraphicsShadows2007_SelectedIndexChanged(object sender, EventArgs e) private void GraphicsShadows2007_SelectedIndexChanged(object sender, EventArgs e)
@ -446,10 +448,12 @@ namespace NovetusLauncher
private void CustomGraphicsOptions_Close(object sender, FormClosingEventArgs e) private void CustomGraphicsOptions_Close(object sender, FormClosingEventArgs e)
{ {
ClientManagement.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); string client = GlobalVars.UserConfiguration.ReadSetting("SelectedClient");
ClientManagement.ApplyClientSettings_custom(info, GlobalVars.UserConfiguration.SelectedClient, MeshDetail, ShadingQuality, MaterialQuality, ClientManagement.ReadClientValues(client);
AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, QualityLevel, ClientManagement.ApplyClientSettings_custom(info, client,
WindowResolution, FullscreenResolution, ModernResolution); MeshDetail, ShadingQuality, MaterialQuality,
AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, QualityLevel,
WindowResolution, FullscreenResolution, ModernResolution);
} }
#endregion #endregion

View File

@ -1405,7 +1405,7 @@ namespace NovetusLauncher
launcherForm.ProductVersionLabel = label8; launcherForm.ProductVersionLabel = label8;
launcherForm.NovetusVersionLabel = label11; launcherForm.NovetusVersionLabel = label11;
launcherForm.CloseOnLaunchCheckbox = checkBox1; launcherForm.CloseOnLaunchCheckbox = checkBox1;
launcherForm.DiscordPresenceCheckbox = checkBox2; launcherForm.DiscordRichPresenceCheckbox = checkBox2;
launcherForm.uPnPCheckBox = checkBox4; launcherForm.uPnPCheckBox = checkBox4;
launcherForm.ShowServerNotifsCheckBox = checkBox9; launcherForm.ShowServerNotifsCheckBox = checkBox9;
launcherForm.PlayerIDTextBox = textBox5; launcherForm.PlayerIDTextBox = textBox5;

View File

@ -225,7 +225,7 @@ namespace NovetusLauncher
private void checkBox2_CheckedChanged(object sender, EventArgs e) private void checkBox2_CheckedChanged(object sender, EventArgs e)
{ {
GlobalVars.UserConfiguration.DiscordPresence = checkBox2.Checked; GlobalVars.UserConfiguration.DiscordRichPresence = checkBox2.Checked;
} }
void CheckBox2Click(object sender, EventArgs e) void CheckBox2Click(object sender, EventArgs e)

View File

@ -1368,7 +1368,7 @@ namespace NovetusLauncher
launcherForm.ProductVersionLabel = label8; launcherForm.ProductVersionLabel = label8;
launcherForm.NovetusVersionLabel = label11; launcherForm.NovetusVersionLabel = label11;
launcherForm.CloseOnLaunchCheckbox = checkBox1; launcherForm.CloseOnLaunchCheckbox = checkBox1;
launcherForm.DiscordPresenceCheckbox = checkBox2; launcherForm.DiscordRichPresenceCheckbox = checkBox2;
launcherForm.uPnPCheckBox = checkBox4; launcherForm.uPnPCheckBox = checkBox4;
launcherForm.ShowServerNotifsCheckBox = checkBox9; launcherForm.ShowServerNotifsCheckBox = checkBox9;
launcherForm.PlayerIDTextBox = textBox5; launcherForm.PlayerIDTextBox = textBox5;

View File

@ -234,7 +234,7 @@ namespace NovetusLauncher
private void checkBox2_CheckedChanged(object sender, EventArgs e) private void checkBox2_CheckedChanged(object sender, EventArgs e)
{ {
GlobalVars.UserConfiguration.DiscordPresence = checkBox2.Checked; GlobalVars.UserConfiguration.DiscordRichPresence = checkBox2.Checked;
} }
void CheckBox2Click(object sender, EventArgs e) void CheckBox2Click(object sender, EventArgs e)

View File

@ -58,7 +58,7 @@ namespace NovetusLauncher
public Label SplashLabel, ProductVersionLabel, NovetusVersionLabel, PlayerTripcodeLabel, IPLabel, PortLabel, public Label SplashLabel, ProductVersionLabel, NovetusVersionLabel, PlayerTripcodeLabel, IPLabel, PortLabel,
SelectedClientLabel, SelectedMapLabel, ClientWarningLabel = null; SelectedClientLabel, SelectedMapLabel, ClientWarningLabel = null;
public ComboBox StyleSelectorBox = null; public ComboBox StyleSelectorBox = null;
public CheckBox CloseOnLaunchCheckbox, DiscordPresenceCheckbox, uPnPCheckBox, ShowServerNotifsCheckBox, LocalPlayCheckBox = null; public CheckBox CloseOnLaunchCheckbox, DiscordRichPresenceCheckbox, uPnPCheckBox, ShowServerNotifsCheckBox, LocalPlayCheckBox = null;
public Button RegeneratePlayerIDButton = null; public Button RegeneratePlayerIDButton = null;
public NumericUpDown PlayerLimitBox, HostPortBox = null; public NumericUpDown PlayerLimitBox, HostPortBox = null;
public string TabPageHost, TabPageMaps, TabPageClients, TabPageSaved, OldIP = ""; public string TabPageHost, TabPageMaps, TabPageClients, TabPageSaved, OldIP = "";
@ -175,7 +175,7 @@ namespace NovetusLauncher
{ {
WriteConfigValues(); WriteConfigValues();
} }
if (GlobalVars.UserConfiguration.DiscordPresence) if (GlobalVars.UserConfiguration.DiscordRichPresence)
{ {
IDiscordRPC.Shutdown(); IDiscordRPC.Shutdown();
} }
@ -595,7 +595,7 @@ namespace NovetusLauncher
HostPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); HostPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
IPLabel.Text = GlobalVars.CurrentServer.ServerIP; IPLabel.Text = GlobalVars.CurrentServer.ServerIP;
PortLabel.Text = GlobalVars.CurrentServer.ServerPort.ToString(); PortLabel.Text = GlobalVars.CurrentServer.ServerPort.ToString();
DiscordPresenceCheckbox.Checked = GlobalVars.UserConfiguration.DiscordPresence; DiscordRichPresenceCheckbox.Checked = GlobalVars.UserConfiguration.DiscordRichPresence;
uPnPCheckBox.Checked = GlobalVars.UserConfiguration.UPnP; uPnPCheckBox.Checked = GlobalVars.UserConfiguration.UPnP;
ShowServerNotifsCheckBox.Checked = GlobalVars.UserConfiguration.ShowServerNotifications; ShowServerNotifsCheckBox.Checked = GlobalVars.UserConfiguration.ShowServerNotifications;
ServerBrowserNameBox.Text = GlobalVars.UserConfiguration.ServerBrowserServerName; ServerBrowserNameBox.Text = GlobalVars.UserConfiguration.ServerBrowserServerName;

View File

@ -121,7 +121,7 @@ namespace NovetusLauncher
launcherFormStylishInterface1.mapsBox.SelectedNode.ForeColor = SystemColors.HighlightText; launcherFormStylishInterface1.mapsBox.SelectedNode.ForeColor = SystemColors.HighlightText;
} }
launcherFormStylishInterface1.serverPortBox.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); launcherFormStylishInterface1.serverPortBox.Text = GlobalVars.UserConfiguration.RobloxPort.ToString();
launcherFormStylishInterface1.discordRichPresenceBox.IsChecked = GlobalVars.UserConfiguration.DiscordPresence; launcherFormStylishInterface1.discordRichPresenceBox.IsChecked = GlobalVars.UserConfiguration.DiscordRichPresence;
launcherFormStylishInterface1.uPnPBox.IsChecked = GlobalVars.UserConfiguration.UPnP; launcherFormStylishInterface1.uPnPBox.IsChecked = GlobalVars.UserConfiguration.UPnP;
launcherFormStylishInterface1.NotifBox.IsChecked = GlobalVars.UserConfiguration.ShowServerNotifications; launcherFormStylishInterface1.NotifBox.IsChecked = GlobalVars.UserConfiguration.ShowServerNotifications;
launcherFormStylishInterface1.browserNameBox.Text = GlobalVars.UserConfiguration.ServerBrowserServerName; launcherFormStylishInterface1.browserNameBox.Text = GlobalVars.UserConfiguration.ServerBrowserServerName;

View File

@ -390,14 +390,14 @@ namespace NovetusLauncher
{ {
if (!IsLoaded) if (!IsLoaded)
return; return;
GlobalVars.UserConfiguration.DiscordPresence = (bool)discordRichPresenceBox.IsChecked; GlobalVars.UserConfiguration.DiscordRichPresence = (bool)discordRichPresenceBox.IsChecked;
} }
private void discordRichPresenceBox_Unchecked(object sender, RoutedEventArgs e) private void discordRichPresenceBox_Unchecked(object sender, RoutedEventArgs e)
{ {
if (!IsLoaded) if (!IsLoaded)
return; return;
GlobalVars.UserConfiguration.DiscordPresence = (bool)discordRichPresenceBox.IsChecked; GlobalVars.UserConfiguration.DiscordRichPresence = (bool)discordRichPresenceBox.IsChecked;
} }
private void minimizeOnLaunchBox_Checked(object sender, RoutedEventArgs e) private void minimizeOnLaunchBox_Checked(object sender, RoutedEventArgs e)

View File

@ -20,15 +20,12 @@ namespace NovetusLauncher
#region Form Events #region Form Events
private void NovetusSettings_Load(object sender, EventArgs e) private void NovetusSettings_Load(object sender, EventArgs e)
{ {
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
ReadConfigValues(); ReadConfigValues();
CenterToScreen(); CenterToScreen();
} }
private void NovetusSettings_Close(object sender, FormClosingEventArgs e) private void NovetusSettings_Close(object sender, FormClosingEventArgs e)
{ {
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
FormCollection fc = Application.OpenForms; FormCollection fc = Application.OpenForms;
foreach (Form frm in fc) foreach (Form frm in fc)

View File

@ -65,7 +65,6 @@ public partial class NovetusSDK : Form
private void NovetusSDK_Close(object sender, CancelEventArgs e) private void NovetusSDK_Close(object sender, CancelEventArgs e)
{ {
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
ClientManagement.ReadClientValues(); ClientManagement.ReadClientValues();
if (!IsLauncher && !GlobalVars.AppClosed) if (!IsLauncher && !GlobalVars.AppClosed)
{ {

View File

@ -97,14 +97,14 @@ namespace NovetusLauncher
private async void ServerBrowser_Load(object sender, EventArgs e) private async void ServerBrowser_Load(object sender, EventArgs e)
{ {
MasterServerBox.Text = GlobalVars.UserConfiguration.ServerBrowserServerAddress; MasterServerBox.Text = GlobalVars.UserConfiguration.ReadSetting("ServerBrowserServerAddress");
CenterToScreen(); CenterToScreen();
await LoadServers(); await LoadServers();
} }
private void MasterServerBox_TextChanged(object sender, EventArgs e) private void MasterServerBox_TextChanged(object sender, EventArgs e)
{ {
GlobalVars.UserConfiguration.ServerBrowserServerAddress = MasterServerBox.Text; GlobalVars.UserConfiguration.SaveSetting("ServerBrowserServerAddress", MasterServerBox.Text);
} }
#endregion #endregion

View File

@ -49,7 +49,6 @@ namespace NovetusLauncher
FileManagement.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, FileManagement.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName,
GlobalPaths.ConfigDir + "\\" + GlobalPaths.TermListFileName); GlobalPaths.ConfigDir + "\\" + GlobalPaths.TermListFileName);
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
GlobalVars.ColorsLoaded = FileManagement.InitColors(); GlobalVars.ColorsLoaded = FileManagement.InitColors();
bool isSDK = false; bool isSDK = false;
@ -138,7 +137,7 @@ namespace NovetusLauncher
{ {
if (!sdk) if (!sdk)
{ {
switch (GlobalVars.UserConfiguration.LauncherStyle) switch ((Settings.Style)GlobalVars.UserConfiguration.ReadSettingInt("LauncherStyle"))
{ {
case Settings.Style.Compact: case Settings.Style.Compact:
LauncherFormCompact compact = new LauncherFormCompact(); LauncherFormCompact compact = new LauncherFormCompact();

View File

@ -87,7 +87,7 @@ namespace NovetusURI
string ip = SecurityFuncs.Decode(SplitArg[0]); string ip = SecurityFuncs.Decode(SplitArg[0]);
string port = SecurityFuncs.Decode(SplitArg[1]); string port = SecurityFuncs.Decode(SplitArg[1]);
string client = SecurityFuncs.Decode(SplitArg[2]); string client = SecurityFuncs.Decode(SplitArg[2]);
GlobalVars.UserConfiguration.SelectedClient = client; GlobalVars.UserConfiguration.SaveSetting("SelectedClient", client);
GlobalVars.CurrentServer.ServerIP = ip; GlobalVars.CurrentServer.ServerIP = ip;
GlobalVars.CurrentServer.ServerPort = Convert.ToInt32(port); GlobalVars.CurrentServer.ServerPort = Convert.ToInt32(port);
ClientManagement.ReadClientValues(); ClientManagement.ReadClientValues();

View File

@ -25,7 +25,7 @@ namespace NovetusURI
{ {
ClientManagement.UpdateStatus(label1, "Initializing..."); ClientManagement.UpdateStatus(label1, "Initializing...");
if (GlobalVars.UserConfiguration.URIQuickConfigure) if (GlobalVars.UserConfiguration.ReadSettingBool("URIQuickConfigure"))
{ {
ClientManagement.UpdateStatus(label1, "Loading Player Configuration Menu...."); ClientManagement.UpdateStatus(label1, "Loading Player Configuration Menu....");
QuickConfigure main = new QuickConfigure(); QuickConfigure main = new QuickConfigure();
@ -33,7 +33,6 @@ namespace NovetusURI
} }
else else
{ {
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
ClientManagement.ReadClientValues(); ClientManagement.ReadClientValues();
LocalVars.ReadyToLaunch = true; LocalVars.ReadyToLaunch = true;
} }
@ -62,7 +61,7 @@ namespace NovetusURI
GlobalVars.GameOpened = ScriptType.None; GlobalVars.GameOpened = ScriptType.None;
} }
if (GlobalVars.UserConfiguration.WebProxyEnabled) if (GlobalVars.UserConfiguration.ReadSettingBool("WebProxyEnabled"))
{ {
GlobalVars.Proxy.Stop(); GlobalVars.Proxy.Stop();
} }
@ -81,7 +80,7 @@ namespace NovetusURI
ClientManagement.UpdateStatus(label1, "Ready to launch."); ClientManagement.UpdateStatus(label1, "Ready to launch.");
Visible = true; Visible = true;
CenterToScreen(); CenterToScreen();
if (GlobalVars.UserConfiguration.DiscordPresence) if (GlobalVars.UserConfiguration.ReadSettingBool("DiscordRichPresence"))
{ {
ClientManagement.UpdateStatus(label1, "Starting Discord Rich Presence..."); ClientManagement.UpdateStatus(label1, "Starting Discord Rich Presence...");
DiscordRPC.StartDiscord(); DiscordRPC.StartDiscord();

View File

@ -33,22 +33,21 @@ namespace NovetusURI
void ReadConfigValues(string cfgpath) void ReadConfigValues(string cfgpath)
{ {
FileManagement.Config(cfgpath, false); DontShowBox.Checked = !GlobalVars.UserConfiguration.ReadSettingBool("URIQuickConfigure");
DontShowBox.Checked = !GlobalVars.UserConfiguration.URIQuickConfigure; IDBox.Text = GlobalVars.UserConfiguration.ReadSetting("UserID");
IDBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
TripcodeLabel.Text = GlobalVars.PlayerTripcode.ToString(); TripcodeLabel.Text = GlobalVars.PlayerTripcode.ToString();
NameBox.Text = GlobalVars.UserConfiguration.PlayerName; NameBox.Text = GlobalVars.UserConfiguration.ReadSetting("PlayerName");
} }
void GeneratePlayerID() void GeneratePlayerID()
{ {
NovetusFuncs.GeneratePlayerID(); NovetusFuncs.GeneratePlayerID();
IDBox.Text = GlobalVars.UserConfiguration.UserID.ToString(); IDBox.Text = GlobalVars.UserConfiguration.ReadSetting("UserID");
} }
void TextBox1TextChanged(object sender, EventArgs e) void TextBox1TextChanged(object sender, EventArgs e)
{ {
GlobalVars.UserConfiguration.PlayerName = NameBox.Text; GlobalVars.UserConfiguration.SaveSetting("PlayerName", NameBox.Text);
} }
void TextBox2TextChanged(object sender, EventArgs e) void TextBox2TextChanged(object sender, EventArgs e)
@ -58,16 +57,16 @@ namespace NovetusURI
{ {
if (IDBox.Text.Equals("")) if (IDBox.Text.Equals(""))
{ {
GlobalVars.UserConfiguration.UserID = 0; GlobalVars.UserConfiguration.SaveSettingInt("UserID", 0);
} }
else else
{ {
GlobalVars.UserConfiguration.UserID = Convert.ToInt32(IDBox.Text); GlobalVars.UserConfiguration.SaveSettingInt("UserID", Convert.ToInt32(IDBox.Text));
} }
} }
else else
{ {
GlobalVars.UserConfiguration.UserID = 0; GlobalVars.UserConfiguration.SaveSettingInt("UserID", 0);
} }
} }
@ -83,12 +82,11 @@ namespace NovetusURI
private void DontShowBox_CheckedChanged(object sender, EventArgs e) private void DontShowBox_CheckedChanged(object sender, EventArgs e)
{ {
GlobalVars.UserConfiguration.URIQuickConfigure = !DontShowBox.Checked; GlobalVars.UserConfiguration.SaveSettingBool("URIQuickConfigure", !DontShowBox.Checked);
} }
void QuickConfigureClose(object sender, CancelEventArgs e) void QuickConfigureClose(object sender, CancelEventArgs e)
{ {
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
ClientManagement.ReadClientValues(); ClientManagement.ReadClientValues();
LocalVars.ReadyToLaunch = true; LocalVars.ReadyToLaunch = true;
} }

View File

@ -33,7 +33,6 @@ namespace NovetusURI
FileManagement.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, FileManagement.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName,
GlobalPaths.ConfigDir + "\\" + GlobalPaths.TermListFileName); GlobalPaths.ConfigDir + "\\" + GlobalPaths.TermListFileName);
FileManagement.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
GlobalVars.ColorsLoaded = FileManagement.InitColors(); GlobalVars.ColorsLoaded = FileManagement.InitColors();
if (args.Length == 0) if (args.Length == 0)
{ {