Added Server Information functionality to the Stylish style. add regions.

This commit is contained in:
Bitl 2021-09-25 15:32:50 -07:00
parent b9f1c64554
commit 237602849d
6 changed files with 132 additions and 99 deletions

View File

@ -232,6 +232,11 @@ public class GlobalFuncs
Config(cfgpath, true); Config(cfgpath, true);
} }
if (ResetMapIfNecessary())
{
Config(cfgpath, true);
}
GlobalVars.UserConfiguration.GraphicsMode = (Settings.Mode)Convert.ToInt32(graphics); GlobalVars.UserConfiguration.GraphicsMode = (Settings.Mode)Convert.ToInt32(graphics);
GlobalVars.UserConfiguration.ReShade = Convert.ToBoolean(reshade); GlobalVars.UserConfiguration.ReShade = Convert.ToBoolean(reshade);
GlobalVars.UserConfiguration.QualityLevel = (Settings.Level)Convert.ToInt32(qualitylevel); GlobalVars.UserConfiguration.QualityLevel = (Settings.Level)Convert.ToInt32(qualitylevel);
@ -265,6 +270,19 @@ public class GlobalFuncs
ReShade(GlobalPaths.ConfigDir, "ReShade.ini", write); ReShade(GlobalPaths.ConfigDir, "ReShade.ini", write);
} }
public static bool ResetMapIfNecessary()
{
if (!File.Exists(GlobalVars.UserConfiguration.MapPath))
{
GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
return true;
}
return false;
}
public static void Customization(string cfgpath, bool write) public static void Customization(string cfgpath, bool write)
{ {
if (write) if (write)

View File

@ -2,13 +2,9 @@
using Mono.Nat; using Mono.Nat;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
#endregion #endregion
@ -273,34 +269,25 @@ namespace NovetusLauncher
Application.Exit(); Application.Exit();
} }
public async Task ChangeTabs() public static async Task LoadServerInformation(TextBox box)
{ {
switch (Tabs.SelectedTab) //since we are async, DO THESE first or we'll clear out random stuff.
{ box.Text = "Loading...";
case TabPage pg2 when pg2 == Tabs.TabPages[TabPageHost]: string IP = await SecurityFuncs.GetExternalIPAddressAsync();
Tree.Nodes.Clear(); box.Text = "";
_TreeCache.Nodes.Clear(); string[] lines1 = {
MapDescBox.Text = "";
ClientBox.Items.Clear();
ServerBox.Items.Clear();
PortBox.Items.Clear();
//since we are async, DO THESE first or we'll clear out random stuff.
ServerInfo.Text = "Loading...";
string IP = await SecurityFuncs.GetExternalIPAddressAsync();
ServerInfo.Text = "";
string[] lines1 = {
SecurityFuncs.Base64Encode((!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : IP)), SecurityFuncs.Base64Encode((!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : IP)),
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()),
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient)
}; };
string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true); string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true);
string[] lines2 = { string[] lines2 = {
SecurityFuncs.Base64Encode("localhost"), SecurityFuncs.Base64Encode("localhost"),
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()), SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()),
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient) SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient)
}; };
string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true); string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true);
string[] text = { string[] text = {
"Client: " + GlobalVars.UserConfiguration.SelectedClient, "Client: " + GlobalVars.UserConfiguration.SelectedClient,
"IP: " + (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : IP), "IP: " + (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : IP),
"Port: " + GlobalVars.UserConfiguration.RobloxPort.ToString(), "Port: " + GlobalVars.UserConfiguration.RobloxPort.ToString(),
@ -313,15 +300,30 @@ namespace NovetusLauncher
URI2 URI2
}; };
foreach (string str in text) foreach (string str in text)
{ {
if (!string.IsNullOrWhiteSpace(str)) if (!string.IsNullOrWhiteSpace(str))
{ {
ServerInfo.AppendText(str + Environment.NewLine); box.AppendText(str + Environment.NewLine);
} }
} }
ServerInfo.SelectionStart = 0;
ServerInfo.ScrollToCaret(); box.SelectionStart = 0;
box.ScrollToCaret();
}
public async Task ChangeTabs()
{
switch (Tabs.SelectedTab)
{
case TabPage pg2 when pg2 == Tabs.TabPages[TabPageHost]:
Tree.Nodes.Clear();
_TreeCache.Nodes.Clear();
MapDescBox.Text = "";
ClientBox.Items.Clear();
ServerBox.Items.Clear();
PortBox.Items.Clear();
await LoadServerInformation(ServerInfo);
break; break;
case TabPage pg3 when pg3 == Tabs.TabPages[TabPageClients]: case TabPage pg3 when pg3 == Tabs.TabPages[TabPageClients]:
string clientdir = GlobalPaths.ClientDir; string clientdir = GlobalPaths.ClientDir;
@ -723,8 +725,6 @@ namespace NovetusLauncher
{ {
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
ResetMapIfNecessary();
CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch; CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch;
PlayerIDTextBox.Text = GlobalVars.UserConfiguration.UserID.ToString(); PlayerIDTextBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString();
@ -900,7 +900,7 @@ namespace NovetusLauncher
public void RefreshMaps() public void RefreshMaps()
{ {
ResetMapIfNecessary(); GlobalFuncs.ResetMapIfNecessary();
Tree.Nodes.Clear(); Tree.Nodes.Clear();
_TreeCache.Nodes.Clear(); _TreeCache.Nodes.Clear();
@ -929,16 +929,6 @@ namespace NovetusLauncher
} }
} }
public void ResetMapIfNecessary()
{
if (!File.Exists(GlobalVars.UserConfiguration.MapPath))
{
GlobalVars.UserConfiguration.Map = GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPath = GlobalPaths.MapsDir + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
GlobalVars.UserConfiguration.MapPathSnip = GlobalPaths.MapsDirBase + @"\\" + GlobalVars.ProgramInformation.DefaultMap;
}
}
public void RestartLauncherAfterSetting(CheckBox box, string title, string subText) public void RestartLauncherAfterSetting(CheckBox box, string title, string subText)
{ {
RestartLauncherAfterSetting(box.Checked, title, subText); RestartLauncherAfterSetting(box.Checked, title, subText);

View File

@ -1,27 +1,31 @@
using System; #region Usings
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.Integration; #endregion
namespace NovetusLauncher namespace NovetusLauncher
{ {
#region LauncherForm - Stylish
public partial class LauncherFormStylish : Form public partial class LauncherFormStylish : Form
{ {
#region Variables
LauncherFormStylishInterface launcherFormStylishInterface1; LauncherFormStylishInterface launcherFormStylishInterface1;
#endregion
#region Constructor
public LauncherFormStylish() public LauncherFormStylish()
{ {
InitializeComponent(); InitializeComponent();
launcherFormStylishInterface1 = new LauncherFormStylishInterface(this); launcherFormStylishInterface1 = new LauncherFormStylishInterface(this);
elementHost1.Child = launcherFormStylishInterface1; elementHost1.Child = launcherFormStylishInterface1;
} }
#endregion
#region Form Events
private void LauncherFormStylish_Load(object sender, EventArgs e) private void LauncherFormStylish_Load(object sender, EventArgs e)
{ {
try try
@ -88,7 +92,9 @@ namespace NovetusLauncher
CloseEvent(); CloseEvent();
Application.Exit(); Application.Exit();
} }
#endregion
#region Functions
public void CloseEvent() public void CloseEvent()
{ {
WriteConfigValues(); WriteConfigValues();
@ -118,8 +124,6 @@ namespace NovetusLauncher
{ {
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
launcherFormStylishInterface1.launcherForm.ResetMapIfNecessary();
launcherFormStylishInterface1.minimizeOnLaunchBox.IsChecked = GlobalVars.UserConfiguration.CloseOnLaunch; launcherFormStylishInterface1.minimizeOnLaunchBox.IsChecked = GlobalVars.UserConfiguration.CloseOnLaunch;
launcherFormStylishInterface1.userIDBox.Text = GlobalVars.UserConfiguration.UserID.ToString(); launcherFormStylishInterface1.userIDBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
launcherFormStylishInterface1.tripcodeLabel.Content = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); launcherFormStylishInterface1.tripcodeLabel.Content = GlobalVars.UserConfiguration.PlayerTripcode.ToString();
@ -211,5 +215,7 @@ namespace NovetusLauncher
launcherFormStylishInterface1.clientDescBox.Text = GlobalVars.UserConfiguration.SelectedClient + ": " + GlobalVars.SelectedClientInfo.Description; launcherFormStylishInterface1.clientDescBox.Text = GlobalVars.UserConfiguration.SelectedClient + ": " + GlobalVars.SelectedClientInfo.Description;
} }
#endregion
} }
#endregion
} }

View File

@ -1,32 +1,26 @@
using System; #region Usings
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; #endregion
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace NovetusLauncher namespace NovetusLauncher
{ {
/// <summary> #region LauncherForm - Stylish - Interface
/// Interaction logic for LauncherFormStylishInterface.xaml
/// </summary>
///
public partial class LauncherFormStylishInterface : System.Windows.Controls.UserControl public partial class LauncherFormStylishInterface : System.Windows.Controls.UserControl
{ {
#region Variables
public LauncherFormShared launcherForm; public LauncherFormShared launcherForm;
private System.Windows.Forms.TreeView _fieldsTreeCache; private System.Windows.Forms.TreeView _fieldsTreeCache;
public LauncherFormStylish FormParent; public LauncherFormStylish FormParent;
private bool hostPanelOpen; private bool hostPanelOpen;
#endregion
#region Constructor
public LauncherFormStylishInterface(LauncherFormStylish parent) public LauncherFormStylishInterface(LauncherFormStylish parent)
{ {
_fieldsTreeCache = new System.Windows.Forms.TreeView(); _fieldsTreeCache = new System.Windows.Forms.TreeView();
@ -45,7 +39,9 @@ namespace NovetusLauncher
hostPanelOpen = true; hostPanelOpen = true;
} }
#endregion
#region Form Events
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
try try
@ -97,21 +93,6 @@ namespace NovetusLauncher
e.Handled = true; e.Handled = true;
} }
public void LoadMapDesc()
{
if (mapsBox.SelectedNode == null)
return;
if (File.Exists(GlobalPaths.RootPath + @"\\" + mapsBox.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt"))
{
mapsDescBox.Text = mapsBox.SelectedNode.Text + ": " + File.ReadAllText(GlobalPaths.RootPath + @"\\" + mapsBox.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt");
}
else
{
mapsDescBox.Text = mapsBox.SelectedNode.Text;
}
}
private void mapsBox_BeforeSelect(object sender, TreeViewCancelEventArgs e) private void mapsBox_BeforeSelect(object sender, TreeViewCancelEventArgs e)
{ {
if (!IsLoaded) if (!IsLoaded)
@ -242,7 +223,8 @@ namespace NovetusLauncher
private void serverInfoButton_Click(object sender, RoutedEventArgs e) private void serverInfoButton_Click(object sender, RoutedEventArgs e)
{ {
LauncherFormStylishServerInfo info = new LauncherFormStylishServerInfo();
info.Show();
} }
private void regenerateIDButton_Click(object sender, RoutedEventArgs e) private void regenerateIDButton_Click(object sender, RoutedEventArgs e)
@ -506,6 +488,24 @@ namespace NovetusLauncher
ToggleServerOptions(); ToggleServerOptions();
} }
#endregion
#region Functions
public void LoadMapDesc()
{
if (mapsBox.SelectedNode == null)
return;
if (File.Exists(GlobalPaths.RootPath + @"\\" + mapsBox.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt"))
{
mapsDescBox.Text = mapsBox.SelectedNode.Text + ": " + File.ReadAllText(GlobalPaths.RootPath + @"\\" + mapsBox.SelectedNode.FullPath.Replace(".rbxl", "").Replace(".rbxlx", "") + "_desc.txt");
}
else
{
mapsDescBox.Text = mapsBox.SelectedNode.Text;
}
}
public void ToggleServerOptions() public void ToggleServerOptions()
{ {
if (!hostPanelOpen) if (!hostPanelOpen)
@ -544,9 +544,12 @@ namespace NovetusLauncher
hostPanelOpen = false; hostPanelOpen = false;
} }
#endregion
} }
} }
#endregion
#region Storage Classes
//i hate these classes...... //i hate these classes......
public class ClientListItem public class ClientListItem
{ {
@ -561,4 +564,5 @@ namespace NovetusLauncher
public override string ToString() { return StyleName; } public override string ToString() { return StyleName; }
} }
#endregion
} }

View File

@ -1,5 +1,5 @@
 
namespace NovetusLauncher.Forms.LauncherForm.Stylish namespace NovetusLauncher
{ {
partial class LauncherFormStylishServerInfo partial class LauncherFormStylishServerInfo
{ {
@ -30,16 +30,22 @@ namespace NovetusLauncher.Forms.LauncherForm.Stylish
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LauncherFormStylishServerInfo)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LauncherFormStylishServerInfo));
this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.ServerInfo = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// richTextBox1 // ServerInfo
// //
this.richTextBox1.Location = new System.Drawing.Point(12, 12); this.ServerInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.richTextBox1.Name = "richTextBox1"; | System.Windows.Forms.AnchorStyles.Left)
this.richTextBox1.Size = new System.Drawing.Size(776, 426); | System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.TabIndex = 0; this.ServerInfo.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.richTextBox1.Text = ""; this.ServerInfo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ServerInfo.Location = new System.Drawing.Point(12, 12);
this.ServerInfo.Multiline = true;
this.ServerInfo.Name = "ServerInfo";
this.ServerInfo.ReadOnly = true;
this.ServerInfo.Size = new System.Drawing.Size(776, 426);
this.ServerInfo.TabIndex = 0;
// //
// LauncherFormStylishServerInfo // LauncherFormStylishServerInfo
// //
@ -47,16 +53,18 @@ namespace NovetusLauncher.Forms.LauncherForm.Stylish
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(152)))), ((int)(((byte)(200))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(152)))), ((int)(((byte)(200)))));
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.richTextBox1); this.Controls.Add(this.ServerInfo);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "LauncherFormStylishServerInfo"; this.Name = "LauncherFormStylishServerInfo";
this.Text = "Server Information"; this.Text = "Server Information";
this.Load += new System.EventHandler(this.LauncherFormStylishServerInfo_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.TextBox ServerInfo;
} }
} }

View File

@ -1,19 +1,26 @@
using System; #region Usings
using System.Collections.Generic; using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
#endregion
namespace NovetusLauncher.Forms.LauncherForm.Stylish namespace NovetusLauncher
{ {
#region LauncherForm - Stylish - ServerInfo
public partial class LauncherFormStylishServerInfo : Form public partial class LauncherFormStylishServerInfo : Form
{ {
#region Constructor
public LauncherFormStylishServerInfo() public LauncherFormStylishServerInfo()
{ {
InitializeComponent(); InitializeComponent();
} }
#endregion
#region Form Events
private async void LauncherFormStylishServerInfo_Load(object sender, EventArgs e)
{
await LauncherFormShared.LoadServerInformation(ServerInfo);
}
#endregion
} }
#endregion
} }