Added proper UDP features. No proper implementation yet.
This commit is contained in:
parent
296a80fb86
commit
7b23076c85
|
|
@ -147,7 +147,8 @@ public static class GlobalVars
|
||||||
public static bool ReadyToLaunch = false;
|
public static bool ReadyToLaunch = false;
|
||||||
//server settings.
|
//server settings.
|
||||||
public static bool UPnP = false;
|
public static bool UPnP = false;
|
||||||
public static string Map = "";
|
public static bool UDP = true;
|
||||||
|
public static string Map = "";
|
||||||
public static string FullMapPath = "";
|
public static string FullMapPath = "";
|
||||||
public static int RobloxPort = 53640;
|
public static int RobloxPort = 53640;
|
||||||
public static int DefaultRobloxPort = 53640;
|
public static int DefaultRobloxPort = 53640;
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ public class LauncherFuncs
|
||||||
ini.IniWriteValue(section, "ReShade", GlobalVars.ReShade.ToString());
|
ini.IniWriteValue(section, "ReShade", GlobalVars.ReShade.ToString());
|
||||||
ini.IniWriteValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString());
|
ini.IniWriteValue(section, "QualityLevel", GlobalVars.QualityLevel.ToString());
|
||||||
ini.IniWriteValue(section, "OldLayout", GlobalVars.OldLayout.ToString());
|
ini.IniWriteValue(section, "OldLayout", GlobalVars.OldLayout.ToString());
|
||||||
|
ini.IniWriteValue(section, "UDP", GlobalVars.UDP.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -65,7 +66,7 @@ public class LauncherFuncs
|
||||||
string Decryptline1, Decryptline2, Decryptline3, Decryptline4,
|
string Decryptline1, Decryptline2, Decryptline3, Decryptline4,
|
||||||
Decryptline5, Decryptline6, Decryptline7, Decryptline9, Decryptline10,
|
Decryptline5, Decryptline6, Decryptline7, Decryptline9, Decryptline10,
|
||||||
Decryptline11, Decryptline12, Decryptline13, Decryptline14, Decryptline15,
|
Decryptline11, Decryptline12, Decryptline13, Decryptline14, Decryptline15,
|
||||||
Decryptline16, Decryptline17, Decryptline20, Decryptline21;
|
Decryptline16, Decryptline17, Decryptline20, Decryptline21, Decryptline22;
|
||||||
|
|
||||||
IniFile ini = new IniFile(cfgpath);
|
IniFile ini = new IniFile(cfgpath);
|
||||||
|
|
||||||
|
|
@ -216,6 +217,14 @@ public class LauncherFuncs
|
||||||
Decryptline21 = ini.IniReadValue(section, "OldLayout");
|
Decryptline21 = ini.IniReadValue(section, "OldLayout");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Decryptline22 = ini.IniReadValue(section, "UDP");
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(Decryptline21))
|
||||||
|
{
|
||||||
|
ini.IniWriteValue(section, "UDP", GlobalVars.UDP.ToString());
|
||||||
|
Decryptline21 = ini.IniReadValue(section, "UDP");
|
||||||
|
}
|
||||||
|
|
||||||
bool bline1 = Convert.ToBoolean(Decryptline1);
|
bool bline1 = Convert.ToBoolean(Decryptline1);
|
||||||
GlobalVars.CloseOnLaunch = bline1;
|
GlobalVars.CloseOnLaunch = bline1;
|
||||||
|
|
||||||
|
|
@ -275,6 +284,8 @@ public class LauncherFuncs
|
||||||
GlobalVars.QualityLevel = iline20;
|
GlobalVars.QualityLevel = iline20;
|
||||||
bool bline21 = Convert.ToBoolean(Decryptline21);
|
bool bline21 = Convert.ToBoolean(Decryptline21);
|
||||||
GlobalVars.OldLayout = bline21;
|
GlobalVars.OldLayout = bline21;
|
||||||
|
bool bline22 = Convert.ToBoolean(Decryptline22);
|
||||||
|
GlobalVars.UDP = bline22;
|
||||||
}
|
}
|
||||||
|
|
||||||
Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write);
|
Customization(GlobalVars.ConfigDir + "\\" + GlobalVars.ConfigNameCustomization, write);
|
||||||
|
|
@ -674,6 +685,7 @@ public class LauncherFuncs
|
||||||
GlobalVars.PlayerLimit = 12;
|
GlobalVars.PlayerLimit = 12;
|
||||||
GlobalVars.Custom_Extra_ShowHats = false;
|
GlobalVars.Custom_Extra_ShowHats = false;
|
||||||
GlobalVars.UPnP = false;
|
GlobalVars.UPnP = false;
|
||||||
|
GlobalVars.UDP = true;
|
||||||
GlobalVars.DisabledHelp = false;
|
GlobalVars.DisabledHelp = false;
|
||||||
GlobalVars.DiscordPresence = true;
|
GlobalVars.DiscordPresence = true;
|
||||||
GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap;
|
GlobalVars.MapPath = GlobalVars.MapsDir + @"\\" + GlobalVars.DefaultMap;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using LiteNetLib;
|
||||||
using Mono.Nat;
|
using Mono.Nat;
|
||||||
|
|
||||||
public static class UPnP
|
public static class UPnP
|
||||||
|
|
@ -42,4 +43,52 @@ public static class UPnP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class UDP
|
||||||
|
{
|
||||||
|
private static NetManager StartUDPListener(int port = -1)
|
||||||
|
{
|
||||||
|
if (GlobalVars.UDP == true)
|
||||||
|
{
|
||||||
|
EventBasedNetListener listener = new EventBasedNetListener();
|
||||||
|
NetManager list = new NetManager(listener);
|
||||||
|
if (port > -1)
|
||||||
|
{
|
||||||
|
list.Start(port);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NetManager StartClient(string ip, int port)
|
||||||
|
{
|
||||||
|
if (GlobalVars.UDP == true)
|
||||||
|
{
|
||||||
|
//we don't need a port here, we are a client.
|
||||||
|
NetManager client = StartUDPListener();
|
||||||
|
client.Connect(ip, port, "");
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NetManager StartServer(int port)
|
||||||
|
{
|
||||||
|
if (GlobalVars.UDP == true)
|
||||||
|
{
|
||||||
|
NetManager server = StartUDPListener(port);
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)SplashReader.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)SplashReader.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)TextLineRemover.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)TextLineRemover.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)TreeNodeHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)TreeNodeHelper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UPnP.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)NetFuncs.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)URI.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)URI.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)WebServer.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)WebServer.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -380,6 +380,7 @@ namespace NovetusLauncher
|
||||||
this.checkBox8.Text = "Toggle UDP Hole Punching (WIP)";
|
this.checkBox8.Text = "Toggle UDP Hole Punching (WIP)";
|
||||||
this.checkBox8.UseVisualStyleBackColor = true;
|
this.checkBox8.UseVisualStyleBackColor = true;
|
||||||
this.checkBox8.CheckedChanged += new System.EventHandler(this.checkBox8_CheckedChanged);
|
this.checkBox8.CheckedChanged += new System.EventHandler(this.checkBox8_CheckedChanged);
|
||||||
|
this.checkBox8.Click += new System.EventHandler(this.CheckBox4Click);
|
||||||
//
|
//
|
||||||
// label19
|
// label19
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -547,8 +547,15 @@ namespace NovetusLauncher
|
||||||
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort);
|
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort);
|
||||||
label37.Text = GlobalVars.IP;
|
label37.Text = GlobalVars.IP;
|
||||||
label38.Text = GlobalVars.RobloxPort.ToString();
|
label38.Text = GlobalVars.RobloxPort.ToString();
|
||||||
checkBox4.Checked = GlobalVars.UPnP;
|
if (GlobalVars.UDP == false && GlobalVars.UPnP == true)
|
||||||
checkBox2.Checked = GlobalVars.DiscordPresence;
|
{
|
||||||
|
checkBox4.Checked = GlobalVars.UPnP;
|
||||||
|
}
|
||||||
|
else if (GlobalVars.UDP == true && GlobalVars.UPnP == false)
|
||||||
|
{
|
||||||
|
checkBox8.Checked = GlobalVars.UDP;
|
||||||
|
}
|
||||||
|
checkBox2.Checked = GlobalVars.DiscordPresence;
|
||||||
checkBox5.Checked = GlobalVars.ReShade;
|
checkBox5.Checked = GlobalVars.ReShade;
|
||||||
checkBox6.Checked = GlobalVars.ReShadeFPSDisplay;
|
checkBox6.Checked = GlobalVars.ReShadeFPSDisplay;
|
||||||
checkBox7.Checked = GlobalVars.ReShadePerformanceMode;
|
checkBox7.Checked = GlobalVars.ReShadePerformanceMode;
|
||||||
|
|
@ -1576,7 +1583,7 @@ namespace NovetusLauncher
|
||||||
else if (checkBox4.Checked == false)
|
else if (checkBox4.Checked == false)
|
||||||
{
|
{
|
||||||
GlobalVars.UPnP = false;
|
GlobalVars.UPnP = false;
|
||||||
//checkBox8.Checked = GlobalVars.UDP;
|
checkBox8.Checked = GlobalVars.UDP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1874,7 +1881,16 @@ namespace NovetusLauncher
|
||||||
|
|
||||||
private void checkBox8_CheckedChanged(object sender, EventArgs e)
|
private void checkBox8_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (checkBox8.Checked == true)
|
||||||
}
|
{
|
||||||
|
GlobalVars.UDP = true;
|
||||||
|
checkBox4.Checked = false;
|
||||||
|
}
|
||||||
|
else if (checkBox8.Checked == false)
|
||||||
|
{
|
||||||
|
GlobalVars.UDP = false;
|
||||||
|
checkBox4.Checked = GlobalVars.UPnP;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -380,6 +380,7 @@ namespace NovetusLauncher
|
||||||
this.checkBox8.Text = "Toggle UDP\r\nHole Punching (WIP)";
|
this.checkBox8.Text = "Toggle UDP\r\nHole Punching (WIP)";
|
||||||
this.checkBox8.UseVisualStyleBackColor = true;
|
this.checkBox8.UseVisualStyleBackColor = true;
|
||||||
this.checkBox8.CheckedChanged += new System.EventHandler(this.checkBox8_CheckedChanged);
|
this.checkBox8.CheckedChanged += new System.EventHandler(this.checkBox8_CheckedChanged);
|
||||||
|
this.checkBox8.Click += new System.EventHandler(this.CheckBox4Click);
|
||||||
//
|
//
|
||||||
// label19
|
// label19
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -545,7 +545,14 @@ namespace NovetusLauncher
|
||||||
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort);
|
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.RobloxPort);
|
||||||
label37.Text = GlobalVars.IP;
|
label37.Text = GlobalVars.IP;
|
||||||
label38.Text = GlobalVars.RobloxPort.ToString();
|
label38.Text = GlobalVars.RobloxPort.ToString();
|
||||||
checkBox4.Checked = GlobalVars.UPnP;
|
if (GlobalVars.UDP == false && GlobalVars.UPnP == true)
|
||||||
|
{
|
||||||
|
checkBox4.Checked = GlobalVars.UPnP;
|
||||||
|
}
|
||||||
|
else if (GlobalVars.UDP == true && GlobalVars.UPnP == false)
|
||||||
|
{
|
||||||
|
checkBox8.Checked = GlobalVars.UDP;
|
||||||
|
}
|
||||||
checkBox2.Checked = GlobalVars.DiscordPresence;
|
checkBox2.Checked = GlobalVars.DiscordPresence;
|
||||||
|
|
||||||
ConsolePrint("Config loaded.", 3);
|
ConsolePrint("Config loaded.", 3);
|
||||||
|
|
@ -1542,7 +1549,7 @@ namespace NovetusLauncher
|
||||||
else if (checkBox4.Checked == false)
|
else if (checkBox4.Checked == false)
|
||||||
{
|
{
|
||||||
GlobalVars.UPnP = false;
|
GlobalVars.UPnP = false;
|
||||||
//checkBox8.Checked = GlobalVars.UDP;
|
checkBox8.Checked = GlobalVars.UDP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1793,10 +1800,18 @@ namespace NovetusLauncher
|
||||||
Application.Restart();
|
Application.Restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBox8_CheckedChanged(object sender, EventArgs e)
|
private void checkBox8_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (checkBox8.Checked == true)
|
||||||
|
{
|
||||||
}
|
GlobalVars.UDP = true;
|
||||||
}
|
checkBox4.Checked = false;
|
||||||
|
}
|
||||||
|
else if (checkBox8.Checked == false)
|
||||||
|
{
|
||||||
|
GlobalVars.UDP = false;
|
||||||
|
checkBox4.Checked = GlobalVars.UPnP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue