start of rewrite

This commit is contained in:
Bitl 2020-07-03 17:20:02 -07:00
parent 6265863c52
commit ba0e7fcb9e
12 changed files with 437 additions and 724 deletions

View File

@ -176,10 +176,13 @@ namespace NovetusCMD
{ {
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2); ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2);
GlobalVars.SelectedClient = GlobalVars.DefaultClient; GlobalVars.SelectedClient = GlobalVars.DefaultClient;
ReadClientValues(ClientName);
} }
else
{
LauncherFuncs.ReadClientValues(clientpath); LauncherFuncs.ReadClientValues(clientpath);
ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3); ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3);
}
} }
static string ProcessInput(string s) static string ProcessInput(string s)
@ -189,39 +192,7 @@ namespace NovetusCMD
public static void Main(string[] args) public static void Main(string[] args)
{ {
string[] lines = File.ReadAllLines(GlobalVars.ConfigDir + "\\info.txt"); //File is in System.IO LauncherFuncs.ReadInfoFile(GlobalVars.ConfigDir + "\\" + GlobalVars.InfoName, true);
GlobalVars.IsSnapshot = Convert.ToBoolean(lines[5]);
if (GlobalVars.IsSnapshot == true)
{
var versionInfo = FileVersionInfo.GetVersionInfo(GlobalVars.RootPathLauncher + "\\Novetus.exe");
GlobalVars.Version = lines[6].Replace("%version%", lines[0])
.Replace("%build%", versionInfo.ProductBuildPart.ToString())
.Replace("%revision%", versionInfo.FilePrivatePart.ToString())
.Replace("%snapshot-revision%", lines[7]);
string changelog = GlobalVars.BasePath + "\\changelog.txt";
if (File.Exists(changelog))
{
string[] changelogedit = File.ReadAllLines(changelog);
if (!changelogedit[0].Equals(GlobalVars.Version))
{
changelogedit[0] = GlobalVars.Version;
File.WriteAllLines(changelog, changelogedit);
}
}
}
else
{
GlobalVars.Version = lines[0];
}
GlobalVars.Branch = lines[0];
GlobalVars.DefaultClient = lines[1];
GlobalVars.DefaultMap = lines[2];
GlobalVars.RegisterClient1 = lines[3];
GlobalVars.RegisterClient2 = lines[4];
GlobalVars.SelectedClient = GlobalVars.DefaultClient;
GlobalVars.Map = GlobalVars.DefaultMap;
GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap;
GlobalVars.MapPathSnip = GlobalVars.MapsDirBase + @"\\" + GlobalVars.DefaultMap;
Console.Title = "Novetus " + GlobalVars.Version + " CMD"; Console.Title = "Novetus " + GlobalVars.Version + " CMD";
ConsolePrint("NovetusCMD version " + GlobalVars.Version + " loaded.", 1); ConsolePrint("NovetusCMD version " + GlobalVars.Version + " loaded.", 1);

View File

@ -1,17 +0,0 @@
public class AssetCacheDef
{
public AssetCacheDef(string clas, string[] id, string[] ext, string[] dir, string[] gamedir)
{
Class = clas;
Id = id;
Ext = ext;
Dir = dir;
GameDir = gamedir;
}
public string Class { get; set; }
public string[] Id { get; set; }
public string[] Ext { get; set; }
public string[] Dir { get; set; }
public string[] GameDir { get; set; }
}

View File

@ -164,16 +164,13 @@ public static class GlobalVars
//config name //config name
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.txt";
//launcher settings. //launcher settings.
public static bool CloseOnLaunch = false; public static bool CloseOnLaunch = false;
public static bool LocalPlayMode = false; public static bool LocalPlayMode = false;
public static bool OldLayout = false; public static bool OldLayout = false;
//client shit //client shit
public static string SelectedClient = ""; public static string SelectedClient = "";
public static string DefaultClient = "";
public static string RegisterClient1 = "";
public static string RegisterClient2 = "";
public static string DefaultMap = "";
public static bool UsesPlayerName = false; public static bool UsesPlayerName = false;
public static bool UsesID = true; public static bool UsesID = true;
public static string SelectedClientDesc = ""; public static string SelectedClientDesc = "";
@ -186,6 +183,11 @@ public static class GlobalVars
public static bool NoGraphicsModeOptions = false; public static bool NoGraphicsModeOptions = false;
public static string CustomArgs = ""; public static string CustomArgs = "";
public static string AddonScriptPath = ""; public static string AddonScriptPath = "";
//info shit
public static string DefaultClient = "";
public static string RegisterClient1 = "";
public static string RegisterClient2 = "";
public static string DefaultMap = "";
//charcustom //charcustom
public static string Custom_Hat1ID_Offline = "NoHat.rbxm"; public static string Custom_Hat1ID_Offline = "NoHat.rbxm";
public static string Custom_Hat2ID_Offline = "NoHat.rbxm"; public static string Custom_Hat2ID_Offline = "NoHat.rbxm";

View File

@ -9,6 +9,7 @@
using System.Text; using System.Text;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System;
//credit to BLaZiNiX //credit to BLaZiNiX
public class IniFile public class IniFile
@ -50,14 +51,21 @@ public class IniFile
/// </summary> /// </summary>
/// <PARAM name="Section"></PARAM> /// <PARAM name="Section"></PARAM>
/// <PARAM name="Key"></PARAM> /// <PARAM name="Key"></PARAM>
/// <PARAM name="Path"></PARAM> /// <PARAM name="Default Value. Optional for creating values in case they are invalid."></PARAM>
/// <returns></returns> /// <returns></returns>
public string IniReadValue(string Section, string Key) public string IniReadValue(string Section, string Key, string DefaultValue = "")
{
try
{ {
StringBuilder temp = new StringBuilder(255); StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp, int i = GetPrivateProfileString(Section, Key, "", temp,
255, this.path); 255, this.path);
return temp.ToString(); return temp.ToString();
}
catch (Exception)
{
IniWriteValue(Section, Key, DefaultValue);
return IniReadValue(Section, Key);
}
} }
} }

