better config file handling.

This commit is contained in:
Bitl 2021-11-24 19:03:31 -07:00
parent e6564c4ac9
commit 972b7bc81b
13 changed files with 124 additions and 68 deletions

View File

@ -18,7 +18,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>TRACE;DEBUG;PREPARER</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE;PREPARER</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>

View File

@ -82,6 +82,7 @@ namespace Novetus.ReleasePreparer
Console.WriteLine("Editing " + infopathlite); Console.WriteLine("Editing " + infopathlite);
SetToLite(infopathlite); SetToLite(infopathlite);
string currbranchlite = GetBranch(infopathlite); string currbranchlite = GetBranch(infopathlite);
TurnOnInitialSequence(infopathlite);
string pathlite = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releasenomapsversion.txt"; string pathlite = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releasenomapsversion.txt";
Console.WriteLine("Creating " + pathlite); Console.WriteLine("Creating " + pathlite);
@ -101,6 +102,7 @@ namespace Novetus.ReleasePreparer
{ {
string infopath = novpath + @"\\config\\info.ini"; string infopath = novpath + @"\\config\\info.ini";
string currver = GetBranch(infopath); string currver = GetBranch(infopath);
TurnOnInitialSequence(infopath);
string pathbeta = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\betaversion.txt"; string pathbeta = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\betaversion.txt";
Console.WriteLine("Creating " + pathbeta); Console.WriteLine("Creating " + pathbeta);
@ -118,6 +120,7 @@ namespace Novetus.ReleasePreparer
{ {
string infopath = novpath + @"\\config\\info.ini"; string infopath = novpath + @"\\config\\info.ini";
string currbranch = GetBranch(infopath); string currbranch = GetBranch(infopath);
TurnOnInitialSequence(infopath);
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releaseversion.txt"; string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\\releaseversion.txt";
Console.WriteLine("Creating " + path); Console.WriteLine("Creating " + path);
@ -206,6 +209,19 @@ namespace Novetus.ReleasePreparer
SetToLite(infopath); SetToLite(infopath);
} }
} }
public static void TurnOnInitialSequence(string infopath)
{
//READ
INIFile ini = new INIFile(infopath);
string section = "ProgramInfo";
string initialBootup = ini.IniReadValue(section, "InitialBootup", "True");
if (Convert.ToBoolean(initialBootup) == false)
{
ini.IniWriteValue(section, "InitialBootup", "True");
}
}
} }
#endregion #endregion
} }

View File

@ -154,6 +154,7 @@ namespace NovetusCMD
{ {
GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, true, GlobalFuncs.ReadInfoFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName, true,
GlobalPaths.RootPathLauncher + "\\Novetus.exe"); GlobalPaths.RootPathLauncher + "\\Novetus.exe");
GlobalFuncs.TurnOffInitialSequence();
Console.Title = "Novetus " + GlobalVars.ProgramInformation.Version + " CMD"; Console.Title = "Novetus " + GlobalVars.ProgramInformation.Version + " CMD";
GlobalFuncs.ConsolePrint("NovetusCMD version " + GlobalVars.ProgramInformation.Version + " loaded.", 1); GlobalFuncs.ConsolePrint("NovetusCMD version " + GlobalVars.ProgramInformation.Version + " loaded.", 1);

View File

