From ff9b9f24664162a04ac8d932aeec9ae06f805b73 Mon Sep 17 00:00:00 2001 From: Quacky Date: Thu, 10 Aug 2017 23:36:08 -0500 Subject: [PATCH] portmapper stuff --- .../RBXLegacyLauncher/GlobalVars.cs | 1 - .../RBXLegacyLauncher/MainForm.cs | 28 ++++++------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/RBXLegacyLauncher/RBXLegacyLauncher/GlobalVars.cs b/RBXLegacyLauncher/RBXLegacyLauncher/GlobalVars.cs index 6bd0c70..460d5ff 100644 --- a/RBXLegacyLauncher/RBXLegacyLauncher/GlobalVars.cs +++ b/RBXLegacyLauncher/RBXLegacyLauncher/GlobalVars.cs @@ -18,7 +18,6 @@ public static int ServerPort = 53640; public static int DefaultRobloxPort = 53640; public static int PlayerLimit = 12; - public static string MyIP = "localhost"; // player settings public static int UserID = 0; public static string PlayerName = "Player"; diff --git a/RBXLegacyLauncher/RBXLegacyLauncher/MainForm.cs b/RBXLegacyLauncher/RBXLegacyLauncher/MainForm.cs index b18c637..9da5aad 100644 --- a/RBXLegacyLauncher/RBXLegacyLauncher/MainForm.cs +++ b/RBXLegacyLauncher/RBXLegacyLauncher/MainForm.cs @@ -9,7 +9,6 @@ using System.Reflection; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; -using System.Net; namespace RBXLegacyLauncher { @@ -110,8 +109,8 @@ namespace RBXLegacyLauncher void Button2Click(object sender, EventArgs e) { Process pmap = new Process(); - pmap.StartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Java -jar portmapper.jar"; - pmap.StartInfo.Arguments = "-add -externalPort" + GlobalVars.ServerPort + " -internalPort" + GlobalVars.ServerPort + "-ip" + GlobalVars.MyIP + " -protocol udp"; + pmap.StartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\bin\\java.exe"; + pmap.StartInfo.Arguments = "-jar upnp.jar -externalPort" + GlobalVars.ServerPort + " -internalPort" + GlobalVars.ServerPort + "-ip \"\localhost\" -protocol udp"; pmap.StartInfo.UseShellExecute = false; pmap.StartInfo.CreateNoWindow = true; pmap.Start(); @@ -190,17 +189,6 @@ namespace RBXLegacyLauncher label11.Text = version; GlobalVars.Version = version; ReadConfigValues(); - using (WebClient wc = new WebClient()) - { - try - { - GlobalVars.MyIP = wc.DownloadString("http://ipv4.icanhazip.com"); - } - catch (Exception) - { - GlobalVars.MyIP = "localhost" + Environment.NewLine; - } - } } void ReadConfigValues() @@ -890,8 +878,8 @@ namespace RBXLegacyLauncher if (command.Equals("rbxlegacy server")) { Process pmap = new Process(); - pmap.StartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Java -jar portmapper.jar"; - pmap.StartInfo.Arguments = "-add -externalPort" + GlobalVars.ServerPort + " -internalPort" + GlobalVars.ServerPort + "-ip" + GlobalVars.MyIP + " -protocol udp"; + pmap.StartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\bin\\java.exe"; + pmap.StartInfo.Arguments = "-jar upnp.jar -externalPort" + GlobalVars.ServerPort + " -internalPort" + GlobalVars.ServerPort + "-ip \"\localhost\" -protocol udp"; pmap.StartInfo.UseShellExecute = false; pmap.StartInfo.CreateNoWindow = true; pmap.Start(); @@ -900,8 +888,8 @@ namespace RBXLegacyLauncher else if (command.Equals("rbxlegacy server no3d")) { Process pmap = new Process(); - pmap.StartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Java -jar portmapper.jar"; - pmap.StartInfo.Arguments = "-add -externalPort" + GlobalVars.ServerPort + " -internalPort" + GlobalVars.ServerPort + "-ip" + GlobalVars.MyIP + " -protocol udp"; + pmap.StartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\bin\\java.exe"; + pmap.StartInfo.Arguments = "-jar upnp.jar -externalPort" + GlobalVars.ServerPort + " -internalPort" + GlobalVars.ServerPort + "-ip \"\localhost\" -protocol udp"; pmap.StartInfo.UseShellExecute = false; pmap.StartInfo.CreateNoWindow = true; pmap.Start(); @@ -910,8 +898,8 @@ namespace RBXLegacyLauncher else if (command.Equals("rbxlegacy no3d")) { Process pmap = new Process(); - pmap.StartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Java -jar portmapper.jar"; - pmap.StartInfo.Arguments = "-add -externalPort" + GlobalVars.ServerPort + " -internalPort" + GlobalVars.ServerPort + "-ip" + GlobalVars.MyIP + " -protocol udp"; + pmap.StartInfo.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\bin\\java.exe"; + pmap.StartInfo.Arguments = "-jar upnp.jar -externalPort" + GlobalVars.ServerPort + " -internalPort" + GlobalVars.ServerPort + "-ip \"\localhost\" -protocol udp"; pmap.StartInfo.UseShellExecute = false; pmap.StartInfo.CreateNoWindow = true; pmap.Start();