public Transmitter(RegionCastPlugin mod) { string configPath = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "RegionCast-DiscordGameSDK" + Path.DirectorySeparatorChar + "config.txt"; string[] config = File.ReadAllLines(configPath); AttemptToMakeEndpoint(config, mod); }
void AttemptToMakeEndpoint(string[] config, RegionCastPlugin mod) { int port; try { port = Convert.ToInt32(config[0]); } catch (FormatException) { Debug.LogError("RegionCast : first line of RegionCast-DiscordGameSDK\\config.txt " + "(port number) could not be formatted to an int."); UnityEngine.Object.Destroy(mod.GetComponent <RegionCastPlugin>()); return; } endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), port); }