@ -52,7 +52,6 @@ public class FileFormat
CloseOnLaunch = false; CloseOnLaunch = false;
UserID = 0; UserID = 0;
PlayerName = "Player"; PlayerName = "Player";
PlayerTripcode = "";
RobloxPort = 53640; RobloxPort = 53640;
PlayerLimit = 12; PlayerLimit = 12;
UPnP = false; UPnP = false;
@ -73,7 +72,6 @@ public class FileFormat
ServerBrowserServerName = "Novetus"; ServerBrowserServerName = "Novetus";
ServerBrowserServerAddress = "localhost"; ServerBrowserServerAddress = "localhost";
Priority = ProcessPriorityClass.RealTime; Priority = ProcessPriorityClass.RealTime;
InitialBootup = true;
FirstServerLaunch = true; FirstServerLaunch = true;
NewGUI = false; NewGUI = false;
} }
@ -83,7 +81,6 @@ public class FileFormat
public bool CloseOnLaunch { get; set; } public bool CloseOnLaunch { get; set; }
public int UserID { get; set; } public int UserID { get; set; }
public string PlayerName { get; set; } public string PlayerName { get; set; }
public string PlayerTripcode { get; set; }
public int RobloxPort { get; set; } public int RobloxPort { get; set; }
public int PlayerLimit { get; set; } public int PlayerLimit { get; set; }
public bool UPnP { get; set; } public bool UPnP { get; set; }
@ -104,7 +101,6 @@ public class FileFormat
public string ServerBrowserServerName { get; set; } public string ServerBrowserServerName { get; set; }
public string ServerBrowserServerAddress { get; set; } public string ServerBrowserServerAddress { get; set; }
public ProcessPriorityClass Priority { get; set; } public ProcessPriorityClass Priority { get; set; }
public bool InitialBootup { get; set; }
public bool FirstServerLaunch { get; set; } public bool FirstServerLaunch { get; set; }
public bool NewGUI { get; set; } public bool NewGUI { get; set; }
} }
@ -182,6 +178,7 @@ public class FileFormat
RegisterClient2 = ""; RegisterClient2 = "";
DefaultMap = ""; DefaultMap = "";
IsLite = false; IsLite = false;
InitialBootup = true;
} }
public string Version { get; set; } public string Version { get; set; }
@ -191,6 +188,7 @@ public class FileFormat
public string RegisterClient2 { get; set; } public string RegisterClient2 { get; set; }
public string DefaultMap { get; set; } public string DefaultMap { get; set; }
public bool IsLite { get; set; } public bool IsLite { get; set; }
public bool InitialBootup { get; set; }
} }
#endregion #endregion
} }

View File

@ -51,23 +51,17 @@ public class INIFile
/// <returns></returns> /// <returns></returns>
public string IniReadValue(string Section, string Key, string DefaultValue = "") public string IniReadValue(string Section, string Key, string DefaultValue = "")
{ {
try if (IniValueExists(Key))
{ {
StringBuilder temp = new StringBuilder(255); StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp, int i = GetPrivateProfileString(Section, Key, "", temp,
255, path); 255, path);
return temp.ToString(); return temp.ToString();
} }
#if URI || LAUNCHER || CMD || BASICLAUNCHER else
catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex);
#else
catch (Exception)
{
#endif
IniWriteValue(Section, Key, DefaultValue); IniWriteValue(Section, Key, DefaultValue);
return IniReadValue(Section, Key); return DefaultValue;
} }
} }

View File

