diff --git a/Novetus/NovetusCore/GlobalFuncs.cs b/Novetus/NovetusCore/GlobalFuncs.cs index c47fdf9..5059db2 100644 --- a/Novetus/NovetusCore/GlobalFuncs.cs +++ b/Novetus/NovetusCore/GlobalFuncs.cs @@ -161,17 +161,11 @@ public class GlobalFuncs } GlobalVars.UserConfiguration.PlayerName = name; - GlobalVars.UserConfiguration.SelectedClient = selectedclient; - GlobalVars.UserConfiguration.Map = map; - GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port); - GlobalVars.UserConfiguration.PlayerLimit = Convert.ToInt32(limit); - GlobalVars.UserConfiguration.UPnP = Convert.ToBoolean(upnp); - GlobalVars.UserConfiguration.DisabledItemMakerHelp = Convert.ToBoolean(disablehelpmessage); if (string.IsNullOrWhiteSpace(SecurityFuncs.Base64Decode(tripcode))) @@ -185,10 +179,8 @@ public class GlobalFuncs } GlobalVars.UserConfiguration.DiscordPresence = Convert.ToBoolean(discord); - GlobalVars.UserConfiguration.MapPath = mappath; GlobalVars.UserConfiguration.MapPathSnip = mapsnip; - GlobalVars.UserConfiguration.GraphicsMode = Settings.GraphicsOptions.GetModeForInt(Convert.ToInt32(graphics)); GlobalVars.UserConfiguration.ReShade = Convert.ToBoolean(reshade); GlobalVars.UserConfiguration.QualityLevel = Settings.GraphicsOptions.GetLevelForInt(Convert.ToInt32(qualitylevel)); @@ -328,14 +320,9 @@ public class GlobalFuncs GlobalVars.UserCustomization.Icon = icon; GlobalVars.UserCustomization.CharacterID = characterid; - GlobalVars.UserCustomization.Extra = extra; - - bool bline24 = Convert.ToBoolean(extraishat); - GlobalVars.UserCustomization.ExtraSelectionIsHat = bline24; - - bool bline9 = Convert.ToBoolean(showhatsonextra); - GlobalVars.UserCustomization.ShowHatsInExtra = bline9; + GlobalVars.UserCustomization.ExtraSelectionIsHat = Convert.ToBoolean(extraishat); + GlobalVars.UserCustomization.ShowHatsInExtra = Convert.ToBoolean(showhatsonextra); } catch (Exception) { @@ -443,30 +430,16 @@ public class GlobalFuncs commandlineargs = SecurityFuncs.Base64Decode(result[10]); } - bool bline1 = Convert.ToBoolean(usesplayername); - GlobalVars.SelectedClientInfo.UsesPlayerName = bline1; - - bool bline2 = Convert.ToBoolean(usesid); - GlobalVars.SelectedClientInfo.UsesID = bline2; - + GlobalVars.SelectedClientInfo.UsesPlayerName = Convert.ToBoolean(usesplayername); + GlobalVars.SelectedClientInfo.UsesID = Convert.ToBoolean(usesid); GlobalVars.SelectedClientInfo.Warning = warning; - - bool bline4 = Convert.ToBoolean(legacymode); - GlobalVars.SelectedClientInfo.LegacyMode = bline4; - + GlobalVars.SelectedClientInfo.LegacyMode = Convert.ToBoolean(legacymode); GlobalVars.SelectedClientInfo.ClientMD5 = clientmd5; GlobalVars.SelectedClientInfo.ScriptMD5 = scriptmd5; GlobalVars.SelectedClientInfo.Description = desc; - - bool bline9 = Convert.ToBoolean(fix2007); - GlobalVars.SelectedClientInfo.Fix2007 = bline9; - - bool bline10 = Convert.ToBoolean(alreadyhassecurity); - GlobalVars.SelectedClientInfo.AlreadyHasSecurity = bline10; - - bool bline11 = Convert.ToBoolean(nographicsoptions); - GlobalVars.SelectedClientInfo.NoGraphicsOptions = bline11; - + GlobalVars.SelectedClientInfo.Fix2007 = Convert.ToBoolean(fix2007); + GlobalVars.SelectedClientInfo.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity); + GlobalVars.SelectedClientInfo.NoGraphicsOptions = Convert.ToBoolean(nographicsoptions); GlobalVars.SelectedClientInfo.CommandLineArgs = commandlineargs; } diff --git a/Novetus/NovetusLauncher/Classes/Launcher/LauncherFuncs.cs b/Novetus/NovetusLauncher/Classes/Launcher/LauncherFuncs.cs new file mode 100644 index 0000000..34d4621 --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/Launcher/LauncherFuncs.cs @@ -0,0 +1,39 @@ +#region Usings +using System.IO; +#endregion + +namespace NovetusLauncher +{ + #region Launcher Functions + class LauncherFuncs + { + public static void CreateAssetCacheDirectories() + { + if (!Directory.Exists(LocalPaths.AssetCacheDirFonts)) + { + Directory.CreateDirectory(LocalPaths.AssetCacheDirFonts); + } + + if (!Directory.Exists(LocalPaths.AssetCacheDirSky)) + { + Directory.CreateDirectory(LocalPaths.AssetCacheDirSky); + } + + if (!Directory.Exists(LocalPaths.AssetCacheDirSounds)) + { + Directory.CreateDirectory(LocalPaths.AssetCacheDirSounds); + } + + if (!Directory.Exists(LocalPaths.AssetCacheDirTexturesGUI)) + { + Directory.CreateDirectory(LocalPaths.AssetCacheDirTexturesGUI); + } + + if (!Directory.Exists(LocalPaths.AssetCacheDirScripts)) + { + Directory.CreateDirectory(LocalPaths.AssetCacheDirScripts); + } + } + } + #endregion +} diff --git a/Novetus/NovetusLauncher/Classes/SDK/SDKFuncs.cs b/Novetus/NovetusLauncher/Classes/SDK/SDKFuncs.cs new file mode 100644 index 0000000..0b1cf25 --- /dev/null +++ b/Novetus/NovetusLauncher/Classes/SDK/SDKFuncs.cs @@ -0,0 +1,679 @@ +#region Usings +using System; +using System.ComponentModel; +using System.IO; +using System.Text; +using System.Windows.Forms; +#endregion + +namespace NovetusLauncher +{ + #region SDK Functions + class SDKFuncs + { + #region Asset Localizer + public static OpenFileDialog LoadROBLOXFileDialog(RobloxFileType type) + { + OpenFileDialog openFileDialog1 = new OpenFileDialog + { + Filter = (type == RobloxFileType.RBXL) ? "ROBLOX Level (*.rbxl)|*.rbxl" : "ROBLOX Model (*.rbxm)|*.rbxm", + Title = "Open ROBLOX level or model" + }; + + return openFileDialog1; + } + + public static RobloxFileType SelectROBLOXFileType(int index) + { + RobloxFileType type; + + switch (index) + { + case 1: + type = RobloxFileType.RBXM; + break; + case 2: + type = RobloxFileType.Hat; + break; + case 3: + type = RobloxFileType.Head; + break; + case 4: + type = RobloxFileType.Face; + break; + case 5: + type = RobloxFileType.Shirt; + break; + case 6: + type = RobloxFileType.TShirt; + break; + case 7: + type = RobloxFileType.Pants; + break; + default: + type = RobloxFileType.RBXL; + break; + } + + return type; + } + + public static string GetProgressString(RobloxFileType type, int percent) + { + string progressString = ""; + + switch (type) + { + case RobloxFileType.RBXL: + switch (percent) + { + case 0: + progressString = "Backing up RBXL..."; + break; + case 5: + progressString = "Downloading RBXL Meshes and Textures..."; + break; + case 10: + progressString = "Downloading RBXL Skybox Textures..."; + break; + case 15: + progressString = "Downloading RBXL Decal Textures..."; + break; + case 20: + progressString = "Downloading RBXL Textures..."; + break; + case 25: + progressString = "Downloading RBXL Tool Textures..."; + break; + case 30: + progressString = "Downloading RBXL HopperBin Textures..."; + break; + case 40: + progressString = "Downloading RBXL Sounds..."; + break; + case 50: + progressString = "Downloading RBXL GUI Textures..."; + break; + case 60: + progressString = "Downloading RBXL Shirt Textures..."; + break; + case 65: + progressString = "Downloading RBXL T-Shirt Textures..."; + break; + case 70: + progressString = "Downloading RBXL Pants Textures..."; + break; + case 80: + progressString = "Downloading RBXL Linked Scripts..."; + break; + case 90: + progressString = "Downloading RBXL Linked LocalScripts..."; + break; + } + break; + case RobloxFileType.RBXM: + switch (percent) + { + case 0: + progressString = "Downloading RBXL Meshes and Textures..."; + break; + case 10: + progressString = "Downloading RBXL Skybox Textures..."; + break; + case 15: + progressString = "Downloading RBXL Decal Textures..."; + break; + case 20: + progressString = "Downloading RBXL Textures..."; + break; + case 25: + progressString = "Downloading RBXL Tool Textures..."; + break; + case 30: + progressString = "Downloading RBXL HopperBin Textures..."; + break; + case 40: + progressString = "Downloading RBXL Sounds..."; + break; + case 50: + progressString = "Downloading RBXL GUI Textures..."; + break; + case 60: + progressString = "Downloading RBXL Shirt Textures..."; + break; + case 65: + progressString = "Downloading RBXL T-Shirt Textures..."; + break; + case 70: + progressString = "Downloading RBXL Pants Textures..."; + break; + case 80: + progressString = "Downloading RBXL Linked Scripts..."; + break; + case 90: + progressString = "Downloading RBXL Linked LocalScripts..."; + break; + } + break; + case RobloxFileType.Hat: + switch (percent) + { + case 0: + progressString = "Downloading Hat Meshes and Textures..."; + break; + case 25: + progressString = "Downloading Hat Sounds..."; + break; + case 50: + progressString = "Downloading Hat Linked Scripts..."; + break; + case 75: + progressString = "Downloading Hat Linked LocalScripts..."; + break; + } + break; + case RobloxFileType.Head: + //meshes + switch (percent) + { + case 0: + progressString = "Downloading Head Meshes and Textures..."; + break; + } + break; + case RobloxFileType.Face: + //decal + switch (percent) + { + case 0: + progressString = "Downloading Face Textures..."; + break; + } + break; + case RobloxFileType.TShirt: + //texture + switch (percent) + { + case 0: + progressString = "Downloading T-Shirt Textures..."; + break; + } + break; + case RobloxFileType.Shirt: + //texture + switch (percent) + { + case 0: + progressString = "Downloading Shirt Textures..."; + break; + } + break; + case RobloxFileType.Pants: + //texture + switch (percent) + { + case 0: + progressString = "Downloading Pants Textures..."; + break; + } + break; + default: + progressString = "Idle"; + break; + } + + return progressString + " " + percent.ToString() + "%"; + } + + public static void LocalizeAsset(RobloxFileType type, BackgroundWorker worker, string path, string itemname, string meshname) + { + try + { + switch (type) + { + case RobloxFileType.RBXL: + //backup the original copy + if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) + { + try + { + worker.ReportProgress(0); + File.Copy(path, path.Replace(".rbxl", " BAK.rbxl")); + } + catch (Exception) + { + worker.ReportProgress(100); + } + } + else + { + worker.ReportProgress(0); + } + //meshes + worker.ReportProgress(5); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Fonts); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Fonts, 1, 1, 1, 1); + //skybox + worker.ReportProgress(10); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 1, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 2, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 3, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 4, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 5, 0, 0, 0); + //decal + worker.ReportProgress(15); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Decal); + //texture + worker.ReportProgress(20); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Texture); + //tools and hopperbin + worker.ReportProgress(25); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Tool); + worker.ReportProgress(30); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.HopperBin); + //sound + worker.ReportProgress(40); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sound); + worker.ReportProgress(50); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ImageLabel); + //clothing + worker.ReportProgress(60); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Shirt); + worker.ReportProgress(65); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ShirtGraphic); + worker.ReportProgress(70); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Pants); + //scripts + worker.ReportProgress(80); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Script); + worker.ReportProgress(90); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.LocalScript); + worker.ReportProgress(100); + break; + case RobloxFileType.RBXM: + if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) + { + try + { + worker.ReportProgress(0); + File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); + } + catch (Exception) + { + worker.ReportProgress(100); + } + } + else + { + worker.ReportProgress(0); + } + //meshes + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Fonts); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Fonts, 1, 1, 1, 1); + //skybox + worker.ReportProgress(10); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 1, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 2, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 3, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 4, 0, 0, 0); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 5, 0, 0, 0); + //decal + worker.ReportProgress(15); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Decal); + //texture + worker.ReportProgress(20); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Texture); + //tools and hopperbin + worker.ReportProgress(25); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Tool); + worker.ReportProgress(30); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.HopperBin); + //sound + worker.ReportProgress(40); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sound); + worker.ReportProgress(50); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ImageLabel); + //clothing + worker.ReportProgress(60); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Shirt); + worker.ReportProgress(65); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ShirtGraphic); + worker.ReportProgress(70); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Pants); + //scripts + worker.ReportProgress(80); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Script); + worker.ReportProgress(90); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.LocalScript); + worker.ReportProgress(100); + break; + case RobloxFileType.Hat: + if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) + { + try + { + worker.ReportProgress(0); + File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); + } + catch (Exception) + { + worker.ReportProgress(100); + } + } + else + { + worker.ReportProgress(0); + } + //meshes + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatFonts, itemname, meshname); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatFonts, 1, 1, 1, 1, itemname); + worker.ReportProgress(25); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatSound); + //scripts + worker.ReportProgress(50); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatScript); + worker.ReportProgress(75); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatLocalScript); + worker.ReportProgress(100); + break; + case RobloxFileType.Head: + if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) + { + try + { + worker.ReportProgress(0); + File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); + } + catch (Exception) + { + worker.ReportProgress(100); + } + } + else + { + worker.ReportProgress(0); + } + //meshes + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHeadFonts, itemname); + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHeadFonts, 1, 1, 1, 1, itemname); + worker.ReportProgress(100); + break; + case RobloxFileType.Face: + if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) + { + try + { + worker.ReportProgress(0); + File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); + } + catch (Exception) + { + worker.ReportProgress(100); + } + } + else + { + worker.ReportProgress(0); + } + //decal + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemFaceTexture, itemname); + worker.ReportProgress(100); + break; + case RobloxFileType.TShirt: + if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) + { + try + { + worker.ReportProgress(0); + File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); + } + catch (Exception) + { + worker.ReportProgress(100); + } + } + else + { + worker.ReportProgress(0); + } + //texture + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemTShirtTexture, itemname); + worker.ReportProgress(100); + break; + case RobloxFileType.Shirt: + if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) + { + try + { + worker.ReportProgress(0); + File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); + } + catch (Exception) + { + worker.ReportProgress(100); + } + } + else + { + worker.ReportProgress(0); + } + //texture + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemShirtTexture, itemname); + worker.ReportProgress(100); + break; + case RobloxFileType.Pants: + if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) + { + try + { + worker.ReportProgress(0); + File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); + } + catch (Exception) + { + worker.ReportProgress(100); + } + } + else + { + worker.ReportProgress(0); + } + //texture + RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemPantsTexture, itemname); + worker.ReportProgress(100); + break; + default: + worker.ReportProgress(100); + break; + } + } + catch (Exception ex) + { + MessageBox.Show("Error: Unable to localize the asset. " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Error); + } +} + #endregion + + #region Client SDK + public static string SaveClientinfoAndGetPath(FileFormat.ClientInfo info, bool islocked, bool textonly = false) + { + string path = ""; + + using (var sfd = new SaveFileDialog()) + { + sfd.Filter = textonly ? "Text file (*.txt)|*.txt" : "Novetus Clientinfo files (*.nov)|*.nov"; + sfd.FilterIndex = 1; + string filename = textonly ? "clientinfo.txt" : "clientinfo.nov"; + sfd.FileName = filename; + sfd.Title = "Save " + filename; + + if (sfd.ShowDialog() == DialogResult.OK) + { + string[] lines = { + textonly ? info.UsesPlayerName.ToString() : SecurityFuncs.Base64Encode(info.UsesPlayerName.ToString()), + textonly ? info.UsesID.ToString() : SecurityFuncs.Base64Encode(info.UsesID.ToString()), + textonly ? info.Warning.ToString() : SecurityFuncs.Base64Encode(info.Warning.ToString()), + textonly ? info.LegacyMode.ToString() : SecurityFuncs.Base64Encode(info.LegacyMode.ToString()), + textonly ? info.ClientMD5.ToString() : SecurityFuncs.Base64Encode(info.ClientMD5.ToString()), + textonly ? info.ScriptMD5.ToString() : SecurityFuncs.Base64Encode(info.ScriptMD5.ToString()), + textonly ? info.Description.ToString() : SecurityFuncs.Base64Encode(info.Description.ToString()), + textonly ? islocked.ToString() : SecurityFuncs.Base64Encode(islocked.ToString()), + textonly ? info.Fix2007.ToString() : SecurityFuncs.Base64Encode(info.Fix2007.ToString()), + textonly ? info.AlreadyHasSecurity.ToString() : SecurityFuncs.Base64Encode(info.AlreadyHasSecurity.ToString()), + textonly ? info.NoGraphicsOptions.ToString() : SecurityFuncs.Base64Encode(info.NoGraphicsOptions.ToString()), + textonly ? info.CommandLineArgs.ToString() : SecurityFuncs.Base64Encode(info.CommandLineArgs.ToString()) + }; + File.WriteAllText(sfd.FileName, SecurityFuncs.Base64Encode(string.Join("|", lines))); + path = Path.GetDirectoryName(sfd.FileName); + } + } + + return path; + } + + public static string LoadClientinfoAndGetPath(FileFormat.ClientInfo info, bool islocked, string veroutput, bool islockedoutput) + { + string path = ""; + bool IsVersion2 = false; + + using (var ofd = new OpenFileDialog()) + { + ofd.Filter = "Novetus Clientinfo files (*.nov)|*.nov"; + ofd.FilterIndex = 1; + ofd.FileName = "clientinfo.nov"; + ofd.Title = "Load clientinfo.nov"; + if (ofd.ShowDialog() == DialogResult.OK) + { + string file, usesplayername, usesid, warning, legacymode, clientmd5, + scriptmd5, desc, locked, fix2007, alreadyhassecurity, + cmdargsornogfxoptions, commandargsver2; + + using (StreamReader reader = new StreamReader(ofd.FileName)) + { + file = reader.ReadLine(); + } + + string ConvertedLine = ""; + + try + { + IsVersion2 = true; + veroutput = "v2"; + ConvertedLine = SecurityFuncs.Base64DecodeNew(file); + } + catch (Exception) + { + veroutput = "v1"; + ConvertedLine = SecurityFuncs.Base64DecodeOld(file); + } + + string[] result = ConvertedLine.Split('|'); + usesplayername = SecurityFuncs.Base64Decode(result[0]); + usesid = SecurityFuncs.Base64Decode(result[1]); + warning = SecurityFuncs.Base64Decode(result[2]); + legacymode = SecurityFuncs.Base64Decode(result[3]); + clientmd5 = SecurityFuncs.Base64Decode(result[4]); + scriptmd5 = SecurityFuncs.Base64Decode(result[5]); + desc = SecurityFuncs.Base64Decode(result[6]); + locked = SecurityFuncs.Base64Decode(result[7]); + fix2007 = SecurityFuncs.Base64Decode(result[8]); + alreadyhassecurity = SecurityFuncs.Base64Decode(result[9]); + cmdargsornogfxoptions = SecurityFuncs.Base64Decode(result[10]); + commandargsver2 = ""; + try + { + if (IsVersion2) + { + commandargsver2 = SecurityFuncs.Base64Decode(result[11]); + } + } + catch (Exception) + { + veroutput = "v2 (DEV)"; + IsVersion2 = false; + } + + if (!GlobalVars.AdminMode) + { + bool lockcheck = Convert.ToBoolean(locked); + if (lockcheck) + { + MessageBox.Show("This client is locked and therefore it cannot be loaded.", "Novetus Launcher - Error when loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); + return ""; + } + else + { + islocked = lockcheck; + islockedoutput = islocked; + } + } + else + { + islocked = Convert.ToBoolean(locked); + islockedoutput = islocked; + } + + info.UsesPlayerName = Convert.ToBoolean(usesplayername); + info.UsesID = Convert.ToBoolean(usesid); + info.Warning = warning; + info.LegacyMode = Convert.ToBoolean(legacymode); + info.ClientMD5 = clientmd5; + info.ScriptMD5 = scriptmd5; + info.Description = desc; + info.Fix2007 = Convert.ToBoolean(fix2007); + info.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity); + + if (IsVersion2) + { + info.NoGraphicsOptions = Convert.ToBoolean(cmdargsornogfxoptions); + info.CommandLineArgs = commandargsver2; + } + else + { + //Again, fake it. + info.NoGraphicsOptions = false; + info.CommandLineArgs = cmdargsornogfxoptions; + } + } + } + + return path; + } + + public static void NewClientinfo(FileFormat.ClientInfo info, bool islocked) + { + info.UsesPlayerName = false; + info.UsesID = false; + info.Warning = ""; + info.LegacyMode = false; + info.Fix2007 = false; + info.AlreadyHasSecurity = false; + info.Description = ""; + info.ClientMD5 = ""; + info.ScriptMD5 = ""; + info.CommandLineArgs = ""; + islocked = false; + } + #endregion + + #region Diogenes Editor + // credit to Carrot for this :D + + public static string DiogenesCrypt(string word) + { + StringBuilder result = new StringBuilder(""); + byte[] bytes = Encoding.ASCII.GetBytes(word); + + foreach (byte singular in bytes) + { + result.Append(Convert.ToChar(0x55 ^ singular)); + } + + return result.ToString(); + } + #endregion + } + #endregion +} diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs index a62e924..2cafa0f 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs @@ -406,6 +406,7 @@ namespace NovetusLauncher Text = "Novetus " + GlobalVars.ProgramInformation.Version; ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4); ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4); + if (File.Exists(GlobalPaths.RootPath + "\\changelog.txt")) { richTextBox2.Text = File.ReadAllText(GlobalPaths.RootPath + "\\changelog.txt"); @@ -445,30 +446,7 @@ namespace NovetusLauncher File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); } - if (!Directory.Exists(LocalPaths.AssetCacheDirFonts)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirFonts); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirSky)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirSky); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirSounds)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirSounds); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirTexturesGUI)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirTexturesGUI); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirScripts)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirScripts); - } + LauncherFuncs.CreateAssetCacheDirectories(); label8.Text = Application.ProductVersion; LocalVars.important = SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location); diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs index 18166b1..8e4117d 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs @@ -408,6 +408,7 @@ namespace NovetusLauncher Text = "Novetus " + GlobalVars.ProgramInformation.Version; ConsolePrint("Novetus version " + GlobalVars.ProgramInformation.Version + " loaded. Initializing config.", 4); ConsolePrint("Novetus path: " + GlobalPaths.BasePath, 4); + if (File.Exists(GlobalPaths.RootPath + "\\changelog.txt")) { richTextBox2.Text = File.ReadAllText(GlobalPaths.RootPath + "\\changelog.txt"); @@ -447,30 +448,7 @@ namespace NovetusLauncher File.Create(GlobalPaths.ConfigDir + "\\ports.txt").Dispose(); } - if (!Directory.Exists(LocalPaths.AssetCacheDirFonts)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirFonts); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirSky)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirSky); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirSounds)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirSounds); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirTexturesGUI)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirTexturesGUI); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirScripts)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirScripts); - } + LauncherFuncs.CreateAssetCacheDirectories(); label8.Text = Application.ProductVersion; LocalVars.important = SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location); diff --git a/Novetus/NovetusLauncher/Forms/SDK/AssetLocalizer.cs b/Novetus/NovetusLauncher/Forms/SDK/AssetLocalizer.cs index 7d29fa6..3ad516c 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/AssetLocalizer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/AssetLocalizer.cs @@ -1,67 +1,44 @@ -using System; +#region Usings +using System; using System.ComponentModel; using System.IO; using System.Windows.Forms; +#endregion namespace NovetusLauncher { + #region Asset Localizer public partial class AssetLocalizer : Form { + #region Private Variables private RobloxFileType currentType; private string path; private string name; private string meshname; + #endregion + #region Constructor public AssetLocalizer() { InitializeComponent(); } + #endregion + #region Form Events private void button1_Click(object sender, EventArgs e) { - OpenFileDialog openFileDialog1 = new OpenFileDialog - { - Filter = (currentType == RobloxFileType.RBXL) ? "ROBLOX Level (*.rbxl)|*.rbxl" : "ROBLOX Model (*.rbxm)|*.rbxm", - Title = "Open ROBLOX level or model" - }; + OpenFileDialog robloxFileDialog = SDKFuncs.LoadROBLOXFileDialog(currentType); - if (openFileDialog1.ShowDialog() == DialogResult.OK) + if (robloxFileDialog.ShowDialog() == DialogResult.OK) { - path = openFileDialog1.FileName; - + path = robloxFileDialog.FileName; backgroundWorker1.RunWorkerAsync(); } } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { - switch (comboBox1.SelectedIndex) - { - case 1: - currentType = RobloxFileType.RBXM; - break; - case 2: - currentType = RobloxFileType.Hat; - break; - case 3: - currentType = RobloxFileType.Head; - break; - case 4: - currentType = RobloxFileType.Face; - break; - case 5: - currentType = RobloxFileType.Shirt; - break; - case 6: - currentType = RobloxFileType.TShirt; - break; - case 7: - currentType = RobloxFileType.Pants; - break; - default: - currentType = RobloxFileType.RBXL; - break; - } + currentType = SDKFuncs.SelectROBLOXFileType(comboBox1.SelectedIndex); } private void AssetLocalizer_Load(object sender, EventArgs e) @@ -85,476 +62,20 @@ namespace NovetusLauncher } } - if (!Directory.Exists(LocalPaths.AssetCacheDirFonts)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirFonts); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirSky)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirSky); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirSounds)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirSounds); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirTexturesGUI)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirTexturesGUI); - } - - if (!Directory.Exists(LocalPaths.AssetCacheDirScripts)) - { - Directory.CreateDirectory(LocalPaths.AssetCacheDirScripts); - } - } - - private string GetProgressString(int percent) - { - string progressString = ""; - - switch (currentType) - { - case RobloxFileType.RBXL: - switch (percent) - { - case 0: - progressString = "Backing up RBXL..."; - break; - case 5: - progressString = "Downloading RBXL Meshes and Textures..."; - break; - case 10: - progressString = "Downloading RBXL Skybox Textures..."; - break; - case 15: - progressString = "Downloading RBXL Decal Textures..."; - break; - case 20: - progressString = "Downloading RBXL Textures..."; - break; - case 25: - progressString = "Downloading RBXL Tool Textures..."; - break; - case 30: - progressString = "Downloading RBXL HopperBin Textures..."; - break; - case 40: - progressString = "Downloading RBXL Sounds..."; - break; - case 50: - progressString = "Downloading RBXL GUI Textures..."; - break; - case 60: - progressString = "Downloading RBXL Shirt Textures..."; - break; - case 65: - progressString = "Downloading RBXL T-Shirt Textures..."; - break; - case 70: - progressString = "Downloading RBXL Pants Textures..."; - break; - case 80: - progressString = "Downloading RBXL Linked Scripts..."; - break; - case 90: - progressString = "Downloading RBXL Linked LocalScripts..."; - break; - } - break; - case RobloxFileType.RBXM: - switch (percent) - { - case 0: - progressString = "Downloading RBXL Meshes and Textures..."; - break; - case 10: - progressString = "Downloading RBXL Skybox Textures..."; - break; - case 15: - progressString = "Downloading RBXL Decal Textures..."; - break; - case 20: - progressString = "Downloading RBXL Textures..."; - break; - case 25: - progressString = "Downloading RBXL Tool Textures..."; - break; - case 30: - progressString = "Downloading RBXL HopperBin Textures..."; - break; - case 40: - progressString = "Downloading RBXL Sounds..."; - break; - case 50: - progressString = "Downloading RBXL GUI Textures..."; - break; - case 60: - progressString = "Downloading RBXL Shirt Textures..."; - break; - case 65: - progressString = "Downloading RBXL T-Shirt Textures..."; - break; - case 70: - progressString = "Downloading RBXL Pants Textures..."; - break; - case 80: - progressString = "Downloading RBXL Linked Scripts..."; - break; - case 90: - progressString = "Downloading RBXL Linked LocalScripts..."; - break; - } - break; - case RobloxFileType.Hat: - switch (percent) - { - case 0: - progressString = "Downloading Hat Meshes and Textures..."; - break; - case 25: - progressString = "Downloading Hat Sounds..."; - break; - case 50: - progressString = "Downloading Hat Linked Scripts..."; - break; - case 75: - progressString = "Downloading Hat Linked LocalScripts..."; - break; - } - break; - case RobloxFileType.Head: - //meshes - switch (percent) - { - case 0: - progressString = "Downloading Head Meshes and Textures..."; - break; - } - break; - case RobloxFileType.Face: - //decal - switch (percent) - { - case 0: - progressString = "Downloading Face Textures..."; - break; - } - break; - case RobloxFileType.TShirt: - //texture - switch (percent) - { - case 0: - progressString = "Downloading T-Shirt Textures..."; - break; - } - break; - case RobloxFileType.Shirt: - //texture - switch (percent) - { - case 0: - progressString = "Downloading Shirt Textures..."; - break; - } - break; - case RobloxFileType.Pants: - //texture - switch (percent) - { - case 0: - progressString = "Downloading Pants Textures..."; - break; - } - break; - default: - progressString = "Idle"; - break; - } - - return progressString + " " + percent.ToString() + "%"; + LauncherFuncs.CreateAssetCacheDirectories(); } // This event handler is where the time-consuming work is done. private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; - - try - { - switch (currentType) - { - case RobloxFileType.RBXL: - //backup the original copy - if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) - { - try - { - worker.ReportProgress(0); - File.Copy(path, path.Replace(".rbxl", " BAK.rbxl")); - } - catch (Exception) - { - worker.ReportProgress(100); - } - } - else - { - worker.ReportProgress(0); - } - //meshes - worker.ReportProgress(5); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Fonts); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Fonts, 1, 1, 1, 1); - //skybox - worker.ReportProgress(10); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 1, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 2, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 3, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 4, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 5, 0, 0, 0); - //decal - worker.ReportProgress(15); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Decal); - //texture - worker.ReportProgress(20); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Texture); - //tools and hopperbin - worker.ReportProgress(25); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Tool); - worker.ReportProgress(30); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.HopperBin); - //sound - worker.ReportProgress(40); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sound); - worker.ReportProgress(50); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ImageLabel); - //clothing - worker.ReportProgress(60); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Shirt); - worker.ReportProgress(65); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ShirtGraphic); - worker.ReportProgress(70); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Pants); - //scripts - worker.ReportProgress(80); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Script); - worker.ReportProgress(90); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.LocalScript); - worker.ReportProgress(100); - break; - case RobloxFileType.RBXM: - if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) - { - try - { - worker.ReportProgress(0); - File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); - } - catch (Exception) - { - worker.ReportProgress(100); - } - } - else - { - worker.ReportProgress(0); - } - //meshes - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Fonts); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Fonts, 1, 1, 1, 1); - //skybox - worker.ReportProgress(10); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 1, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 2, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 3, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 4, 0, 0, 0); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sky, 5, 0, 0, 0); - //decal - worker.ReportProgress(15); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Decal); - //texture - worker.ReportProgress(20); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Texture); - //tools and hopperbin - worker.ReportProgress(25); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Tool); - worker.ReportProgress(30); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.HopperBin); - //sound - worker.ReportProgress(40); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Sound); - worker.ReportProgress(50); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ImageLabel); - //clothing - worker.ReportProgress(60); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Shirt); - worker.ReportProgress(65); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ShirtGraphic); - worker.ReportProgress(70); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Pants); - //scripts - worker.ReportProgress(80); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.Script); - worker.ReportProgress(90); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.LocalScript); - worker.ReportProgress(100); - break; - case RobloxFileType.Hat: - if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) - { - try - { - worker.ReportProgress(0); - File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); - } - catch (Exception) - { - worker.ReportProgress(100); - } - } - else - { - worker.ReportProgress(0); - } - //meshes - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatFonts, name, meshname); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatFonts, 1, 1, 1, 1, name); - worker.ReportProgress(25); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatSound); - //scripts - worker.ReportProgress(50); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatScript); - worker.ReportProgress(75); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHatLocalScript); - worker.ReportProgress(100); - break; - case RobloxFileType.Head: - if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) - { - try - { - worker.ReportProgress(0); - File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); - } - catch (Exception) - { - worker.ReportProgress(100); - } - } - else - { - worker.ReportProgress(0); - } - //meshes - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHeadFonts, name); - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemHeadFonts, 1, 1, 1, 1, name); - worker.ReportProgress(100); - break; - case RobloxFileType.Face: - if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) - { - try - { - worker.ReportProgress(0); - File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); - } - catch (Exception) - { - worker.ReportProgress(100); - } - } - else - { - worker.ReportProgress(0); - } - //decal - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemFaceTexture, name); - worker.ReportProgress(100); - break; - case RobloxFileType.TShirt: - if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) - { - try - { - worker.ReportProgress(0); - File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); - } - catch (Exception) - { - worker.ReportProgress(100); - } - } - else - { - worker.ReportProgress(0); - } - //texture - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemTShirtTexture, name); - worker.ReportProgress(100); - break; - case RobloxFileType.Shirt: - if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) - { - try - { - worker.ReportProgress(0); - File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); - } - catch (Exception) - { - worker.ReportProgress(100); - } - } - else - { - worker.ReportProgress(0); - } - //texture - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemShirtTexture, name); - worker.ReportProgress(100); - break; - case RobloxFileType.Pants: - if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) - { - try - { - worker.ReportProgress(0); - File.Copy(path, path.Replace(".rbxm", " BAK.rbxm")); - } - catch (Exception) - { - worker.ReportProgress(100); - } - } - else - { - worker.ReportProgress(0); - } - //texture - RobloxXMLLocalizer.DownloadFromNodes(path, RobloxDefs.ItemPantsTexture, name); - worker.ReportProgress(100); - break; - default: - worker.ReportProgress(100); - break; - } - } - catch (Exception ex) - { - MessageBox.Show("Error: Unable to localize the asset. " + ex.Message, "Novetus Asset Localizer", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + SDKFuncs.LocalizeAsset(currentType, worker, path, name, meshname); } // This event handler updates the progress. private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { - label2.Text = GetProgressString(e.ProgressPercentage); + label2.Text = SDKFuncs.GetProgressString(currentType, e.ProgressPercentage); progressBar1.Value = e.ProgressPercentage; } @@ -601,5 +122,7 @@ namespace NovetusLauncher { GlobalVars.UserConfiguration.AssetLocalizerSaveBackups = checkBox1.Checked; } + #endregion } + #endregion } diff --git a/Novetus/NovetusLauncher/Forms/SDK/ClientScriptDocumentation.cs b/Novetus/NovetusLauncher/Forms/SDK/ClientScriptDocumentation.cs index aea91e9..19536d1 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ClientScriptDocumentation.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ClientScriptDocumentation.cs @@ -1,37 +1,27 @@ -/* - * Created by SharpDevelop. - * User: BITL - * Date: 12/19/2018 - * Time: 8:15 PM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ +#region Usings using System; using System.Windows.Forms; using System.IO; +#endregion namespace NovetusLauncher { - /// - /// Description of ClientScriptDocumentation. - /// + #region ClientScriptDocumentation public partial class ClientScriptDocumentation : Form { - public ClientScriptDocumentation() + #region Constructor + public ClientScriptDocumentation() { - // - // The InitializeComponent() call is required for Windows Forms designer support. - // InitializeComponent(); - - // - // TODO: Add constructor code after the InitializeComponent() call. - // } - - void ClientScriptDocumentationLoad(object sender, EventArgs e) + #endregion + + #region Form Events + void ClientScriptDocumentationLoad(object sender, EventArgs e) { richTextBox1.Text = File.ReadAllText(GlobalPaths.BasePath + "\\documentation.txt"); } - } + #endregion + } + #endregion } diff --git a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs index e9f4e32..bad0a41 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs @@ -1,53 +1,42 @@ -/* - * Created by SharpDevelop. - * User: BITL-Gaming - * Date: 11/28/2016 - * Time: 7:55 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ +#region Usings using System; using System.Windows.Forms; using System.IO; using System.Globalization; +#endregion namespace NovetusLauncher { - /// - /// Description of ClientinfoCreator. - /// - public partial class ClientinfoEditor : Form + #region Client SDK + public partial class ClientinfoEditor : Form { - private FileFormat.ClientInfo loadedClientInfo = new FileFormat.ClientInfo(); + #region Private Variables + private FileFormat.ClientInfo SelectedClientInfo = new FileFormat.ClientInfo(); private string SelectedClientInfoPath = ""; private bool Locked = false; - private bool IsVersion2 = false; - - public ClientinfoEditor() + #endregion + + #region Constructor + public ClientinfoEditor() { - // - // The InitializeComponent() call is required for Windows Forms designer support. - // InitializeComponent(); - - // - // TODO: Add constructor code after the InitializeComponent() call. - // } - - void CheckBox1CheckedChanged(object sender, EventArgs e) + #endregion + + #region Form Events + void CheckBox1CheckedChanged(object sender, EventArgs e) { - loadedClientInfo.UsesPlayerName = checkBox1.Checked; + SelectedClientInfo.UsesPlayerName = checkBox1.Checked; } void CheckBox2CheckedChanged(object sender, EventArgs e) { - loadedClientInfo.UsesID = checkBox2.Checked; + SelectedClientInfo.UsesID = checkBox2.Checked; } void TextBox1TextChanged(object sender, EventArgs e) { - loadedClientInfo.Description = textBox1.Text; + SelectedClientInfo.Description = textBox1.Text; } void ClientinfoCreatorLoad(object sender, EventArgs e) @@ -57,19 +46,19 @@ namespace NovetusLauncher void CheckBox3CheckedChanged(object sender, EventArgs e) { - loadedClientInfo.LegacyMode = checkBox3.Checked; + SelectedClientInfo.LegacyMode = checkBox3.Checked; } void TextBox2TextChanged(object sender, EventArgs e) { textBox2.Text = textBox2.Text.ToUpper(CultureInfo.InvariantCulture); - loadedClientInfo.ClientMD5 = textBox2.Text.ToUpper(CultureInfo.InvariantCulture); + SelectedClientInfo.ClientMD5 = textBox2.Text.ToUpper(CultureInfo.InvariantCulture); } void TextBox3TextChanged(object sender, EventArgs e) { textBox3.Text = textBox3.Text.ToUpper(CultureInfo.InvariantCulture); - loadedClientInfo.ScriptMD5 = textBox3.Text.ToUpper(CultureInfo.InvariantCulture); + SelectedClientInfo.ScriptMD5 = textBox3.Text.ToUpper(CultureInfo.InvariantCulture); } void Button4Click(object sender, EventArgs e) @@ -85,7 +74,7 @@ namespace NovetusLauncher string ClientName = ""; - if (!loadedClientInfo.LegacyMode) + if (!SelectedClientInfo.LegacyMode) { ClientName = "\\RobloxApp_Client.exe"; } @@ -100,7 +89,7 @@ namespace NovetusLauncher { textBox2.Text = ClientMD5.ToUpper(CultureInfo.InvariantCulture); textBox2.BackColor = System.Drawing.Color.Lime; - loadedClientInfo.ClientMD5 = textBox2.Text.ToUpper(CultureInfo.InvariantCulture); + SelectedClientInfo.ClientMD5 = textBox2.Text.ToUpper(CultureInfo.InvariantCulture); } else { @@ -113,7 +102,7 @@ namespace NovetusLauncher { textBox3.Text = ClientScriptMD5.ToUpper(CultureInfo.InvariantCulture); textBox3.BackColor = System.Drawing.Color.Lime; - loadedClientInfo.ScriptMD5 = textBox3.Text.ToUpper(CultureInfo.InvariantCulture); + SelectedClientInfo.ScriptMD5 = textBox3.Text.ToUpper(CultureInfo.InvariantCulture); } else { @@ -130,226 +119,92 @@ namespace NovetusLauncher void CheckBox6CheckedChanged(object sender, EventArgs e) { - loadedClientInfo.Fix2007 = checkBox6.Checked; + SelectedClientInfo.Fix2007 = checkBox6.Checked; } void CheckBox7CheckedChanged(object sender, EventArgs e) { - loadedClientInfo.AlreadyHasSecurity = checkBox7.Checked; + SelectedClientInfo.AlreadyHasSecurity = checkBox7.Checked; } void checkBox5_CheckedChanged(object sender, EventArgs e) { - loadedClientInfo.NoGraphicsOptions = checkBox5.Checked; + SelectedClientInfo.NoGraphicsOptions = checkBox5.Checked; } void NewToolStripMenuItemClick(object sender, EventArgs e) { label9.Text = "Not Loaded"; - loadedClientInfo.UsesPlayerName = false; - loadedClientInfo.UsesID = false; - loadedClientInfo.Warning = ""; - loadedClientInfo.LegacyMode = false; - loadedClientInfo.Fix2007 = false; - loadedClientInfo.AlreadyHasSecurity = false; - loadedClientInfo.Description = ""; - loadedClientInfo.ClientMD5 = ""; - loadedClientInfo.ScriptMD5 = ""; + SDKFuncs.NewClientinfo(SelectedClientInfo, Locked); SelectedClientInfoPath = ""; - loadedClientInfo.CommandLineArgs = ""; - Locked = false; - checkBox1.Checked = loadedClientInfo.UsesPlayerName; - checkBox2.Checked = loadedClientInfo.UsesID; - checkBox3.Checked = loadedClientInfo.LegacyMode; + checkBox1.Checked = SelectedClientInfo.UsesPlayerName; + checkBox2.Checked = SelectedClientInfo.UsesID; + checkBox3.Checked = SelectedClientInfo.LegacyMode; checkBox4.Checked = Locked; - checkBox6.Checked = loadedClientInfo.Fix2007; - checkBox7.Checked = loadedClientInfo.AlreadyHasSecurity; - checkBox5.Checked = loadedClientInfo.NoGraphicsOptions; - textBox3.Text = loadedClientInfo.ScriptMD5.ToUpper(CultureInfo.InvariantCulture); - textBox2.Text = loadedClientInfo.ClientMD5.ToUpper(CultureInfo.InvariantCulture); - textBox1.Text = loadedClientInfo.Description; - textBox4.Text = loadedClientInfo.CommandLineArgs; - textBox5.Text = loadedClientInfo.Warning; + checkBox6.Checked = SelectedClientInfo.Fix2007; + checkBox7.Checked = SelectedClientInfo.AlreadyHasSecurity; + checkBox5.Checked = SelectedClientInfo.NoGraphicsOptions; + textBox3.Text = SelectedClientInfo.ScriptMD5.ToUpper(CultureInfo.InvariantCulture); + textBox2.Text = SelectedClientInfo.ClientMD5.ToUpper(CultureInfo.InvariantCulture); + textBox1.Text = SelectedClientInfo.Description; + textBox4.Text = SelectedClientInfo.CommandLineArgs; + textBox5.Text = SelectedClientInfo.Warning; textBox2.BackColor = System.Drawing.SystemColors.Control; textBox3.BackColor = System.Drawing.SystemColors.Control; } void LoadToolStripMenuItemClick(object sender, EventArgs e) { - using (var ofd = new OpenFileDialog()) - { - ofd.Filter = "Novetus Clientinfo files (*.nov)|*.nov"; - ofd.FilterIndex = 1; - ofd.FileName = "clientinfo.nov"; - ofd.Title = "Load clientinfo.nov"; - if (ofd.ShowDialog() == DialogResult.OK) - { - string file, usesplayername, usesid, warning, legacymode, clientmd5, - scriptmd5, desc, locked, fix2007, alreadyhassecurity, - cmdargsornogfxoptions, commandargsver2; - - using(StreamReader reader = new StreamReader(ofd.FileName)) - { - SelectedClientInfoPath = Path.GetDirectoryName(ofd.FileName); - file = reader.ReadLine(); - } + string clientinfopath = SDKFuncs.LoadClientinfoAndGetPath(SelectedClientInfo, Locked, label9.Text, checkBox4.Checked); - string ConvertedLine = ""; + if (!string.IsNullOrWhiteSpace(clientinfopath)) + { + SelectedClientInfoPath = clientinfopath; - try - { - IsVersion2 = true; - label9.Text = "v2"; - ConvertedLine = SecurityFuncs.Base64DecodeNew(file); - } - catch(Exception) - { - label9.Text = "v1"; - ConvertedLine = SecurityFuncs.Base64DecodeOld(file); - } - - string[] result = ConvertedLine.Split('|'); - usesplayername = SecurityFuncs.Base64Decode(result[0]); - usesid = SecurityFuncs.Base64Decode(result[1]); - warning = SecurityFuncs.Base64Decode(result[2]); - legacymode = SecurityFuncs.Base64Decode(result[3]); - clientmd5 = SecurityFuncs.Base64Decode(result[4]); - scriptmd5 = SecurityFuncs.Base64Decode(result[5]); - desc = SecurityFuncs.Base64Decode(result[6]); - locked = SecurityFuncs.Base64Decode(result[7]); - fix2007 = SecurityFuncs.Base64Decode(result[8]); - alreadyhassecurity = SecurityFuncs.Base64Decode(result[9]); - cmdargsornogfxoptions = SecurityFuncs.Base64Decode(result[10]); - commandargsver2 = ""; - try - { - if (IsVersion2) - { - commandargsver2 = SecurityFuncs.Base64Decode(result[11]); - } - } - catch (Exception) - { - label9.Text = "v2 (DEV)"; - IsVersion2 = false; - } - - if (!GlobalVars.AdminMode) - { - bool bline8 = Convert.ToBoolean(locked); - if (bline8) - { - MessageBox.Show("This client is locked and therefore it cannot be loaded.","Novetus Launcher - Error when loading client", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - else - { - Locked = bline8; - checkBox4.Checked = Locked; - } - } - else - { - bool bline8 = Convert.ToBoolean(locked); - Locked = bline8; - checkBox4.Checked = Locked; - } - - loadedClientInfo.UsesPlayerName = Convert.ToBoolean(usesplayername); - - bool bline2 = Convert.ToBoolean(usesid); - loadedClientInfo.UsesID = bline2; - - loadedClientInfo.Warning = warning; - - bool bline4 = Convert.ToBoolean(legacymode); - loadedClientInfo.LegacyMode = bline4; - - loadedClientInfo.ClientMD5 = clientmd5; - - loadedClientInfo.ScriptMD5 = scriptmd5; - - loadedClientInfo.Description = desc; - - bool bline9 = Convert.ToBoolean(fix2007); - loadedClientInfo.Fix2007 = bline9; - - bool bline10 = Convert.ToBoolean(alreadyhassecurity); - loadedClientInfo.AlreadyHasSecurity = bline10; - - if (IsVersion2) - { - bool bline11 = Convert.ToBoolean(cmdargsornogfxoptions); - loadedClientInfo.NoGraphicsOptions = bline11; - loadedClientInfo.CommandLineArgs = commandargsver2; - } - else - { - //Agin, fake it. - loadedClientInfo.NoGraphicsOptions = false; - loadedClientInfo.CommandLineArgs = cmdargsornogfxoptions; - } - - checkBox1.Checked = loadedClientInfo.UsesPlayerName; - checkBox2.Checked = loadedClientInfo.UsesID; - checkBox3.Checked = loadedClientInfo.LegacyMode; - checkBox6.Checked = loadedClientInfo.Fix2007; - checkBox7.Checked = loadedClientInfo.AlreadyHasSecurity; - checkBox5.Checked = loadedClientInfo.NoGraphicsOptions; - textBox3.Text = loadedClientInfo.ScriptMD5.ToUpper(CultureInfo.InvariantCulture); - textBox2.Text = loadedClientInfo.ClientMD5.ToUpper(CultureInfo.InvariantCulture); - textBox1.Text = loadedClientInfo.Description; - textBox4.Text = loadedClientInfo.CommandLineArgs; - textBox5.Text = loadedClientInfo.Warning; - } + checkBox1.Checked = SelectedClientInfo.UsesPlayerName; + checkBox2.Checked = SelectedClientInfo.UsesID; + checkBox3.Checked = SelectedClientInfo.LegacyMode; + checkBox6.Checked = SelectedClientInfo.Fix2007; + checkBox7.Checked = SelectedClientInfo.AlreadyHasSecurity; + checkBox5.Checked = SelectedClientInfo.NoGraphicsOptions; + textBox3.Text = SelectedClientInfo.ScriptMD5.ToUpper(CultureInfo.InvariantCulture); + textBox2.Text = SelectedClientInfo.ClientMD5.ToUpper(CultureInfo.InvariantCulture); + textBox1.Text = SelectedClientInfo.Description; + textBox4.Text = SelectedClientInfo.CommandLineArgs; + textBox5.Text = SelectedClientInfo.Warning; } + textBox2.BackColor = System.Drawing.SystemColors.Control; textBox3.BackColor = System.Drawing.SystemColors.Control; } void SaveToolStripMenuItemClick(object sender, EventArgs e) { - using (var sfd = new SaveFileDialog()) - { - sfd.Filter = "Novetus Clientinfo files (*.nov)|*.nov"; - sfd.FilterIndex = 1; - sfd.FileName = "clientinfo.nov"; - sfd.Title = "Save clientinfo.nov"; - - if (sfd.ShowDialog() == DialogResult.OK) - { - string[] lines = { - SecurityFuncs.Base64Encode(loadedClientInfo.UsesPlayerName.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.UsesID.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.Warning.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.LegacyMode.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.ClientMD5.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.ScriptMD5.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.Description.ToString()), - SecurityFuncs.Base64Encode(Locked.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.Fix2007.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.AlreadyHasSecurity.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.NoGraphicsOptions.ToString()), - SecurityFuncs.Base64Encode(loadedClientInfo.CommandLineArgs.ToString()) - }; - File.WriteAllText(sfd.FileName, SecurityFuncs.Base64Encode(string.Join("|",lines))); - SelectedClientInfoPath = Path.GetDirectoryName(sfd.FileName); - } + string clientinfopath = SDKFuncs.SaveClientinfoAndGetPath(SelectedClientInfo, Locked); + + if (!string.IsNullOrWhiteSpace(clientinfopath)) + { + SelectedClientInfoPath = clientinfopath; } label9.Text = "v2"; textBox2.BackColor = System.Drawing.SystemColors.Control; textBox3.BackColor = System.Drawing.SystemColors.Control; } - + + private void saveAsTextFileToolStripMenuItem_Click(object sender, EventArgs e) + { + SDKFuncs.SaveClientinfoAndGetPath(SelectedClientInfo, Locked, true); + } + void TextBox4TextChanged(object sender, EventArgs e) { - loadedClientInfo.CommandLineArgs = textBox4.Text; + SelectedClientInfo.CommandLineArgs = textBox4.Text; } void TextBox5TextChanged(object sender, EventArgs e) { - loadedClientInfo.Warning = textBox5.Text; + SelectedClientInfo.Warning = textBox5.Text; } private void documentationToolStripMenuItem_Click(object sender, EventArgs e) @@ -358,11 +213,6 @@ namespace NovetusLauncher csd.Show(); } - private void AddClientinfoText(string text) - { - textBox4.Paste(text); - } - //tags private void clientToolStripMenuItem_Click(object sender, EventArgs e) { @@ -389,39 +239,19 @@ namespace NovetusLauncher AddClientinfoText(""); } - //variables - private void variableToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem senderitem = (ToolStripMenuItem)sender; AddClientinfoText(senderitem.Text); } + #endregion - private void saveAsTextFileToolStripMenuItem_Click(object sender, EventArgs e) - { - using (var sfd = new SaveFileDialog()) - { - sfd.Filter = "Text file (*.txt)|*.txt"; - sfd.FilterIndex = 1; - sfd.FileName = "clientinfo.txt"; - sfd.Title = "Save clientinfo.txt"; - - if (sfd.ShowDialog() == DialogResult.OK) - { - string[] lines = { - loadedClientInfo.UsesPlayerName.ToString(), - loadedClientInfo.UsesID.ToString(), - loadedClientInfo.Warning.ToString(), - loadedClientInfo.LegacyMode.ToString(), - loadedClientInfo.Description.ToString(), - loadedClientInfo.Fix2007.ToString(), - loadedClientInfo.AlreadyHasSecurity.ToString(), - loadedClientInfo.NoGraphicsOptions.ToString(), - loadedClientInfo.CommandLineArgs.ToString() - }; - File.WriteAllLines(sfd.FileName, lines); - } - } - } - } + #region Functions + private void AddClientinfoText(string text) + { + textBox4.Paste(text); + } + #endregion + } + #endregion } diff --git a/Novetus/NovetusLauncher/Forms/SDK/DiogenesEditor.cs b/Novetus/NovetusLauncher/Forms/SDK/DiogenesEditor.cs index 2778306..d6f9c26 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/DiogenesEditor.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/DiogenesEditor.cs @@ -1,15 +1,14 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; +#region Usings +using System; using System.IO; -using System.Linq; using System.Text; using System.Windows.Forms; +#endregion namespace NovetusLauncher.SDK { + //UNFINISHED REGIONING + #region Diogenes Editor public partial class DiogenesEditor : Form { public DiogenesEditor() @@ -17,18 +16,7 @@ namespace NovetusLauncher.SDK InitializeComponent(); } - public static string DiogenesCrypt(string word) - { - StringBuilder result = new StringBuilder(""); - byte[] bytes = Encoding.ASCII.GetBytes(word); - - foreach (byte singular in bytes) - { - result.Append(Convert.ToChar(0x55 ^ singular)); - } - - return result.ToString(); - } + void NewToolStripMenuItemClick(object sender, EventArgs e) { @@ -125,4 +113,5 @@ namespace NovetusLauncher.SDK } } } + #endregion } diff --git a/Novetus/NovetusLauncher/Novetus.Launcher.csproj b/Novetus/NovetusLauncher/Novetus.Launcher.csproj index 3f244ca..a15b8d8 100644 --- a/Novetus/NovetusLauncher/Novetus.Launcher.csproj +++ b/Novetus/NovetusLauncher/Novetus.Launcher.csproj @@ -122,16 +122,18 @@ - + + + Form - + CharacterCustomizationCompact.cs - + Form - + CharacterCustomizationExtended.cs @@ -221,10 +223,10 @@ - + CharacterCustomizationCompact.cs - + CharacterCustomizationExtended.cs diff --git a/Novetus/NovetusURI/Forms/QuickConfigure.cs b/Novetus/NovetusURI/Forms/QuickConfigure.cs index d925f05..2d86d4b 100644 --- a/Novetus/NovetusURI/Forms/QuickConfigure.cs +++ b/Novetus/NovetusURI/Forms/QuickConfigure.cs @@ -99,7 +99,7 @@ namespace NovetusURI void Button2Click(object sender, EventArgs e) { - this.Close(); + Close(); } void QuickConfigureClose(object sender, CancelEventArgs e)