From ec79c7a5ea6509a6cd351c5176ddddae4b9757a8 Mon Sep 17 00:00:00 2001 From: Bitl Date: Fri, 10 Jul 2020 17:30:41 -0700 Subject: [PATCH] regioned uri files. restored functionality to SDK utils that were damaged --- Novetus/NovetusCore/GlobalVars.cs | 2 +- .../NovetusLauncher/Classes/SDK/SDKFuncs.cs | 265 ------------------ .../Forms/SDK/ClientinfoCreator.cs | 207 ++++++++++++-- .../Forms/SDK/DiogenesEditor.cs | 80 +++++- .../NovetusLauncher/Forms/SDK/ItemMaker.cs | 20 +- Novetus/NovetusURI/Classes/LocalFuncs.cs | 67 +++++ Novetus/NovetusURI/Forms/InstallForm.cs | 31 +- Novetus/NovetusURI/Forms/LoaderForm.cs | 154 ++++------ Novetus/NovetusURI/Forms/QuickConfigure.cs | 37 +-- Novetus/NovetusURI/Novetus.URI.csproj | 1 + 10 files changed, 435 insertions(+), 429 deletions(-) create mode 100644 Novetus/NovetusURI/Classes/LocalFuncs.cs diff --git a/Novetus/NovetusCore/GlobalVars.cs b/Novetus/NovetusCore/GlobalVars.cs index bb3c249..56f792a 100644 --- a/Novetus/NovetusCore/GlobalVars.cs +++ b/Novetus/NovetusCore/GlobalVars.cs @@ -3,7 +3,7 @@ * * change control names for all forms * Rewrite client launching into one function. - * add regions to rest of forms. URI, Launcher, and charcustom forms are left! + * add regions to rest of forms. Launcher forms are left! */ #region Global Variables diff --git a/Novetus/NovetusLauncher/Classes/SDK/SDKFuncs.cs b/Novetus/NovetusLauncher/Classes/SDK/SDKFuncs.cs index 235b494..a46e780 100644 --- a/Novetus/NovetusLauncher/Classes/SDK/SDKFuncs.cs +++ b/Novetus/NovetusLauncher/Classes/SDK/SDKFuncs.cs @@ -513,168 +513,6 @@ namespace NovetusLauncher } #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 @@ -690,86 +528,6 @@ namespace NovetusLauncher return result.ToString(); } - - public static void LoadDiogenes(string veroutput, string textoutput) - { - using (var ofd = new OpenFileDialog()) - { - ofd.Filter = "ROBLOX Diogenes filter (diogenes.fnt)|diogenes.fnt"; - ofd.FilterIndex = 1; - ofd.FileName = "diogenes.fnt"; - ofd.Title = "Load diogenes.fnt"; - if (ofd.ShowDialog() == DialogResult.OK) - { - StringBuilder builder = new StringBuilder(); - - using (StreamReader reader = new StreamReader(ofd.FileName)) - { - while (!reader.EndOfStream) - { - string line = reader.ReadLine(); - - try - { - line = DiogenesCrypt(line); - veroutput = "v2"; - } - catch (Exception) - { - veroutput = "v1"; - continue; - } - - builder.Append(line + Environment.NewLine); - } - } - - textoutput = builder.ToString(); - } - } - } - - public static void SaveDiogenes(string veroutput, string[] lineinput, bool textonly = false) - { - using (var sfd = new SaveFileDialog()) - { - sfd.Filter = "ROBLOX Diogenes filter v2 (diogenes.fnt)|diogenes.fnt|ROBLOX Diogenes filter v1 (diogenes.fnt)|diogenes.fnt"; - sfd.FilterIndex = 1; - sfd.FileName = "diogenes.fnt"; - sfd.Title = "Save diogenes.fnt"; - - if (sfd.ShowDialog() == DialogResult.OK) - { - if (!textonly) - { - StringBuilder builder = new StringBuilder(); - - foreach (string s in lineinput) - { - if (sfd.FilterIndex == 1) - { - builder.Append(DiogenesCrypt(s) + Environment.NewLine); - veroutput = "v2"; - } - else - { - builder.Append(s + Environment.NewLine); - veroutput = "v1"; - } - } - - using (StreamWriter sw = File.CreateText(sfd.FileName)) - { - sw.Write(builder.ToString()); - } - } - else - { - File.WriteAllLines(sfd.FileName, lineinput); - } - } - } - } #endregion #region Item SDK @@ -822,29 +580,6 @@ namespace NovetusLauncher MessageBox.Show("Error: Unable to download the file. Try using a different file name or ID.", "Novetus Item SDK | Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - - public static void SelectItemDownloadURL(int index, string url, bool iswebsite) - { - switch (index) - { - case 1: - url = "http://assetgame.roblox.com/asset/?id="; - iswebsite = false; - break; - case 2: - url = "https://www.roblox.com/catalog/"; - iswebsite = true; - break; - case 3: - url = "https://www.roblox.com/library/"; - iswebsite = true; - break; - default: - url = "http://www.roblox.com/asset?id="; - iswebsite = false; - break; - } - } #endregion #region SDK Launcher diff --git a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs index bad0a41..a40f573 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs @@ -114,7 +114,14 @@ namespace NovetusLauncher void CheckBox4CheckedChanged(object sender, EventArgs e) { - Locked = true; + if (checkBox4.Checked == true) + { + Locked = true; + } + else if (checkBox4.Checked == false && Locked == true) + { + Locked = true; + } } void CheckBox6CheckedChanged(object sender, EventArgs e) @@ -135,7 +142,18 @@ namespace NovetusLauncher void NewToolStripMenuItemClick(object sender, EventArgs e) { label9.Text = "Not Loaded"; - SDKFuncs.NewClientinfo(SelectedClientInfo, Locked); + SelectedClientInfo.UsesPlayerName = false; + SelectedClientInfo.UsesID = false; + SelectedClientInfo.Warning = ""; + SelectedClientInfo.LegacyMode = false; + SelectedClientInfo.Fix2007 = false; + SelectedClientInfo.AlreadyHasSecurity = false; + SelectedClientInfo.NoGraphicsOptions = false; + SelectedClientInfo.Description = ""; + SelectedClientInfo.ClientMD5 = ""; + SelectedClientInfo.ScriptMD5 = ""; + SelectedClientInfo.CommandLineArgs = ""; + Locked = false; SelectedClientInfoPath = ""; checkBox1.Checked = SelectedClientInfo.UsesPlayerName; checkBox2.Checked = SelectedClientInfo.UsesID; @@ -155,36 +173,156 @@ namespace NovetusLauncher void LoadToolStripMenuItemClick(object sender, EventArgs e) { - string clientinfopath = SDKFuncs.LoadClientinfoAndGetPath(SelectedClientInfo, Locked, label9.Text, checkBox4.Checked); + bool IsVersion2 = false; - if (!string.IsNullOrWhiteSpace(clientinfopath)) + using (var ofd = new OpenFileDialog()) { - SelectedClientInfoPath = clientinfopath; + 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; - 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; + using (StreamReader reader = new StreamReader(ofd.FileName)) + { + file = reader.ReadLine(); + } + + string ConvertedLine = ""; + + 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 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 + { + Locked = lockcheck; + checkBox4.Checked = Locked; + } + } + else + { + Locked = Convert.ToBoolean(locked); + checkBox4.Checked = Locked; + } + + SelectedClientInfo.UsesPlayerName = Convert.ToBoolean(usesplayername); + SelectedClientInfo.UsesID = Convert.ToBoolean(usesid); + SelectedClientInfo.Warning = warning; + SelectedClientInfo.LegacyMode = Convert.ToBoolean(legacymode); + SelectedClientInfo.ClientMD5 = clientmd5; + SelectedClientInfo.ScriptMD5 = scriptmd5; + SelectedClientInfo.Description = desc; + SelectedClientInfo.Fix2007 = Convert.ToBoolean(fix2007); + SelectedClientInfo.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity); + + if (IsVersion2) + { + SelectedClientInfo.NoGraphicsOptions = Convert.ToBoolean(cmdargsornogfxoptions); + SelectedClientInfo.CommandLineArgs = commandargsver2; + } + else + { + //Again, fake it. + SelectedClientInfo.NoGraphicsOptions = false; + SelectedClientInfo.CommandLineArgs = cmdargsornogfxoptions; + } + } + + SelectedClientInfoPath = Path.GetDirectoryName(ofd.FileName); } + 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) { - string clientinfopath = SDKFuncs.SaveClientinfoAndGetPath(SelectedClientInfo, Locked); - - if (!string.IsNullOrWhiteSpace(clientinfopath)) + using (var sfd = new SaveFileDialog()) { - SelectedClientInfoPath = clientinfopath; + sfd.Filter = "Novetus Clientinfo files (*.nov)|*.nov"; + sfd.FilterIndex = 1; + string filename = "clientinfo.nov"; + sfd.FileName = filename; + sfd.Title = "Save " + filename; + + if (sfd.ShowDialog() == DialogResult.OK) + { + string[] lines = { + SecurityFuncs.Base64Encode(SelectedClientInfo.UsesPlayerName.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.UsesID.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.Warning.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.LegacyMode.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.ClientMD5.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.ScriptMD5.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.Description.ToString()), + SecurityFuncs.Base64Encode(Locked.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.Fix2007.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.AlreadyHasSecurity.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.NoGraphicsOptions.ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.CommandLineArgs.ToString()) + }; + File.WriteAllText(sfd.FileName, SecurityFuncs.Base64Encode(string.Join("|", lines))); + SelectedClientInfoPath = Path.GetDirectoryName(sfd.FileName); + } } label9.Text = "v2"; @@ -194,7 +332,34 @@ namespace NovetusLauncher private void saveAsTextFileToolStripMenuItem_Click(object sender, EventArgs e) { - SDKFuncs.SaveClientinfoAndGetPath(SelectedClientInfo, Locked, true); + using (var sfd = new SaveFileDialog()) + { + sfd.Filter = "Text file (*.txt)|*.txt"; + sfd.FilterIndex = 1; + string filename = "clientinfo.txt"; + sfd.FileName = filename; + sfd.Title = "Save " + filename; + + if (sfd.ShowDialog() == DialogResult.OK) + { + string[] lines = { + SelectedClientInfo.UsesPlayerName.ToString(), + SelectedClientInfo.UsesID.ToString(), + SelectedClientInfo.Warning.ToString(), + SelectedClientInfo.LegacyMode.ToString(), + SelectedClientInfo.ClientMD5.ToString(), + SelectedClientInfo.ScriptMD5.ToString(), + SelectedClientInfo.Description.ToString(), + Locked.ToString(), + SelectedClientInfo.Fix2007.ToString(), + SelectedClientInfo.AlreadyHasSecurity.ToString(), + SelectedClientInfo.NoGraphicsOptions.ToString(), + SelectedClientInfo.CommandLineArgs.ToString() + }; + File.WriteAllLines(sfd.FileName, lines); + SelectedClientInfoPath = Path.GetDirectoryName(sfd.FileName); + } + } } void TextBox4TextChanged(object sender, EventArgs e) diff --git a/Novetus/NovetusLauncher/Forms/SDK/DiogenesEditor.cs b/Novetus/NovetusLauncher/Forms/SDK/DiogenesEditor.cs index 379ef83..0930c38 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/DiogenesEditor.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/DiogenesEditor.cs @@ -26,17 +26,91 @@ namespace NovetusLauncher void LoadToolStripMenuItemClick(object sender, EventArgs e) { - SDKFuncs.LoadDiogenes(label2.Text, richTextBox1.Text); + using (var ofd = new OpenFileDialog()) + { + ofd.Filter = "ROBLOX Diogenes filter (diogenes.fnt)|diogenes.fnt"; + ofd.FilterIndex = 1; + ofd.FileName = "diogenes.fnt"; + ofd.Title = "Load diogenes.fnt"; + if (ofd.ShowDialog() == DialogResult.OK) + { + StringBuilder builder = new StringBuilder(); + + using (StreamReader reader = new StreamReader(ofd.FileName)) + { + while (!reader.EndOfStream) + { + string line = reader.ReadLine(); + + try + { + line = SDKFuncs.DiogenesCrypt(line); + label2.Text = "v2"; + } + catch (Exception) + { + label2.Text = "v1"; + continue; + } + + builder.Append(line + Environment.NewLine); + } + } + + richTextBox1.Text = builder.ToString(); + } + } } void SaveToolStripMenuItemClick(object sender, EventArgs e) { - SDKFuncs.SaveDiogenes(label2.Text, richTextBox1.Lines); + using (var sfd = new SaveFileDialog()) + { + sfd.Filter = "ROBLOX Diogenes filter v2 (diogenes.fnt)|diogenes.fnt|ROBLOX Diogenes filter v1 (diogenes.fnt)|diogenes.fnt"; + sfd.FilterIndex = 1; + sfd.FileName = "diogenes.fnt"; + sfd.Title = "Save diogenes.fnt"; + + if (sfd.ShowDialog() == DialogResult.OK) + { + StringBuilder builder = new StringBuilder(); + + foreach (string s in richTextBox1.Lines) + { + if (sfd.FilterIndex == 1) + { + builder.Append(SDKFuncs.DiogenesCrypt(s) + Environment.NewLine); + label2.Text = "v2"; + } + else + { + builder.Append(s + Environment.NewLine); + label2.Text = "v1"; + } + } + + using (StreamWriter sw = File.CreateText(sfd.FileName)) + { + sw.Write(builder.ToString()); + } + } + } } void saveAsTextFileToolStripMenuItem_Click(object sender, EventArgs e) { - SDKFuncs.SaveDiogenes(label2.Text, richTextBox1.Lines, true); + using (var sfd = new SaveFileDialog()) + { + sfd.Filter = "Text file (*.txt)|*.txt"; + sfd.FilterIndex = 1; + sfd.FileName = "diogenes.txt"; + sfd.Title = "Save diogenes.txt"; + + if (sfd.ShowDialog() == DialogResult.OK) + { + File.WriteAllLines(sfd.FileName, richTextBox1.Lines); + } + } } #endregion } diff --git a/Novetus/NovetusLauncher/Forms/SDK/ItemMaker.cs b/Novetus/NovetusLauncher/Forms/SDK/ItemMaker.cs index 3101f4c..6dbad1c 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ItemMaker.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ItemMaker.cs @@ -28,7 +28,25 @@ namespace NovetusLauncher void ComboBox1SelectedIndexChanged(object sender, EventArgs e) { - SDKFuncs.SelectItemDownloadURL(comboBox1.SelectedIndex, url, isWebSite); + switch (comboBox1.SelectedIndex) + { + case 1: + url = "http://assetgame.roblox.com/asset/?id="; + isWebSite = false; + break; + case 2: + url = "https://www.roblox.com/catalog/"; + isWebSite = true; + break; + case 3: + url = "https://www.roblox.com/library/"; + isWebSite = true; + break; + default: + url = "http://www.roblox.com/asset?id="; + isWebSite = false; + break; + } } void ItemMakerLoad(object sender, EventArgs e) diff --git a/Novetus/NovetusURI/Classes/LocalFuncs.cs b/Novetus/NovetusURI/Classes/LocalFuncs.cs new file mode 100644 index 0000000..800537f --- /dev/null +++ b/Novetus/NovetusURI/Classes/LocalFuncs.cs @@ -0,0 +1,67 @@ +#region Usings +using System; +using System.IO; +using System.Windows.Forms; +#endregion + +namespace NovetusURI +{ + #region LocalFuncs + class LocalFuncs + { + public static void RegisterURI(Form form) + { + if (SecurityFuncs.IsElevated) + { + try + { + URIReg novURI = new URIReg("novetus", "url.novetus"); + novURI.Register(); + + MessageBox.Show("URI successfully installed and registered!", "Novetus - Install URI", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + form.Close(); + } + } + else + { + MessageBox.Show("Failed to register. (Error: Did not run as Administrator)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + form.Close(); + } + } + + public static void ReadClientValues(string ClientName) + { + string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; + + if (!File.Exists(clientpath)) + { + 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.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient; + ReadClientValues(ClientName); + } + else + { + GlobalFuncs.ReadClientValues(clientpath); + } + } + + public static void SetupURIValues() + { + string ExtractedArg = GlobalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", ""); + string ConvertedArg = SecurityFuncs.Base64DecodeOld(ExtractedArg); + string[] SplitArg = ConvertedArg.Split('|'); + string ip = SecurityFuncs.Base64Decode(SplitArg[0]); + string port = SecurityFuncs.Base64Decode(SplitArg[1]); + string client = SecurityFuncs.Base64Decode(SplitArg[2]); + GlobalVars.UserConfiguration.SelectedClient = client; + GlobalVars.IP = ip; + GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port); + LocalFuncs.ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); + } + } + #endregion +} diff --git a/Novetus/NovetusURI/Forms/InstallForm.cs b/Novetus/NovetusURI/Forms/InstallForm.cs index 6ea5c71..652ea07 100644 --- a/Novetus/NovetusURI/Forms/InstallForm.cs +++ b/Novetus/NovetusURI/Forms/InstallForm.cs @@ -1,37 +1,26 @@ -using System; +#region Usings +using System; using System.Windows.Forms; +#endregion namespace NovetusURI { + #region URI Installation Form public partial class InstallForm : Form { + #region Constructor public InstallForm() { InitializeComponent(); } + #endregion + #region Form Events private void button1_Click(object sender, EventArgs e) { - if (SecurityFuncs.IsElevated) - { - try - { - URIReg novURI = new URIReg("novetus","url.novetus"); - novURI.Register(); - - MessageBox.Show("URI successfully installed and registered!", "Novetus - Install URI", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - catch (Exception ex) - { - MessageBox.Show("Failed to register. (Error: " + ex.Message + ")", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - Close(); - } - } - else - { - MessageBox.Show("Failed to register. (Error: Did not run as Administrator)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - Close(); - } + LocalFuncs.RegisterURI(this); } + #endregion } + #endregion } diff --git a/Novetus/NovetusURI/Forms/LoaderForm.cs b/Novetus/NovetusURI/Forms/LoaderForm.cs index fa90324..c918098 100644 --- a/Novetus/NovetusURI/Forms/LoaderForm.cs +++ b/Novetus/NovetusURI/Forms/LoaderForm.cs @@ -1,63 +1,71 @@ -/* - * Created by SharpDevelop. - * User: BITL - * Date: 6/13/2017 - * Time: 11:45 AM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ +#region Usings using System; using System.IO; using System.Diagnostics; using System.Threading; using System.Windows.Forms; -using System.Reflection; +#endregion namespace NovetusURI { - /// - /// Description of LoaderForm. - /// - public partial class LoaderForm : Form + #region URI Loader + public partial class LoaderForm : Form { - DiscordRPC.EventHandlers handlers; + #region Private Variables + private DiscordRPC.EventHandlers handlers; + #endregion - public LoaderForm() + #region Discord + public void ReadyCallback() { - // - // The InitializeComponent() call is required for Windows Forms designer support. - // - InitializeComponent(); - - // - // TODO: Add constructor code after the InitializeComponent() call. - // } - public void ReadyCallback() - { - } + public void DisconnectedCallback(int errorCode, string message) + { + } - public void DisconnectedCallback(int errorCode, string message) - { - } + public void ErrorCallback(int errorCode, string message) + { + } - public void ErrorCallback(int errorCode, string message) - { - } + public void JoinCallback(string secret) + { + } - public void JoinCallback(string secret) - { - } + public void SpectateCallback(string secret) + { + } - public void SpectateCallback(string secret) - { - } + public void RequestCallback(DiscordRPC.JoinRequest request) + { + } - public void RequestCallback(DiscordRPC.JoinRequest request) - { - } + void StartDiscord() + { + if (GlobalVars.UserConfiguration.DiscordPresence) + { + handlers = new DiscordRPC.EventHandlers(); + handlers.readyCallback = ReadyCallback; + handlers.disconnectedCallback += DisconnectedCallback; + handlers.errorCallback += ErrorCallback; + handlers.joinCallback += JoinCallback; + handlers.spectateCallback += SpectateCallback; + handlers.requestCallback += RequestCallback; + DiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, ""); + GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.LoadingURI, "", true); + } + } + #endregion + + #region Constructor + public LoaderForm() + { + InitializeComponent(); + } + #endregion + + #region Form Events void LoaderFormLoad(object sender, EventArgs e) { QuickConfigure main = new QuickConfigure(); @@ -65,35 +73,8 @@ namespace NovetusURI System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0); } - void StartDiscord() - { - if (GlobalVars.UserConfiguration.DiscordPresence) - { - handlers = new DiscordRPC.EventHandlers(); - handlers.readyCallback = ReadyCallback; - handlers.disconnectedCallback += DisconnectedCallback; - handlers.errorCallback += ErrorCallback; - handlers.joinCallback += JoinCallback; - handlers.spectateCallback += SpectateCallback; - handlers.requestCallback += RequestCallback; - DiscordRPC.Initialize(GlobalVars.appid, ref handlers, true, ""); - - GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.LoadingURI, "", true); - } - } - void StartGame() { - string ExtractedArg = GlobalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", ""); - string ConvertedArg = SecurityFuncs.Base64DecodeOld(ExtractedArg); - string[] SplitArg = ConvertedArg.Split('|'); - string ip = SecurityFuncs.Base64Decode(SplitArg[0]); - string port = SecurityFuncs.Base64Decode(SplitArg[1]); - string client = SecurityFuncs.Base64Decode(SplitArg[2]); - GlobalVars.UserConfiguration.SelectedClient = client; - GlobalVars.IP = ip; - GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(port); - ReadClientValues(GlobalVars.UserConfiguration.SelectedClient); string luafile = ""; if (!GlobalVars.SelectedClientInfo.Fix2007) { @@ -179,17 +160,17 @@ namespace NovetusURI clientproc.PriorityClass = ProcessPriorityClass.RealTime; SecurityFuncs.RenameWindow(clientproc, ScriptType.Client, ""); GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InMPGame, ""); - this.Visible = false; + Visible = false; } void ClientExited(object sender, EventArgs e) { GlobalFuncs.UpdateRichPresence(GlobalVars.LauncherState.InLauncher, ""); - this.Close(); + Close(); } - + private void CheckIfFinished(object state) - { + { if (!LocalVars.ReadyToLaunch) { System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(CheckIfFinished), null, 1, 0); @@ -197,30 +178,17 @@ namespace NovetusURI else { Visible = true; - if (GlobalVars.UserConfiguration.DiscordPresence) - { - label1.Text = "Starting Discord Rich Presence..."; - StartDiscord(); - } + if (GlobalVars.UserConfiguration.DiscordPresence) + { + label1.Text = "Starting Discord Rich Presence..."; + StartDiscord(); + } label1.Text = "Launching Game..."; + LocalFuncs.SetupURIValues(); StartGame(); } - } - - void ReadClientValues(string ClientName) - { - string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\clientinfo.nov"; - - if (!File.Exists(clientpath)) - { - 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.UserConfiguration.SelectedClient = GlobalVars.ProgramInformation.DefaultClient; - ReadClientValues(ClientName); - } - else - { - GlobalFuncs.ReadClientValues(clientpath); - } } + #endregion } + #endregion } diff --git a/Novetus/NovetusURI/Forms/QuickConfigure.cs b/Novetus/NovetusURI/Forms/QuickConfigure.cs index 2d86d4b..fcc08fc 100644 --- a/Novetus/NovetusURI/Forms/QuickConfigure.cs +++ b/Novetus/NovetusURI/Forms/QuickConfigure.cs @@ -1,37 +1,24 @@ -/* - * Created by SharpDevelop. - * User: BITL - * Date: 6/13/2017 - * Time: 4:16 PM - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ +#region Usings using System; using System.Windows.Forms; -using System.IO; using System.ComponentModel; using NovetusLauncher; +#endregion namespace NovetusURI { - /// - /// Description of QuickConfigure. - /// - public partial class QuickConfigure : Form + #region Quick Configuration + public partial class QuickConfigure : Form { - public QuickConfigure() + #region Constructor + public QuickConfigure() { - // - // The InitializeComponent() call is required for Windows Forms designer support. - // InitializeComponent(); - - // - // TODO: Add constructor code after the InitializeComponent() call. - // } - - void QuickConfigureLoad(object sender, EventArgs e) + #endregion + + #region Form Events + void QuickConfigureLoad(object sender, EventArgs e) { ReadConfigValues(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName); } @@ -107,5 +94,7 @@ namespace NovetusURI GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true); LocalVars.ReadyToLaunch = true; } - } + #endregion + } + #endregion } diff --git a/Novetus/NovetusURI/Novetus.URI.csproj b/Novetus/NovetusURI/Novetus.URI.csproj index 4335c53..fccfe47 100644 --- a/Novetus/NovetusURI/Novetus.URI.csproj +++ b/Novetus/NovetusURI/Novetus.URI.csproj @@ -88,6 +88,7 @@ + Form