@ -29,7 +29,8 @@ public class GlobalFuncs
//READ //READ
string versionbranch, defaultclient, defaultmap, regclient1, string versionbranch, defaultclient, defaultmap, regclient1,
regclient2, extendedversionnumber, extendedversiontemplate, regclient2, extendedversionnumber, extendedversiontemplate,
extendedversionrevision, extendedversioneditchangelog, isLite; extendedversionrevision, extendedversioneditchangelog, isLite,
initialBootup;
INIFile ini = new INIFile(infopath); INIFile ini = new INIFile(infopath);
@ -46,6 +47,7 @@ public class GlobalFuncs
extendedversiontemplate = ini.IniReadValue(section, "ExtendedVersionTemplate", "%version%"); extendedversiontemplate = ini.IniReadValue(section, "ExtendedVersionTemplate", "%version%");
extendedversionrevision = ini.IniReadValue(section, "ExtendedVersionRevision", "-1"); extendedversionrevision = ini.IniReadValue(section, "ExtendedVersionRevision", "-1");
isLite = ini.IniReadValue(section, "IsLite", "False"); isLite = ini.IniReadValue(section, "IsLite", "False");
initialBootup = ini.IniReadValue(section, "InitialBootup", "True");
GlobalVars.ProgramInformation.IsLite = Convert.ToBoolean(isLite); GlobalVars.ProgramInformation.IsLite = Convert.ToBoolean(isLite);
@ -105,6 +107,7 @@ public class GlobalFuncs
GlobalVars.ProgramInformation.DefaultMap = defaultmap; GlobalVars.ProgramInformation.DefaultMap = defaultmap;
GlobalVars.ProgramInformation.RegisterClient1 = regclient1; GlobalVars.ProgramInformation.RegisterClient1 = regclient1;
GlobalVars.ProgramInformation.RegisterClient2 = regclient2; GlobalVars.ProgramInformation.RegisterClient2 = regclient2;
GlobalVars.ProgramInformation.InitialBootup = Convert.ToBoolean(initialBootup);
GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient; GlobalVars.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient;
GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap; GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
@ -122,13 +125,26 @@ public class GlobalFuncs
} }
} }
public static void TurnOffInitialSequence()
{
//READ
INIFile ini = new INIFile(GlobalPaths.ConfigDir + "\\" + GlobalPaths.InfoName);
string section = "ProgramInfo";
string initialBootup = ini.IniReadValue(section, "InitialBootup", "True");
if (Convert.ToBoolean(initialBootup) == true)
{
ini.IniWriteValue(section, "InitialBootup", "False");
}
}
public static string ConfigUseOldValIfExists(INIFile ini, string section, string oldKey, string newKey, string val, bool write) public static string ConfigUseOldValIfExists(INIFile ini, string section, string oldKey, string newKey, string val, bool write)
{ {
if (write) if (write)
{ {
if (!ini.IniValueExists(newKey)) if (!ini.IniValueExists(newKey))
{ {
if (GlobalVars.UserConfiguration.InitialBootup) if (GlobalVars.ProgramInformation.InitialBootup)
{ {
if (ini.IniValueExists(oldKey)) if (ini.IniValueExists(oldKey))
{ {
@ -164,7 +180,33 @@ public class GlobalFuncs
} }
} }
public static void Config(string cfgpath, bool write) 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)
{ {
if (write) if (write)
{ {
@ -194,7 +236,6 @@ public class GlobalFuncs
ini.IniWriteValue(section, "ServerBrowserServerName", GlobalVars.UserConfiguration.ServerBrowserServerName.ToString()); ini.IniWriteValue(section, "ServerBrowserServerName", GlobalVars.UserConfiguration.ServerBrowserServerName.ToString());
ini.IniWriteValue(section, "ServerBrowserServerAddress", GlobalVars.UserConfiguration.ServerBrowserServerAddress.ToString()); ini.IniWriteValue(section, "ServerBrowserServerAddress", GlobalVars.UserConfiguration.ServerBrowserServerAddress.ToString());
ini.IniWriteValue(section, "ClientLaunchPriority", ((int)GlobalVars.UserConfiguration.Priority).ToString()); ini.IniWriteValue(section, "ClientLaunchPriority", ((int)GlobalVars.UserConfiguration.Priority).ToString());
ini.IniWriteValue(section, "InitialBootup", GlobalVars.UserConfiguration.InitialBootup.ToString());
ini.IniWriteValue(section, "FirstServerLaunch", GlobalVars.UserConfiguration.FirstServerLaunch.ToString()); ini.IniWriteValue(section, "FirstServerLaunch", GlobalVars.UserConfiguration.FirstServerLaunch.ToString());
ini.IniWriteValue(section, "NewGUI", GlobalVars.UserConfiguration.NewGUI.ToString()); ini.IniWriteValue(section, "NewGUI", GlobalVars.UserConfiguration.NewGUI.ToString());
ConfigUseOldValIfExists(ini, section, "ItemMakerDisableHelpMessage", "AssetSDKDisableHelpMessage", GlobalVars.UserConfiguration.DisabledAssetSDKHelp.ToString(), write); ConfigUseOldValIfExists(ini, section, "ItemMakerDisableHelpMessage", "AssetSDKDisableHelpMessage", GlobalVars.UserConfiguration.DisabledAssetSDKHelp.ToString(), write);
@ -209,7 +250,7 @@ public class GlobalFuncs
map, port, limit, upnp, map, port, limit, upnp,
disablehelpmessage, discord, mappath, mapsnip, disablehelpmessage, discord, mappath, mapsnip,
graphics, reshade, qualitylevel, style, savebackups, altIP, graphics, reshade, qualitylevel, style, savebackups, altIP,
disReshadeDel, showNotifs, SB_Name, SB_Address, priority, initialBootup, disReshadeDel, showNotifs, SB_Name, SB_Address, priority,
firstServerLaunch, newgui; firstServerLaunch, newgui;
INIFile ini = new INIFile(cfgpath); INIFile ini = new INIFile(cfgpath);
@ -237,13 +278,18 @@ public class GlobalFuncs
SB_Name = ini.IniReadValue(section, "ServerBrowserServerName", GlobalVars.UserConfiguration.ServerBrowserServerName.ToString()); SB_Name = ini.IniReadValue(section, "ServerBrowserServerName", GlobalVars.UserConfiguration.ServerBrowserServerName.ToString());
SB_Address = ini.IniReadValue(section, "ServerBrowserServerAddress", GlobalVars.UserConfiguration.ServerBrowserServerAddress.ToString()); SB_Address = ini.IniReadValue(section, "ServerBrowserServerAddress", GlobalVars.UserConfiguration.ServerBrowserServerAddress.ToString());
priority = ini.IniReadValue(section, "ClientLaunchPriority", ((int)GlobalVars.UserConfiguration.Priority).ToString()); priority = ini.IniReadValue(section, "ClientLaunchPriority", ((int)GlobalVars.UserConfiguration.Priority).ToString());
initialBootup = ini.IniReadValue(section, "InitialBootup", GlobalVars.UserConfiguration.InitialBootup.ToString());
firstServerLaunch = ini.IniReadValue(section, "FirstServerLaunch", GlobalVars.UserConfiguration.FirstServerLaunch.ToString()); firstServerLaunch = ini.IniReadValue(section, "FirstServerLaunch", GlobalVars.UserConfiguration.FirstServerLaunch.ToString());
newgui = ini.IniReadValue(section, "NewGUI", GlobalVars.UserConfiguration.NewGUI.ToString()); newgui = ini.IniReadValue(section, "NewGUI", GlobalVars.UserConfiguration.NewGUI.ToString());
disablehelpmessage = ConfigUseOldValIfExists(ini, section, "ItemMakerDisableHelpMessage", "AssetSDKDisableHelpMessage", GlobalVars.UserConfiguration.DisabledAssetSDKHelp.ToString(), write); disablehelpmessage = ConfigUseOldValIfExists(ini, section, "ItemMakerDisableHelpMessage", "AssetSDKDisableHelpMessage", GlobalVars.UserConfiguration.DisabledAssetSDKHelp.ToString(), write);
savebackups = ConfigUseOldValIfExists(ini, section, "AssetLocalizerSaveBackups", "AssetSDKFixerSaveBackups", GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups.ToString(), write); savebackups = ConfigUseOldValIfExists(ini, section, "AssetLocalizerSaveBackups", "AssetSDKFixerSaveBackups", GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups.ToString(), write);
GlobalVars.UserConfiguration.CloseOnLaunch = Convert.ToBoolean(closeonlaunch); 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")) if (userid.Equals("0"))
{ {
@ -252,32 +298,31 @@ public class GlobalFuncs
} }
else else
{ {
GlobalVars.UserConfiguration.UserID = Convert.ToInt32(userid); GlobalVars.UserConfiguration.UserID = ValueInt(userid, DefaultConfiguration.UserID);
} }
GlobalVars.UserConfiguration.PlayerName = name; GlobalVars.UserConfiguration.PlayerName = name;
GlobalVars.UserConfiguration.SelectedClient = selectedclient; GlobalVars.UserConfiguration.SelectedClient = selectedclient;
GlobalVars.UserConfiguration.Map = map; GlobalVars.UserConfiguration.Map = map;
GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port); GlobalVars.UserConfiguration.RobloxPort = ValueInt(port, DefaultConfiguration.RobloxPort);
GlobalVars.UserConfiguration.PlayerLimit = Convert.ToInt32(limit); GlobalVars.UserConfiguration.PlayerLimit = ValueInt(limit, DefaultConfiguration.PlayerLimit);
GlobalVars.UserConfiguration.UPnP = Convert.ToBoolean(upnp); GlobalVars.UserConfiguration.UPnP = ValueBool(upnp, DefaultConfiguration.UPnP);
GlobalVars.UserConfiguration.DisabledAssetSDKHelp = Convert.ToBoolean(disablehelpmessage); GlobalVars.UserConfiguration.DisabledAssetSDKHelp = ValueBool(disablehelpmessage, DefaultConfiguration.DisabledAssetSDKHelp);
GlobalVars.UserConfiguration.DiscordPresence = Convert.ToBoolean(discord); GlobalVars.UserConfiguration.DiscordPresence = ValueBool(discord, DefaultConfiguration.DiscordPresence);
GlobalVars.UserConfiguration.MapPathSnip = mapsnip; GlobalVars.UserConfiguration.MapPathSnip = mapsnip;
GlobalVars.UserConfiguration.GraphicsMode = (Settings.Mode)Convert.ToInt32(graphics); GlobalVars.UserConfiguration.GraphicsMode = (Settings.Mode)ValueInt(graphics, Convert.ToInt32(DefaultConfiguration.GraphicsMode));
GlobalVars.UserConfiguration.ReShade = Convert.ToBoolean(reshade); GlobalVars.UserConfiguration.ReShade = ValueBool(reshade, DefaultConfiguration.ReShade);
GlobalVars.UserConfiguration.QualityLevel = (Settings.Level)Convert.ToInt32(qualitylevel); GlobalVars.UserConfiguration.QualityLevel = (Settings.Level)ValueInt(qualitylevel, Convert.ToInt32(DefaultConfiguration.QualityLevel));
GlobalVars.UserConfiguration.LauncherStyle = (Settings.Style)Convert.ToInt32(style); GlobalVars.UserConfiguration.LauncherStyle = (Settings.Style)ValueInt(style, Convert.ToInt32(DefaultConfiguration.LauncherStyle));
GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups = Convert.ToBoolean(savebackups); GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups = ValueBool(savebackups, DefaultConfiguration.AssetSDKFixerSaveBackups);
GlobalVars.UserConfiguration.AlternateServerIP = altIP; GlobalVars.UserConfiguration.AlternateServerIP = altIP;
GlobalVars.UserConfiguration.DisableReshadeDelete = Convert.ToBoolean(disReshadeDel); GlobalVars.UserConfiguration.DisableReshadeDelete = ValueBool(disReshadeDel, DefaultConfiguration.DisableReshadeDelete);
GlobalVars.UserConfiguration.ShowServerNotifications = Convert.ToBoolean(showNotifs); GlobalVars.UserConfiguration.ShowServerNotifications = ValueBool(showNotifs, DefaultConfiguration.ShowServerNotifications);
GlobalVars.UserConfiguration.ServerBrowserServerName = SB_Name; GlobalVars.UserConfiguration.ServerBrowserServerName = SB_Name;
GlobalVars.UserConfiguration.ServerBrowserServerAddress = SB_Address; GlobalVars.UserConfiguration.ServerBrowserServerAddress = SB_Address;
GlobalVars.UserConfiguration.Priority = (ProcessPriorityClass)Convert.ToInt32(priority); GlobalVars.UserConfiguration.Priority = (ProcessPriorityClass)ValueInt(priority, Convert.ToInt32(DefaultConfiguration.Priority));
GlobalVars.UserConfiguration.InitialBootup = Convert.ToBoolean(initialBootup); GlobalVars.UserConfiguration.FirstServerLaunch = ValueBool(firstServerLaunch, DefaultConfiguration.FirstServerLaunch);
GlobalVars.UserConfiguration.FirstServerLaunch = Convert.ToBoolean(firstServerLaunch); GlobalVars.UserConfiguration.NewGUI = ValueBool(newgui, DefaultConfiguration.NewGUI);
GlobalVars.UserConfiguration.NewGUI = Convert.ToBoolean(newgui);
string oldMapath = Path.GetDirectoryName(GlobalVars.UserConfiguration.MapPath); string oldMapath = Path.GetDirectoryName(GlobalVars.UserConfiguration.MapPath);
//update the map path if the file doesn't exist and write to config. //update the map path if the file doesn't exist and write to config.
@ -309,9 +354,9 @@ public class GlobalFuncs
} }
string curval = GenerateAndReturnTripcode(); string curval = GenerateAndReturnTripcode();
if (!GlobalVars.UserConfiguration.PlayerTripcode.Equals(curval)) if (!GlobalVars.PlayerTripcode.Equals(curval))
{ {
GlobalVars.UserConfiguration.PlayerTripcode = curval; GlobalVars.PlayerTripcode = curval;
} }
if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization)) if (!File.Exists(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigNameCustomization))
@ -428,16 +473,18 @@ public class GlobalFuncs
extraishat = ini.IniReadValue(section3, "ExtraSelectionIsHat", GlobalVars.UserCustomization.ExtraSelectionIsHat.ToString()); extraishat = ini.IniReadValue(section3, "ExtraSelectionIsHat", GlobalVars.UserCustomization.ExtraSelectionIsHat.ToString());
showhatsonextra = ini.IniReadValue(section3, "ShowHatsOnExtra", GlobalVars.UserCustomization.ShowHatsInExtra.ToString()); showhatsonextra = ini.IniReadValue(section3, "ShowHatsOnExtra", GlobalVars.UserCustomization.ShowHatsInExtra.ToString());
FileFormat.CustomizationConfig DefaultCustomization = new FileFormat.CustomizationConfig();
GlobalVars.UserCustomization.Hat1 = hat1; GlobalVars.UserCustomization.Hat1 = hat1;
GlobalVars.UserCustomization.Hat2 = hat2; GlobalVars.UserCustomization.Hat2 = hat2;
GlobalVars.UserCustomization.Hat3 = hat3; GlobalVars.UserCustomization.Hat3 = hat3;
GlobalVars.UserCustomization.HeadColorID = Convert.ToInt32(headcolorid); GlobalVars.UserCustomization.HeadColorID = ValueInt(headcolorid, DefaultCustomization.HeadColorID);
GlobalVars.UserCustomization.TorsoColorID = Convert.ToInt32(torsocolorid); GlobalVars.UserCustomization.TorsoColorID = ValueInt(torsocolorid, DefaultCustomization.TorsoColorID);
GlobalVars.UserCustomization.LeftArmColorID = Convert.ToInt32(larmid); GlobalVars.UserCustomization.LeftArmColorID = ValueInt(larmid, DefaultCustomization.LeftArmColorID);
GlobalVars.UserCustomization.RightArmColorID = Convert.ToInt32(rarmid); GlobalVars.UserCustomization.RightArmColorID = ValueInt(rarmid, DefaultCustomization.RightArmColorID);
GlobalVars.UserCustomization.LeftLegColorID = Convert.ToInt32(llegid); GlobalVars.UserCustomization.LeftLegColorID = ValueInt(llegid, DefaultCustomization.LeftLegColorID);
GlobalVars.UserCustomization.RightLegColorID = Convert.ToInt32(rlegid); GlobalVars.UserCustomization.RightLegColorID = ValueInt(rlegid, DefaultCustomization.RightArmColorID);
GlobalVars.UserCustomization.HeadColorString = headcolorstring; GlobalVars.UserCustomization.HeadColorString = headcolorstring;
GlobalVars.UserCustomization.TorsoColorString = torsocolorstring; GlobalVars.UserCustomization.TorsoColorString = torsocolorstring;
@ -455,8 +502,8 @@ public class GlobalFuncs
GlobalVars.UserCustomization.CharacterID = characterid; GlobalVars.UserCustomization.CharacterID = characterid;
GlobalVars.UserCustomization.Extra = extra; GlobalVars.UserCustomization.Extra = extra;
GlobalVars.UserCustomization.ExtraSelectionIsHat = Convert.ToBoolean(extraishat); GlobalVars.UserCustomization.ExtraSelectionIsHat = ValueBool(extraishat, DefaultCustomization.ExtraSelectionIsHat);
GlobalVars.UserCustomization.ShowHatsInExtra = Convert.ToBoolean(showhatsonextra); GlobalVars.UserCustomization.ShowHatsInExtra = ValueBool(showhatsonextra, DefaultCustomization.ShowHatsInExtra);
} }
#if URI || LAUNCHER || CMD || BASICLAUNCHER #if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
@ -561,7 +608,7 @@ public class GlobalFuncs
{ {
try try
{ {
switch(Convert.ToInt32(framerate)) switch(ValueInt(framerate, 0))
{ {
case int showFPSLine when showFPSLine == 1 && Convert.ToInt32(frametime) == 1: case int showFPSLine when showFPSLine == 1 && Convert.ToInt32(frametime) == 1:
GlobalVars.UserConfiguration.ReShadeFPSDisplay = true; GlobalVars.UserConfiguration.ReShadeFPSDisplay = true;
@ -571,7 +618,7 @@ public class GlobalFuncs
break; break;
} }
switch (Convert.ToInt32(performance)) switch (ValueInt(performance, 0))
{ {
case 1: case 1:
GlobalVars.UserConfiguration.ReShadePerformanceMode = true; GlobalVars.UserConfiguration.ReShadePerformanceMode = true;

View File

@ -55,6 +55,7 @@ public static class GlobalVars
public static int DefaultRobloxPort = 53640; public static int DefaultRobloxPort = 53640;
public static int JoinPort = DefaultRobloxPort; public static int JoinPort = DefaultRobloxPort;
public static ScriptType GameOpened = ScriptType.None; public static ScriptType GameOpened = ScriptType.None;
public static string PlayerTripcode = "";
#endregion #endregion
#region NovetusCMD #region NovetusCMD

View File

@ -61,7 +61,7 @@ public class ScriptFuncs
+ (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "'," + (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
+ GlobalVars.Loadout + "," + GlobalVars.Loadout + ","
+ md5s + ",'" + md5s + ",'"
+ GlobalVars.UserConfiguration.PlayerTripcode + GlobalVars.PlayerTripcode
+ ((GlobalVars.ValidatedExtraFiles > 0) ? "'," + GlobalVars.ValidatedExtraFiles.ToString() + "," : "',0,") + ((GlobalVars.ValidatedExtraFiles > 0) ? "'," + GlobalVars.ValidatedExtraFiles.ToString() + "," : "',0,")
+ GlobalVars.UserConfiguration.NewGUI.ToString().ToLower() + ");"; + GlobalVars.UserConfiguration.NewGUI.ToString().ToLower() + ");";
case ScriptType.Server: case ScriptType.Server:
@ -360,7 +360,7 @@ public class ScriptFuncs
.Replace("%hat4d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Extra) .Replace("%hat4d%", GlobalPaths.hatGameDir + GlobalVars.UserCustomization.Extra)
.Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\").Replace(@"/", @"\")) .Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\").Replace(@"/", @"\"))
.Replace("%mapfilec%", extractedCode.Contains("%mapfilec%") ? GlobalFuncs.CopyMapToRBXAsset() : "") .Replace("%mapfilec%", extractedCode.Contains("%mapfilec%") ? GlobalFuncs.CopyMapToRBXAsset() : "")
.Replace("%tripcode%", GlobalVars.UserConfiguration.PlayerTripcode) .Replace("%tripcode%", GlobalVars.PlayerTripcode)
.Replace("%scripttype%", Generator.GetNameForType(type)) .Replace("%scripttype%", Generator.GetNameForType(type))
.Replace("%addonscriptpath%", GlobalPaths.AddonScriptPath) .Replace("%addonscriptpath%", GlobalPaths.AddonScriptPath)
.Replace("%notifications%", GlobalVars.UserConfiguration.ShowServerNotifications.ToString().ToLower()) .Replace("%notifications%", GlobalVars.UserConfiguration.ShowServerNotifications.ToString().ToLower())

View File

@ -244,11 +244,10 @@ public static class SplashReader
Splash returnsplash = missingsplash; Splash returnsplash = missingsplash;
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
if (GlobalVars.UserConfiguration.InitialBootup) if (GlobalVars.ProgramInformation.InitialBootup)
{ {
returnsplash = new Splash("Welcome to Novetus " + GlobalVars.ProgramInformation.Version + "!|Hi!"); returnsplash = new Splash("Welcome to Novetus " + GlobalVars.ProgramInformation.Version + "!|Hi!");
GlobalVars.UserConfiguration.InitialBootup = false; GlobalFuncs.TurnOffInitialSequence();
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
return returnsplash; return returnsplash;
} }

View File

@ -865,7 +865,7 @@ namespace NovetusLauncher
CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch; CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch;
PlayerIDTextBox.Text = GlobalVars.UserConfiguration.UserID.ToString(); PlayerIDTextBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); PlayerTripcodeLabel.Text = GlobalVars.PlayerTripcode.ToString();
PlayerLimitBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.PlayerLimit); PlayerLimitBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.PlayerLimit);
PlayerNameTextBox.Text = GlobalVars.UserConfiguration.PlayerName; PlayerNameTextBox.Text = GlobalVars.UserConfiguration.PlayerName;
SelectedClientLabel.Text = GlobalVars.UserConfiguration.SelectedClient; SelectedClientLabel.Text = GlobalVars.UserConfiguration.SelectedClient;

View File

@ -106,7 +106,7 @@ namespace NovetusLauncher
launcherFormStylishInterface1.minimizeOnLaunchBox.IsChecked = GlobalVars.UserConfiguration.CloseOnLaunch; launcherFormStylishInterface1.minimizeOnLaunchBox.IsChecked = GlobalVars.UserConfiguration.CloseOnLaunch;
launcherFormStylishInterface1.userIDBox.Text = GlobalVars.UserConfiguration.UserID.ToString(); launcherFormStylishInterface1.userIDBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
launcherFormStylishInterface1.tripcodeLabel.Content = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); launcherFormStylishInterface1.tripcodeLabel.Content = GlobalVars.PlayerTripcode.ToString();
launcherFormStylishInterface1.maxPlayersBox.Text = GlobalVars.UserConfiguration.PlayerLimit.ToString(); launcherFormStylishInterface1.maxPlayersBox.Text = GlobalVars.UserConfiguration.PlayerLimit.ToString();
launcherFormStylishInterface1.userNameBox.Text = GlobalVars.UserConfiguration.PlayerName; launcherFormStylishInterface1.userNameBox.Text = GlobalVars.UserConfiguration.PlayerName;
launcherFormStylishInterface1.mapsBox.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, launcherFormStylishInterface1.mapsBox.Nodes); launcherFormStylishInterface1.mapsBox.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, launcherFormStylishInterface1.mapsBox.Nodes);

View File

@ -51,7 +51,7 @@ namespace NovetusURI
// //
this.textBox1.Location = new System.Drawing.Point(55, 12); this.textBox1.Location = new System.Drawing.Point(55, 12);
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(217, 20); this.textBox1.Size = new System.Drawing.Size(357, 20);
this.textBox1.TabIndex = 0; this.textBox1.TabIndex = 0;
this.textBox1.Text = "Player"; this.textBox1.Text = "Player";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
@ -61,7 +61,7 @@ namespace NovetusURI
// //
this.textBox2.Location = new System.Drawing.Point(55, 38); this.textBox2.Location = new System.Drawing.Point(55, 38);
this.textBox2.Name = "textBox2"; this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(217, 20); this.textBox2.Size = new System.Drawing.Size(357, 20);
this.textBox2.TabIndex = 1; this.textBox2.TabIndex = 1;
this.textBox2.Text = "0"; this.textBox2.Text = "0";
this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
@ -87,7 +87,7 @@ namespace NovetusURI
// //
this.button1.Location = new System.Drawing.Point(12, 64); this.button1.Location = new System.Drawing.Point(12, 64);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(124, 23); this.button1.Size = new System.Drawing.Size(198, 23);
this.button1.TabIndex = 4; this.button1.TabIndex = 4;
this.button1.Text = "Customize Character"; this.button1.Text = "Customize Character";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
@ -97,7 +97,7 @@ namespace NovetusURI
// //
this.button2.Location = new System.Drawing.Point(12, 93); this.button2.Location = new System.Drawing.Point(12, 93);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(260, 23); this.button2.Size = new System.Drawing.Size(400, 23);
this.button2.TabIndex = 5; this.button2.TabIndex = 5;
this.button2.Text = "Close"; this.button2.Text = "Close";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
@ -105,9 +105,9 @@ namespace NovetusURI
// //
// button3 // button3
// //
this.button3.Location = new System.Drawing.Point(148, 64); this.button3.Location = new System.Drawing.Point(216, 64);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(124, 23); this.button3.Size = new System.Drawing.Size(196, 23);
this.button3.TabIndex = 6; this.button3.TabIndex = 6;
this.button3.Text = "Regenerate Player ID"; this.button3.Text = "Regenerate Player ID";
this.button3.UseVisualStyleBackColor = true; this.button3.UseVisualStyleBackColor = true;
@ -115,9 +115,9 @@ namespace NovetusURI
// //
// label3 // label3
// //
this.label3.Location = new System.Drawing.Point(12, 119); this.label3.Location = new System.Drawing.Point(3, 119);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(260, 18); this.label3.Size = new System.Drawing.Size(419, 18);
this.label3.TabIndex = 7; this.label3.TabIndex = 7;
this.label3.Text = "qwertyuiopasdfghjklz"; this.label3.Text = "qwertyuiopasdfghjklz";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -127,7 +127,7 @@ namespace NovetusURI
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLightLight; this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(284, 139); this.ClientSize = new System.Drawing.Size(424, 139);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);

View File

@ -33,7 +33,7 @@ namespace NovetusURI
{ {
GlobalFuncs.Config(cfgpath, false); GlobalFuncs.Config(cfgpath, false);
textBox2.Text = GlobalVars.UserConfiguration.UserID.ToString(); textBox2.Text = GlobalVars.UserConfiguration.UserID.ToString();
label3.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); label3.Text = GlobalVars.PlayerTripcode.ToString();
textBox1.Text = GlobalVars.UserConfiguration.PlayerName; textBox1.Text = GlobalVars.UserConfiguration.PlayerName;
} }