protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); LauncherFuncs.WriteServerPrefs("serverhost_config.txt"); }
void MainFormLoad(object sender, EventArgs e) { string line1; string Decryptline1, Decryptline2, Decryptline3, Decryptline4; using(StreamReader reader = new StreamReader(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\info.txt")) { line1 = reader.ReadLine(); } if (!SecurityFuncs.IsBase64String(line1)) return; string ConvertedLine = SecurityFuncs.Base64Decode(line1); string[] result = ConvertedLine.Split('|'); Decryptline1 = SecurityFuncs.Base64Decode(result[0]); Decryptline2 = SecurityFuncs.Base64Decode(result[1]); Decryptline3 = SecurityFuncs.Base64Decode(result[2]); Decryptline4 = SecurityFuncs.Base64Decode(result[3]); string version = Decryptline1; GlobalVars.SelectedClient = Decryptline2; GlobalVars.DefaultScript = Decryptline3; GlobalVars.DefaultScriptMD5 = Decryptline4; ConsolePrint("RBXLegacy Launcher version " + version + " loaded. Initializing config.", 4); if (File.Exists("changelog.txt")) { richTextBox2.Text = File.ReadAllText("changelog.txt"); } else { ConsolePrint("ERROR 4 - changelog.txt not found.", 2); } if (!File.Exists("rbxlegacy_config.txt")) { ConsolePrint("WARNING 1 - rbxlegacy_config.txt not found. Creating one with default values.", 5); WriteConfigValues(); } if (!File.Exists("serverhost_config.txt")) { ConsolePrint("WARNING 1 - serverhost_config.txt not found. Creating one with default values.", 5); LauncherFuncs.WriteServerPrefs("serverhost_config.txt"); } if (!File.Exists("servers.txt")) { ConsolePrint("WARNING 2 - servers.txt not found. Creating empty file.", 5); File.Create("servers.txt").Dispose(); } if (!File.Exists("ports.txt")) { ConsolePrint("WARNING 3 - ports.txt not found. Creating empty file.", 5); File.Create("ports.txt").Dispose(); } GlobalVars.ClientDir = Path.Combine(Environment.CurrentDirectory, @"clients"); GlobalVars.ClientDir = GlobalVars.ClientDir.Replace(@"\",@"\\"); GlobalVars.ScriptsDir = Path.Combine(Environment.CurrentDirectory, @"scripts"); GlobalVars.ScriptsDir = GlobalVars.ScriptsDir.Replace(@"\",@"\\"); GlobalVars.MapsDir = Path.Combine(Environment.CurrentDirectory, @"maps"); GlobalVars.MapsDir = GlobalVars.MapsDir.Replace(@"\",@"\\"); GlobalVars.CustomPlayerDir = Path.Combine(Environment.CurrentDirectory, @"avatar"); GlobalVars.CustomPlayerDir = GlobalVars.CustomPlayerDir.Replace(@"\",@"\\"); label5.Text = Environment.CurrentDirectory; label8.Text = Application.ProductVersion; GlobalVars.IP = "localhost"; GlobalVars.Map = "Baseplate.rbxl"; label11.Text = version; GlobalVars.Version = version; ReadConfigValues(); }
void Button1Click(object sender, EventArgs e) { LauncherFuncs.ResetServerPrefs(); LauncherFuncs.WriteServerPrefs("serverhost_config.txt"); DialogResult result = MessageBox.Show("Your server configuration has been reset to the default values.", "RBXLegacy Launcher - Server Preferences", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); }