View File

@ -12,6 +12,7 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Reflection;
using System.Threading; using System.Threading;
public class LauncherFuncs public class LauncherFuncs
@ -31,6 +32,58 @@ public class LauncherFuncs
{ {
} }
public static void ReadInfoFile(string infopath, bool cmd = false, bool versiononly = false)
{
string[] lines = File.ReadAllLines(infopath); //File is in System.IO
GlobalVars.IsSnapshot = Convert.ToBoolean(lines[5]);
if (GlobalVars.IsSnapshot == true)
{
if (cmd)
{
var versionInfo = FileVersionInfo.GetVersionInfo(GlobalVars.RootPathLauncher + "\\Novetus.exe");
GlobalVars.Version = lines[6].Replace("%version%", lines[0])
.Replace("%build%", versionInfo.ProductBuildPart.ToString())
.Replace("%revision%", versionInfo.FilePrivatePart.ToString())
.Replace("%snapshot-revision%", lines[7]);
}
else
{
GlobalVars.Version = lines[6].Replace("%version%", lines[0])
.Replace("%build%", Assembly.GetExecutingAssembly().GetName().Version.Build.ToString())
.Replace("%revision%", Assembly.GetExecutingAssembly().GetName().Version.Revision.ToString())
.Replace("%snapshot-revision%", lines[7]);
}
string changelog = GlobalVars.BasePath + "\\changelog.txt";
if (File.Exists(changelog))
{
string[] changelogedit = File.ReadAllLines(changelog);
if (!changelogedit[0].Equals(GlobalVars.Version))
{
changelogedit[0] = GlobalVars.Version;
File.WriteAllLines(changelog, changelogedit);
}
}
}
else
{
GlobalVars.Version = lines[0];
}
GlobalVars.Branch = lines[0];
if (!versiononly)
{
GlobalVars.DefaultClient = lines[1];
GlobalVars.DefaultMap = lines[2];
GlobalVars.RegisterClient1 = lines[3];
GlobalVars.RegisterClient2 = lines[4];
GlobalVars.SelectedClient = GlobalVars.DefaultClient;
GlobalVars.Map = GlobalVars.DefaultMap;
GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap;
GlobalVars.MapPathSnip = GlobalVars.MapsDirBase + @"\\" + GlobalVars.DefaultMap;
}
}
public static void Config(string cfgpath, bool write) public static void Config(string cfgpath, bool write)
{ {
if (write) if (write)
@ -58,11 +111,9 @@ public class LauncherFuncs
ini.IniWriteValue(section, "ReShade", GlobalVars.ReShade.ToString()); ini.IniWriteValue(section, "ReShade", GlobalVars.ReShade.ToString());
ini.IniWriteValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString()); ini.IniWriteValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString());
ini.IniWriteValue(section, "OldLayout", GlobalVars.OldLayout.ToString()); ini.IniWriteValue(section, "OldLayout", GlobalVars.OldLayout.ToString());
//ini.IniWriteValue(section, "UDP", GlobalVars.UDP.ToString());
} }
else else
{ {
//redo the way this handles reading invalid values.
//READ //READ
string Decryptline1, Decryptline2, Decryptline3, Decryptline4, string Decryptline1, Decryptline2, Decryptline3, Decryptline4,
Decryptline5, Decryptline6, Decryptline7, Decryptline9, Decryptline10, Decryptline5, Decryptline6, Decryptline7, Decryptline9, Decryptline10,
@ -73,160 +124,27 @@ public class LauncherFuncs
string section = "Config"; string section = "Config";
Decryptline1 = ini.IniReadValue(section, "CloseOnLaunch"); Decryptline1 = ini.IniReadValue(section, "CloseOnLaunch", GlobalVars.CloseOnLaunch.ToString());
Decryptline2 = ini.IniReadValue(section, "UserID", GlobalVars.UserID.ToString());
Decryptline3 = ini.IniReadValue(section, "PlayerName", GlobalVars.PlayerName.ToString());
Decryptline4 = ini.IniReadValue(section, "SelectedClient", GlobalVars.SelectedClient.ToString());
Decryptline5 = ini.IniReadValue(section, "Map", GlobalVars.Map.ToString());
Decryptline6 = ini.IniReadValue(section, "RobloxPort", GlobalVars.RobloxPort.ToString());
Decryptline7 = ini.IniReadValue(section, "PlayerLimit", GlobalVars.PlayerLimit.ToString());
Decryptline9 = ini.IniReadValue(section, "ShowHatsOnExtra", GlobalVars.Custom_Extra_ShowHats.ToString());
Decryptline10 = ini.IniReadValue(section, "UPnP", GlobalVars.UPnP.ToString());
Decryptline11 = ini.IniReadValue(section, "ItemMakerDisableHelpMessage", GlobalVars.DisabledHelp.ToString());
Decryptline12 = ini.IniReadValue(section, "PlayerTripcode", GenerateAndReturnTripcode());
Decryptline13 = ini.IniReadValue(section, "DiscordRichPresence", GlobalVars.DiscordPresence.ToString());
Decryptline14 = ini.IniReadValue(section, "MapPath", GlobalVars.MapPath.ToString());
Decryptline15 = ini.IniReadValue(section, "MapPathSnip", GlobalVars.MapPathSnip.ToString());
Decryptline16 = ini.IniReadValue(section, "GraphicsMode", GlobalVars.GraphicsMode.ToString());
Decryptline17 = ini.IniReadValue(section, "ReShade", GlobalVars.ReShade.ToString());
Decryptline20 = ini.IniReadValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString());
Decryptline21 = ini.IniReadValue(section, "OldLayout", GlobalVars.OldLayout.ToString());
if (string.IsNullOrWhiteSpace(Decryptline1)) try
{ {
ini.IniWriteValue(section, "CloseOnLaunch", GlobalVars.CloseOnLaunch.ToString());
Decryptline1 = ini.IniReadValue(section, "CloseOnLaunch");
}
Decryptline2 = ini.IniReadValue(section, "UserID");
if (string.IsNullOrWhiteSpace(Decryptline2))
{
ini.IniWriteValue(section, "UserID", GlobalVars.UserID.ToString());
Decryptline2 = ini.IniReadValue(section, "UserID");
}
Decryptline3 = ini.IniReadValue(section, "PlayerName");
if (string.IsNullOrWhiteSpace(Decryptline3))
{
ini.IniWriteValue(section, "PlayerName", GlobalVars.PlayerName.ToString());
Decryptline3 = ini.IniReadValue(section, "PlayerName");
}
Decryptline4 = ini.IniReadValue(section, "SelectedClient");
if (string.IsNullOrWhiteSpace(Decryptline4))
{
ini.IniWriteValue(section, "SelectedClient", GlobalVars.SelectedClient.ToString());
Decryptline4 = ini.IniReadValue(section, "SelectedClient");
}
Decryptline5 = ini.IniReadValue(section, "Map");
if (string.IsNullOrWhiteSpace(Decryptline5))
{
ini.IniWriteValue(section, "Map", GlobalVars.Map.ToString());
Decryptline5 = ini.IniReadValue(section, "Map");
}
Decryptline6 = ini.IniReadValue(section, "RobloxPort");
if (string.IsNullOrWhiteSpace(Decryptline6))
{
ini.IniWriteValue(section, "RobloxPort", GlobalVars.RobloxPort.ToString());
Decryptline6 = ini.IniReadValue(section, "RobloxPort");
}
Decryptline7 = ini.IniReadValue(section, "PlayerLimit");
if (string.IsNullOrWhiteSpace(Decryptline7))
{
ini.IniWriteValue(section, "PlayerLimit", GlobalVars.PlayerLimit.ToString());
Decryptline7 = ini.IniReadValue(section, "PlayerLimit");
}
Decryptline9 = ini.IniReadValue(section, "ShowHatsOnExtra");
if (string.IsNullOrWhiteSpace(Decryptline9))
{
ini.IniWriteValue(section, "ShowHatsOnExtra", GlobalVars.Custom_Extra_ShowHats.ToString());
Decryptline9 = ini.IniReadValue(section, "ShowHatsOnExtra");
}
Decryptline10 = ini.IniReadValue(section, "UPnP");
if (string.IsNullOrWhiteSpace(Decryptline10))
{
ini.IniWriteValue(section, "UPnP", GlobalVars.UPnP.ToString());
Decryptline10 = ini.IniReadValue(section, "UPnP");
}
Decryptline11 = ini.IniReadValue(section, "ItemMakerDisableHelpMessage");
if (string.IsNullOrWhiteSpace(Decryptline11))
{
ini.IniWriteValue(section, "ItemMakerDisableHelpMessage", GlobalVars.DisabledHelp.ToString());
Decryptline11 = ini.IniReadValue(section, "ItemMakerDisableHelpMessage");
}
Decryptline12 = ini.IniReadValue(section, "PlayerTripcode");
if (string.IsNullOrWhiteSpace(Decryptline12))
{
GenerateTripcode();
ini.IniWriteValue(section, "PlayerTripcode", SecurityFuncs.Base64Encode(GlobalVars.PlayerTripcode.ToString()));
Decryptline12 = ini.IniReadValue(section, "PlayerTripcode");
}
Decryptline13 = ini.IniReadValue(section, "DiscordRichPresence");
if (string.IsNullOrWhiteSpace(Decryptline13))
{
ini.IniWriteValue(section, "DiscordRichPresence", GlobalVars.DiscordPresence.ToString());
Decryptline13 = ini.IniReadValue(section, "DiscordRichPresence");
}
Decryptline14 = ini.IniReadValue(section, "MapPath");
if (string.IsNullOrWhiteSpace(Decryptline14))
{
ini.IniWriteValue(section, "MapPath", GlobalVars.MapPath.ToString());
Decryptline14 = ini.IniReadValue(section, "MapPath");
}
Decryptline15 = ini.IniReadValue(section, "MapPathSnip");
if (string.IsNullOrWhiteSpace(Decryptline15))
{
ini.IniWriteValue(section, "MapPathSnip", GlobalVars.MapPathSnip.ToString());
Decryptline15 = ini.IniReadValue(section, "MapPathSnip");
}
Decryptline16 = ini.IniReadValue(section, "GraphicsMode");
if (string.IsNullOrWhiteSpace(Decryptline16))
{
ini.IniWriteValue(section, "GraphicsMode", GlobalVars.GraphicsMode.ToString());
Decryptline16 = ini.IniReadValue(section, "GraphicsMode");
}
Decryptline17 = ini.IniReadValue(section, "ReShade");
if (string.IsNullOrWhiteSpace(Decryptline17))
{
ini.IniWriteValue(section, "ReShade", GlobalVars.ReShade.ToString());
Decryptline17 = ini.IniReadValue(section, "ReShade");
}
Decryptline20 = ini.IniReadValue(section, "QualityLevel");
if (string.IsNullOrWhiteSpace(Decryptline20))
{
ini.IniWriteValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString());
Decryptline20 = ini.IniReadValue(section, "QualityLevel");
}
Decryptline21 = ini.IniReadValue(section, "OldLayout");
if (string.IsNullOrWhiteSpace(Decryptline21))
{
ini.IniWriteValue(section, "OldLayout", GlobalVars.OldLayout.ToString());
Decryptline21 = ini.IniReadValue(section, "OldLayout");
}
/*
Decryptline22 = ini.IniReadValue(section, "UDP");
if (string.IsNullOrWhiteSpace(Decryptline21))
{
ini.IniWriteValue(section, "UDP", GlobalVars.UDP.ToString());
Decryptline21 = ini.IniReadValue(section, "UDP");
}*/
bool bline1 = Convert.ToBoolean(Decryptline1); bool bline1 = Convert.ToBoolean(Decryptline1);
GlobalVars.CloseOnLaunch = bline1; GlobalVars.CloseOnLaunch = bline1;
@ -289,8 +207,21 @@ public class LauncherFuncs
//bool bline22 = Convert.ToBoolean(Decryptline22); //bool bline22 = Convert.ToBoolean(Decryptline22);
//GlobalVars.UDP = bline22; //GlobalVars.UDP = bline22;
} }
catch (Exception)
{
Config(cfgpath, true);
}
}
if (!File.Exists(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization))
{
Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, true);
}
else
{
Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write); Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write);
}
ReShade(GlobalVars.ConfigDir, "ReShade.ini", write); ReShade(GlobalVars.ConfigDir, "ReShade.ini", write);
} }
@ -338,184 +269,49 @@ public class LauncherFuncs
{ {
//READ //READ
string Decryptline1, Decryptline2, Decryptline3, Decryptline4, Decryptline5, Decryptline6, Decryptline7, Decryptline8, Decryptline9, Decryptline10, Decryptline11, Decryptline12, Decryptline13, Decryptline14, Decryptline15, Decryptline16, Decryptline17, Decryptline18, Decryptline19, Decryptline20, Decryptline21, Decryptline22, Decryptline23, Decryptline24; string Decryptline1, Decryptline2, Decryptline3, Decryptline4,
Decryptline5, Decryptline6, Decryptline7, Decryptline8, Decryptline9,
Decryptline10, Decryptline11, Decryptline12, Decryptline13, Decryptline14,
Decryptline15, Decryptline16, Decryptline17, Decryptline18, Decryptline19,
Decryptline20, Decryptline21, Decryptline22, Decryptline23, Decryptline24;
IniFile ini = new IniFile(cfgpath); IniFile ini = new IniFile(cfgpath);
string section = "Items"; string section = "Items";
Decryptline1 = ini.IniReadValue(section, "Hat1"); Decryptline1 = ini.IniReadValue(section, "Hat1", GlobalVars.Custom_Hat1ID_Offline.ToString());
Decryptline2 = ini.IniReadValue(section, "Hat2", GlobalVars.Custom_Hat2ID_Offline.ToString());
if (string.IsNullOrWhiteSpace(Decryptline1)) Decryptline3 = ini.IniReadValue(section, "Hat3", GlobalVars.Custom_Hat3ID_Offline.ToString());
{ Decryptline16 = ini.IniReadValue(section, "Face", GlobalVars.Custom_Face_Offline.ToString());
ini.IniWriteValue(section, "Hat1", GlobalVars.Custom_Hat1ID_Offline.ToString()); Decryptline17 = ini.IniReadValue(section, "Head", GlobalVars.Custom_Head_Offline.ToString());
} Decryptline18 = ini.IniReadValue(section, "TShirt", GlobalVars.Custom_T_Shirt_Offline.ToString());
Decryptline19 = ini.IniReadValue(section, "Shirt", GlobalVars.Custom_Shirt_Offline.ToString());
Decryptline2 = ini.IniReadValue(section, "Hat2"); Decryptline20 = ini.IniReadValue(section, "Pants", GlobalVars.Custom_Pants_Offline.ToString());
Decryptline21 = ini.IniReadValue(section, "Icon", GlobalVars.Custom_Icon_Offline.ToString());
if (string.IsNullOrWhiteSpace(Decryptline2)) Decryptline23 = ini.IniReadValue(section, "Extra", GlobalVars.Custom_Extra.ToString());
{
ini.IniWriteValue(section, "Hat2", GlobalVars.Custom_Hat2ID_Offline.ToString());
}
Decryptline3 = ini.IniReadValue(section, "Hat3");
if (string.IsNullOrWhiteSpace(Decryptline3))
{
ini.IniWriteValue(section, "Hat3", GlobalVars.Custom_Hat3ID_Offline.ToString());
}
Decryptline16 = ini.IniReadValue(section, "Face");
if (string.IsNullOrWhiteSpace(Decryptline16))
{
ini.IniWriteValue(section, "Face", GlobalVars.Custom_Face_Offline.ToString());
}
Decryptline17 = ini.IniReadValue(section, "Head");
if (string.IsNullOrWhiteSpace(Decryptline17))
{
ini.IniWriteValue(section, "Head", GlobalVars.Custom_Head_Offline.ToString());
}
Decryptline18 = ini.IniReadValue(section, "TShirt");
if (string.IsNullOrWhiteSpace(Decryptline18))
{
ini.IniWriteValue(section, "TShirt", GlobalVars.Custom_T_Shirt_Offline.ToString());
}
Decryptline19 = ini.IniReadValue(section, "Shirt");
if (string.IsNullOrWhiteSpace(Decryptline19))
{
ini.IniWriteValue(section, "Shirt", GlobalVars.Custom_Shirt_Offline.ToString());
}
Decryptline20 = ini.IniReadValue(section, "Pants");
if (string.IsNullOrWhiteSpace(Decryptline20))
{
ini.IniWriteValue(section, "Pants", GlobalVars.Custom_Pants_Offline.ToString());
}
Decryptline21 = ini.IniReadValue(section, "Icon");
if (string.IsNullOrWhiteSpace(Decryptline21))
{
ini.IniWriteValue(section, "Icon", GlobalVars.Custom_Icon_Offline.ToString());
}
Decryptline23 = ini.IniReadValue(section, "Extra");
if (string.IsNullOrWhiteSpace(Decryptline23))
{
ini.IniWriteValue(section, "Extra", GlobalVars.Custom_Extra.ToString());
}
string section2 = "Colors"; string section2 = "Colors";
Decryptline4 = ini.IniReadValue(section2, "HeadColorID"); Decryptline4 = ini.IniReadValue(section2, "HeadColorID", GlobalVars.HeadColorID.ToString());
Decryptline10 = ini.IniReadValue(section2, "HeadColorString", GlobalVars.ColorMenu_HeadColor.ToString());
if (string.IsNullOrWhiteSpace(Decryptline4)) Decryptline5 = ini.IniReadValue(section2, "TorsoColorID", GlobalVars.TorsoColorID.ToString());
{ Decryptline11 = ini.IniReadValue(section2, "TorsoColorString", GlobalVars.ColorMenu_TorsoColor.ToString());
ini.IniWriteValue(section2, "HeadColorID", GlobalVars.HeadColorID.ToString()); Decryptline6 = ini.IniReadValue(section2, "LeftArmColorID", GlobalVars.LeftArmColorID.ToString());
} Decryptline12 = ini.IniReadValue(section2, "LeftArmColorString", GlobalVars.ColorMenu_LeftArmColor.ToString());
Decryptline7 = ini.IniReadValue(section2, "RightArmColorID", GlobalVars.RightArmColorID.ToString());
Decryptline10 = ini.IniReadValue(section2, "HeadColorString"); Decryptline13 = ini.IniReadValue(section2, "RightArmColorString", GlobalVars.ColorMenu_RightArmColor.ToString());
Decryptline8 = ini.IniReadValue(section2, "LeftLegColorID", GlobalVars.LeftLegColorID.ToString());
if (string.IsNullOrWhiteSpace(Decryptline10)) Decryptline14 = ini.IniReadValue(section2, "LeftLegColorString", GlobalVars.ColorMenu_LeftLegColor.ToString());
{ Decryptline9 = ini.IniReadValue(section2, "RightLegColorID", GlobalVars.RightLegColorID.ToString());
ini.IniWriteValue(section2, "HeadColorString", GlobalVars.ColorMenu_HeadColor.ToString()); Decryptline15 = ini.IniReadValue(section2, "RightLegColorString", GlobalVars.ColorMenu_RightLegColor.ToString());
}
Decryptline5 = ini.IniReadValue(section2, "TorsoColorID");
if (string.IsNullOrWhiteSpace(Decryptline5))
{
ini.IniWriteValue(section2, "TorsoColorID", GlobalVars.TorsoColorID.ToString());
}
Decryptline11 = ini.IniReadValue(section2, "TorsoColorString");
if (string.IsNullOrWhiteSpace(Decryptline11))
{
ini.IniWriteValue(section2, "TorsoColorString", GlobalVars.ColorMenu_TorsoColor.ToString());
}
Decryptline6 = ini.IniReadValue(section2, "LeftArmColorID");
if (string.IsNullOrWhiteSpace(Decryptline6))
{
ini.IniWriteValue(section2, "LeftArmColorID", GlobalVars.LeftArmColorID.ToString());
}
Decryptline12 = ini.IniReadValue(section2, "LeftArmColorString");
if (string.IsNullOrWhiteSpace(Decryptline12))
{
ini.IniWriteValue(section2, "LeftArmColorString", GlobalVars.ColorMenu_LeftArmColor.ToString());
}
Decryptline7 = ini.IniReadValue(section2, "RightArmColorID");
if (string.IsNullOrWhiteSpace(Decryptline7))
{
ini.IniWriteValue(section2, "RightArmColorID", GlobalVars.RightArmColorID.ToString());
}
Decryptline13 = ini.IniReadValue(section2, "RightArmColorString");
if (string.IsNullOrWhiteSpace(Decryptline13))
{
ini.IniWriteValue(section2, "RightArmColorString", GlobalVars.ColorMenu_RightArmColor.ToString());
}
Decryptline8 = ini.IniReadValue(section2, "LeftLegColorID");
if (string.IsNullOrWhiteSpace(Decryptline8))
{
ini.IniWriteValue(section2, "LeftLegColorID", GlobalVars.LeftLegColorID.ToString());
}
Decryptline14 = ini.IniReadValue(section2, "LeftLegColorString");
if (string.IsNullOrWhiteSpace(Decryptline14))
{
ini.IniWriteValue(section2, "LeftLegColorString", GlobalVars.ColorMenu_LeftLegColor.ToString());
}
Decryptline9 = ini.IniReadValue(section2, "RightLegColorID");
if (string.IsNullOrWhiteSpace(Decryptline9))
{
ini.IniWriteValue(section2, "RightLegColorID", GlobalVars.RightLegColorID.ToString());
}
Decryptline15 = ini.IniReadValue(section2, "RightLegColorString");
if (string.IsNullOrWhiteSpace(Decryptline15))
{
ini.IniWriteValue(section2, "RightLegColorString", GlobalVars.ColorMenu_RightLegColor.ToString());
}
string section3 = "Other"; string section3 = "Other";
Decryptline22 = ini.IniReadValue(section3, "CharacterID"); Decryptline22 = ini.IniReadValue(section3, "CharacterID", GlobalVars.CharacterID.ToString());
Decryptline24 = ini.IniReadValue(section3, "ExtraSelectionIsHat", GlobalVars.Custom_Extra_SelectionIsHat.ToString());
if (string.IsNullOrWhiteSpace(Decryptline22)) try
{ {
ini.IniWriteValue(section3, "CharacterID", GlobalVars.CharacterID.ToString());
}
Decryptline24 = ini.IniReadValue(section3, "ExtraSelectionIsHat");
if (string.IsNullOrWhiteSpace(Decryptline24))
{
ini.IniWriteValue(section3, "ExtraSelectionIsHat", GlobalVars.Custom_Extra_SelectionIsHat.ToString());
}
GlobalVars.Custom_Hat1ID_Offline = Decryptline1; GlobalVars.Custom_Hat1ID_Offline = Decryptline1;
GlobalVars.Custom_Hat2ID_Offline = Decryptline2; GlobalVars.Custom_Hat2ID_Offline = Decryptline2;
GlobalVars.Custom_Hat3ID_Offline = Decryptline3; GlobalVars.Custom_Hat3ID_Offline = Decryptline3;
@ -559,6 +355,11 @@ public class LauncherFuncs
bool bline24 = Convert.ToBoolean(Decryptline24); bool bline24 = Convert.ToBoolean(Decryptline24);
GlobalVars.Custom_Extra_SelectionIsHat = bline24; GlobalVars.Custom_Extra_SelectionIsHat = bline24;
} }
catch (Exception)
{
Customization(cfgpath, true);
}
}
ReloadLoadtextValue(); ReloadLoadtextValue();
} }
@ -587,22 +388,16 @@ public class LauncherFuncs
string section = "GENERAL"; string section = "GENERAL";
Decryptline2 = ini.IniReadValue(section, "ShowFPS");
Decryptline3 = ini.IniReadValue(section, "ShowFrameTime");
if (string.IsNullOrWhiteSpace(Decryptline2) || string.IsNullOrWhiteSpace(Decryptline3))
{
int FPS = GlobalVars.ReShadeFPSDisplay ? 1 : 0; int FPS = GlobalVars.ReShadeFPSDisplay ? 1 : 0;
ini.IniWriteValue(section, "ShowFPS", FPS.ToString()); Decryptline2 = ini.IniReadValue(section, "ShowFPS", FPS.ToString());
ini.IniWriteValue(section, "ShowFrameTime", FPS.ToString()); Decryptline3 = ini.IniReadValue(section, "ShowFrameTime", FPS.ToString());
}
Decryptline4 = ini.IniReadValue(section, "PerformanceMode");
if (string.IsNullOrWhiteSpace(Decryptline4))
{
int PerformanceMode = GlobalVars.ReShadePerformanceMode ? 1 : 0; int PerformanceMode = GlobalVars.ReShadePerformanceMode ? 1 : 0;
ini.IniWriteValue(section, "PerformanceMode", PerformanceMode.ToString()); Decryptline4 = ini.IniReadValue(section, "PerformanceMode", PerformanceMode.ToString());
}
if (setglobals) if (setglobals)
{
try
{ {
if (Convert.ToInt32(Decryptline2) == 1 && Convert.ToInt32(Decryptline3) == 1) if (Convert.ToInt32(Decryptline2) == 1 && Convert.ToInt32(Decryptline3) == 1)
{ {
@ -622,6 +417,11 @@ public class LauncherFuncs
GlobalVars.ReShadePerformanceMode = false; GlobalVars.ReShadePerformanceMode = false;
} }
} }
catch (Exception)
{
ReShadeValues(cfgpath, true, setglobals);
}
}
} }
} }
@ -862,6 +662,12 @@ public class LauncherFuncs
GlobalVars.PlayerTripcode = SecurityFuncs.RandomString(); GlobalVars.PlayerTripcode = SecurityFuncs.RandomString();
} }
public static string GenerateAndReturnTripcode()
{
GenerateTripcode();
return GlobalVars.PlayerTripcode;
}
public static Image LoadImage(string fileFullName) public static Image LoadImage(string fileFullName)
{ {
Stream fileStream = File.OpenRead(fileFullName); Stream fileStream = File.OpenRead(fileFullName);

View File

@ -10,7 +10,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)AddonLoader.cs" /> <Compile Include="$(MSBuildThisFileDirectory)AddonLoader.cs" />
<Compile Include="$(MSBuildThisFileDirectory)AssetCacheDef.cs" /> <Compile Include="$(MSBuildThisFileDirectory)NovetusSpecialClasses.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ClientScript.cs" /> <Compile Include="$(MSBuildThisFileDirectory)ClientScript.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CodeExtensions.cs" /> <Compile Include="$(MSBuildThisFileDirectory)CodeExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CryptoRandom.cs" /> <Compile Include="$(MSBuildThisFileDirectory)CryptoRandom.cs" />

View File

@ -0,0 +1,51 @@
public class AssetCacheDef
{
public AssetCacheDef(string clas, string[] id, string[] ext,
string[] dir, string[] gamedir)
{
Class = clas;
Id = id;
Ext = ext;
Dir = dir;
GameDir = gamedir;
}
public string Class { get; set; }
public string[] Id { get; set; }
public string[] Ext { get; set; }
public string[] Dir { get; set; }
public string[] GameDir { get; set; }
}
//maybe...
public class Client
{
public Client(bool playername, bool playerid, string description,
string warning, bool legacymode, string clientmd5, string scriptmd5,
bool fix2007, bool hassecurity, bool nographicsoptions, string commandlineargs)
{
UsesPlayerName = playername;
UsesID = playerid;
Description = description;
Warning = warning;
LegacyMode = legacymode;
ClientMD5 = clientmd5;
ScriptMD5 = scriptmd5;
Fix2007 = fix2007;
HasSecurity = hassecurity;
NoGraphicsOptions = nographicsoptions;
CommandLineArgs = commandlineargs;
}
public bool UsesPlayerName { get; set; }
public bool UsesID { get; set; }
public string Description { get; set; }
public string Warning { get; set; }
public bool LegacyMode { get; set; }
public string ClientMD5 { get; set; }
public string ScriptMD5 { get; set; }
public bool Fix2007 { get; set; }
public bool HasSecurity { get; set; }
public bool NoGraphicsOptions { get; set; }
public string CommandLineArgs { get; set; }
}

View File

@ -407,38 +407,6 @@ namespace NovetusLauncher
void MainFormLoad(object sender, EventArgs e) void MainFormLoad(object sender, EventArgs e)
{ {
string[] lines = File.ReadAllLines(GlobalVars.ConfigDir + "\\info.txt"); //File is in System.IO
GlobalVars.IsSnapshot = Convert.ToBoolean(lines[5]);
if (GlobalVars.IsSnapshot == true)
{
GlobalVars.Version = lines[6].Replace("%version%", lines[0])
.Replace("%build%", Assembly.GetExecutingAssembly().GetName().Version.Build.ToString())
.Replace("%revision%", Assembly.GetExecutingAssembly().GetName().Version.Revision.ToString())
.Replace("%snapshot-revision%", lines[7]);
string changelog = GlobalVars.BasePath + "\\changelog.txt";
if (File.Exists(changelog))
{
string[] changelogedit = File.ReadAllLines(changelog);
if (!changelogedit[0].Equals(GlobalVars.Version))
{
changelogedit[0] = GlobalVars.Version;
File.WriteAllLines(changelog, changelogedit);
}
}
}
else
{
GlobalVars.Version = lines[0];
}
GlobalVars.Branch = lines[0];
GlobalVars.DefaultClient = lines[1];
GlobalVars.DefaultMap = lines[2];
GlobalVars.RegisterClient1 = lines[3];
GlobalVars.RegisterClient2 = lines[4];
GlobalVars.SelectedClient = GlobalVars.DefaultClient;
GlobalVars.Map = GlobalVars.DefaultMap;
GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap;
GlobalVars.MapPathSnip = GlobalVars.MapsDirBase + @"\\" + GlobalVars.DefaultMap;
Text = "Novetus " + GlobalVars.Version; Text = "Novetus " + GlobalVars.Version;
ConsolePrint("Novetus version " + GlobalVars.Version + " loaded. Initializing config.", 4); ConsolePrint("Novetus version " + GlobalVars.Version + " loaded. Initializing config.", 4);
ConsolePrint("Novetus path: " + GlobalVars.BasePath, 4); ConsolePrint("Novetus path: " + GlobalVars.BasePath, 4);
@ -622,8 +590,10 @@ namespace NovetusLauncher
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2); ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2);
MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error);
GlobalVars.SelectedClient = GlobalVars.DefaultClient; GlobalVars.SelectedClient = GlobalVars.DefaultClient;
ReadClientValues(ClientName);
} }
else
{
LauncherFuncs.ReadClientValues(clientpath); LauncherFuncs.ReadClientValues(clientpath);
if (GlobalVars.UsesPlayerName == true) if (GlobalVars.UsesPlayerName == true)
@ -666,6 +636,7 @@ namespace NovetusLauncher
label26.Text = GlobalVars.SelectedClient; label26.Text = GlobalVars.SelectedClient;
ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3); ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3);
} }
}
void GeneratePlayerID() void GeneratePlayerID()
{ {

View File

@ -406,38 +406,6 @@ namespace NovetusLauncher
void MainFormLoad(object sender, EventArgs e) void MainFormLoad(object sender, EventArgs e)
{ {
string[] lines = File.ReadAllLines(GlobalVars.ConfigDir + "\\info.txt"); //File is in System.IO
GlobalVars.IsSnapshot = Convert.ToBoolean(lines[5]);
if (GlobalVars.IsSnapshot == true)
{
GlobalVars.Version = lines[6].Replace("%version%", lines[0])
.Replace("%build%", Assembly.GetExecutingAssembly().GetName().Version.Build.ToString())
.Replace("%revision%", Assembly.GetExecutingAssembly().GetName().Version.Revision.ToString())
.Replace("%snapshot-revision%", lines[7]);
string changelog = GlobalVars.BasePath + "\\changelog.txt";
if (File.Exists(changelog))
{
string[] changelogedit = File.ReadAllLines(changelog);
if (!changelogedit[0].Equals(GlobalVars.Version))
{
changelogedit[0] = GlobalVars.Version;
File.WriteAllLines(changelog, changelogedit);
}
}
}
else
{
GlobalVars.Version = lines[0];
}
GlobalVars.Branch = lines[0];
GlobalVars.DefaultClient = lines[1];
GlobalVars.DefaultMap = lines[2];
GlobalVars.RegisterClient1 = lines[3];
GlobalVars.RegisterClient2 = lines[4];
GlobalVars.SelectedClient = GlobalVars.DefaultClient;
GlobalVars.Map = GlobalVars.DefaultMap;
GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap;
GlobalVars.MapPathSnip = GlobalVars.MapsDirBase + @"\\" + GlobalVars.DefaultMap;
Text = "Novetus " + GlobalVars.Version; Text = "Novetus " + GlobalVars.Version;
ConsolePrint("Novetus version " + GlobalVars.Version + " loaded. Initializing config.", 4); ConsolePrint("Novetus version " + GlobalVars.Version + " loaded. Initializing config.", 4);
ConsolePrint("Novetus path: " + GlobalVars.BasePath, 4); ConsolePrint("Novetus path: " + GlobalVars.BasePath, 4);
@ -589,8 +557,10 @@ namespace NovetusLauncher
ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2); ConsolePrint("ERROR - No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", 2);
MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error);
GlobalVars.SelectedClient = GlobalVars.DefaultClient; GlobalVars.SelectedClient = GlobalVars.DefaultClient;
ReadClientValues(ClientName);
} }
else
{
LauncherFuncs.ReadClientValues(clientpath); LauncherFuncs.ReadClientValues(clientpath);
if (GlobalVars.UsesPlayerName == true) if (GlobalVars.UsesPlayerName == true)
@ -633,6 +603,7 @@ namespace NovetusLauncher
label26.Text = GlobalVars.SelectedClient; label26.Text = GlobalVars.SelectedClient;
ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3); ConsolePrint("Client '" + GlobalVars.SelectedClient + "' successfully loaded.", 3);
} }
}
void GeneratePlayerID() void GeneratePlayerID()
{ {

View File

@ -29,6 +29,7 @@ namespace NovetusLauncher
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
LauncherFuncs.ReadInfoFile(GlobalVars.ConfigDir + "\\" + GlobalVars.InfoName);
if (args.Length == 0) if (args.Length == 0)
{ {
//read from our config to determine which clients to load. //read from our config to determine which clients to load.

View File

@ -34,30 +34,6 @@ namespace NovetusLauncher
private void NovetusSDK_Load(object sender, EventArgs e) private void NovetusSDK_Load(object sender, EventArgs e)
{ {
string[] lines = File.ReadAllLines(GlobalVars.ConfigDir + "\\info.txt"); //File is in System.IO
GlobalVars.IsSnapshot = Convert.ToBoolean(lines[5]);
if (GlobalVars.IsSnapshot == true)
{
GlobalVars.Version = lines[6].Replace("%version%", lines[0])
.Replace("%build%", Assembly.GetExecutingAssembly().GetName().Version.Build.ToString())
.Replace("%revision%", Assembly.GetExecutingAssembly().GetName().Version.Revision.ToString())
.Replace("%snapshot-revision%", lines[7]);
string changelog = GlobalVars.BasePath + "\\changelog.txt";
if (File.Exists(changelog))
{
string[] changelogedit = File.ReadAllLines(changelog);
if (!changelogedit[0].Equals(GlobalVars.Version))
{
changelogedit[0] = GlobalVars.Version;
File.WriteAllLines(changelog, changelogedit);
}
}
}
else
{
GlobalVars.Version = lines[0];
}
GlobalVars.Branch = lines[0];
Text = "Novetus SDK " + GlobalVars.Version; Text = "Novetus SDK " + GlobalVars.Version;
label1.Text = GlobalVars.Version; label1.Text = GlobalVars.Version;
} }

View File

@ -60,36 +60,6 @@ namespace NovetusURI
void LoaderFormLoad(object sender, EventArgs e) void LoaderFormLoad(object sender, EventArgs e)
{ {
string[] lines = File.ReadAllLines(GlobalVars.ConfigDir + "\\info.txt");
GlobalVars.IsSnapshot = Convert.ToBoolean(lines[5]);
if (GlobalVars.IsSnapshot == true)
{
GlobalVars.Version = lines[6].Replace("%version%", lines[0])
.Replace("%build%", Assembly.GetExecutingAssembly().GetName().Version.Build.ToString())
.Replace("%revision%", Assembly.GetExecutingAssembly().GetName().Version.Revision.ToString())
.Replace("%snapshot-revision%", lines[7]);
string changelog = GlobalVars.BasePath + "\\changelog.txt";
if (File.Exists(changelog))
{
string[] changelogedit = File.ReadAllLines(changelog);
if (!changelogedit[0].Equals(GlobalVars.Version))
{
changelogedit[0] = GlobalVars.Version;
File.WriteAllLines(changelog, changelogedit);
}
}
}
else
{
GlobalVars.Version = lines[0];
}
GlobalVars.Branch = lines[0];
GlobalVars.DefaultClient = lines[1];
GlobalVars.DefaultMap = lines[2];
GlobalVars.RegisterClient1 = lines[3];
GlobalVars.RegisterClient2 = lines[4];
GlobalVars.SelectedClient = GlobalVars.DefaultClient;
GlobalVars.Map = GlobalVars.DefaultMap;
QuickConfigure main = new QuickConfigure(); QuickConfigure main = new QuickConfigure();
main.ShowDialog(); main.ShowDialog();
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0); System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0);
@ -245,9 +215,12 @@ namespace NovetusURI
{ {
MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus Launcher - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("No clientinfo.nov detected with the client you chose. The client either cannot be loaded, or it is not available.", "Novetus Launcher - Error while loading client", MessageBoxButtons.OK, MessageBoxIcon.Error);
GlobalVars.SelectedClient = GlobalVars.DefaultClient; GlobalVars.SelectedClient = GlobalVars.DefaultClient;
ReadClientValues(ClientName);
} }
else
{
LauncherFuncs.ReadClientValues(clientpath); LauncherFuncs.ReadClientValues(clientpath);
} }
} }
} }
}