Added Server Information functionality to the Stylish style. add regions.
This commit is contained in:
parent
b9f1c64554
commit
237602849d
|
|
@ -232,6 +232,11 @@ public class GlobalFuncs
|
|||
Config(cfgpath, true);
|
||||
}
|
||||
|
||||
if (ResetMapIfNecessary())
|
||||
{
|
||||
Config(cfgpath, true);
|
||||
}
|
||||
|
||||
GlobalVars.UserConfiguration.GraphicsMode = (Settings.Mode)Convert.ToInt32(graphics);
|
||||
GlobalVars.UserConfiguration.ReShade = Convert.ToBoolean(reshade);
|
||||
GlobalVars.UserConfiguration.QualityLevel = (Settings.Level)Convert.ToInt32(qualitylevel);
|
||||
|
|
@ -265,6 +270,19 @@ public class GlobalFuncs
|
|||
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)
|
||||
{
|
||||
if (write)
|
||||
|
|
|
|||
|
|
@ -2,13 +2,9 @@
|
|||
using Mono.Nat;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
|
@ -273,34 +269,25 @@ namespace NovetusLauncher
|
|||
Application.Exit();
|
||||
}
|
||||
|
||||
public async Task ChangeTabs()
|
||||
public static async Task LoadServerInformation(TextBox box)
|
||||
{
|
||||
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();
|
||||
//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 = {
|
||||
//since we are async, DO THESE first or we'll clear out random stuff.
|
||||
box.Text = "Loading...";
|
||||
string IP = await SecurityFuncs.GetExternalIPAddressAsync();
|
||||
box.Text = "";
|
||||
string[] lines1 = {
|
||||
SecurityFuncs.Base64Encode((!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : IP)),
|
||||
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()),
|
||||
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient)
|
||||
};
|
||||
string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true);
|
||||
string[] lines2 = {
|
||||
string URI = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines1), true);
|
||||
string[] lines2 = {
|
||||
SecurityFuncs.Base64Encode("localhost"),
|
||||
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.RobloxPort.ToString()),
|
||||
SecurityFuncs.Base64Encode(GlobalVars.UserConfiguration.SelectedClient)
|
||||
};
|
||||
string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true);
|
||||
string[] text = {
|
||||
string URI2 = "novetus://" + SecurityFuncs.Base64Encode(string.Join("|", lines2), true);
|
||||
string[] text = {
|
||||
"Client: " + GlobalVars.UserConfiguration.SelectedClient,
|
||||
"IP: " + (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : IP),
|
||||
"Port: " + GlobalVars.UserConfiguration.RobloxPort.ToString(),
|
||||
|
|
@ -313,15 +300,30 @@ namespace NovetusLauncher
|
|||
URI2
|
||||
};
|
||||
|
||||
foreach (string str in text)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
ServerInfo.AppendText(str + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
ServerInfo.SelectionStart = 0;
|
||||
ServerInfo.ScrollToCaret();
|
||||
foreach (string str in text)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
box.AppendText(str + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
case TabPage pg3 when pg3 == Tabs.TabPages[TabPageClients]:
|
||||
string clientdir = GlobalPaths.ClientDir;
|
||||
|
|
@ -723,8 +725,6 @@ namespace NovetusLauncher
|
|||
{
|
||||
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
|
||||
|
||||
ResetMapIfNecessary();
|
||||
|
||||
CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch;
|
||||
PlayerIDTextBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
|
||||
PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString();
|
||||
|
|
@ -900,7 +900,7 @@ namespace NovetusLauncher
|
|||
|
||||
public void RefreshMaps()
|
||||
{
|
||||
ResetMapIfNecessary();
|
||||
GlobalFuncs.ResetMapIfNecessary();
|
||||
|
||||
Tree.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)
|
||||
{
|
||||
RestartLauncherAfterSetting(box.Checked, title, subText);
|
||||
|
|
|
|||
|
|
@ -1,27 +1,31 @@
|
|||
using System;
|
||||
#region Usings
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Integration;
|
||||
#endregion
|
||||
|
||||
namespace NovetusLauncher
|
||||
{
|
||||
#region LauncherForm - Stylish
|
||||
public partial class LauncherFormStylish : Form
|
||||
{
|
||||
#region Variables
|
||||
LauncherFormStylishInterface launcherFormStylishInterface1;
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
public LauncherFormStylish()
|
||||
{
|
||||
InitializeComponent();
|
||||
launcherFormStylishInterface1 = new LauncherFormStylishInterface(this);
|
||||
elementHost1.Child = launcherFormStylishInterface1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Form Events
|
||||
private void LauncherFormStylish_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
|
|
@ -88,7 +92,9 @@ namespace NovetusLauncher
|
|||
CloseEvent();
|
||||
Application.Exit();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
public void CloseEvent()
|
||||
{
|
||||
WriteConfigValues();
|
||||
|
|
@ -118,8 +124,6 @@ namespace NovetusLauncher
|
|||
{
|
||||
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
|
||||
|
||||
launcherFormStylishInterface1.launcherForm.ResetMapIfNecessary();
|
||||
|
||||
launcherFormStylishInterface1.minimizeOnLaunchBox.IsChecked = GlobalVars.UserConfiguration.CloseOnLaunch;
|
||||
launcherFormStylishInterface1.userIDBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
|
||||
launcherFormStylishInterface1.tripcodeLabel.Content = GlobalVars.UserConfiguration.PlayerTripcode.ToString();
|
||||
|
|
@ -211,5 +215,7 @@ namespace NovetusLauncher
|
|||
|
||||
launcherFormStylishInterface1.clientDescBox.Text = GlobalVars.UserConfiguration.SelectedClient + ": " + GlobalVars.SelectedClientInfo.Description;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,26 @@
|
|||
using System;
|
||||
#region Usings
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
#endregion
|
||||
|
||||
namespace NovetusLauncher
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for LauncherFormStylishInterface.xaml
|
||||
/// </summary>
|
||||
///
|
||||
#region LauncherForm - Stylish - Interface
|
||||
public partial class LauncherFormStylishInterface : System.Windows.Controls.UserControl
|
||||
{
|
||||
#region Variables
|
||||
public LauncherFormShared launcherForm;
|
||||
private System.Windows.Forms.TreeView _fieldsTreeCache;
|
||||
public LauncherFormStylish FormParent;
|
||||
private bool hostPanelOpen;
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
public LauncherFormStylishInterface(LauncherFormStylish parent)
|
||||
{
|
||||
_fieldsTreeCache = new System.Windows.Forms.TreeView();
|
||||
|
|
@ -45,7 +39,9 @@ namespace NovetusLauncher
|
|||
|
||||
hostPanelOpen = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Form Events
|
||||
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
|
|
@ -97,21 +93,6 @@ namespace NovetusLauncher
|
|||
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)
|
||||
{
|
||||
if (!IsLoaded)
|
||||
|
|
@ -242,7 +223,8 @@ namespace NovetusLauncher
|
|||
|
||||
private void serverInfoButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
LauncherFormStylishServerInfo info = new LauncherFormStylishServerInfo();
|
||||
info.Show();
|
||||
}
|
||||
|
||||
private void regenerateIDButton_Click(object sender, RoutedEventArgs e)
|
||||
|
|
@ -506,6 +488,24 @@ namespace NovetusLauncher
|
|||
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()
|
||||
{
|
||||
if (!hostPanelOpen)
|
||||
|
|
@ -544,9 +544,12 @@ namespace NovetusLauncher
|
|||
|
||||
hostPanelOpen = false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Storage Classes
|
||||
//i hate these classes......
|
||||
public class ClientListItem
|
||||
{
|
||||
|
|
@ -561,4 +564,5 @@ namespace NovetusLauncher
|
|||
|
||||
public override string ToString() { return StyleName; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
namespace NovetusLauncher.Forms.LauncherForm.Stylish
|
||||
namespace NovetusLauncher
|
||||
{
|
||||
partial class LauncherFormStylishServerInfo
|
||||
{
|
||||
|
|
@ -30,16 +30,22 @@ namespace NovetusLauncher.Forms.LauncherForm.Stylish
|
|||
private void InitializeComponent()
|
||||
{
|
||||
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();
|
||||
//
|
||||
// richTextBox1
|
||||
// ServerInfo
|
||||
//
|
||||
this.richTextBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.Size = new System.Drawing.Size(776, 426);
|
||||
this.richTextBox1.TabIndex = 0;
|
||||
this.richTextBox1.Text = "";
|
||||
this.ServerInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ServerInfo.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
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
|
||||
//
|
||||
|
|
@ -47,16 +53,18 @@ namespace NovetusLauncher.Forms.LauncherForm.Stylish
|
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(152)))), ((int)(((byte)(200)))));
|
||||
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.Name = "LauncherFormStylishServerInfo";
|
||||
this.Text = "Server Information";
|
||||
this.Load += new System.EventHandler(this.LauncherFormStylishServerInfo_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.TextBox ServerInfo;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
#region Usings
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
#endregion
|
||||
|
||||
namespace NovetusLauncher.Forms.LauncherForm.Stylish
|
||||
namespace NovetusLauncher
|
||||
{
|
||||
#region LauncherForm - Stylish - ServerInfo
|
||||
public partial class LauncherFormStylishServerInfo : Form
|
||||
{
|
||||
#region Constructor
|
||||
public LauncherFormStylishServerInfo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Form Events
|
||||
private async void LauncherFormStylishServerInfo_Load(object sender, EventArgs e)
|
||||
{
|
||||
await LauncherFormShared.LoadServerInformation(ServerInfo);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue