public static void StartUDPServer() { int UDPErrorCount = 0; //ini the UDPClient UdpClient Client = null; try { SomethingNewRecources.GlobalLogbox("Starting UDP Server on port : " + SomethingNewRevision2.port_Global.ToString()); Client = new UdpClient(int.Parse(Pulling.StartingPort)); } catch (Exception UDPError) { SomethingNewRecources.GlobalLogbox("There was an error starting the UDP Server : " + UDPError); UDPErrorCount++; throw; } while (UDPErrorCount < 3) { //TODO Change this mehthod but this is the best thig i have so far IPEndPoint UDPServer = new IPEndPoint(IPAddress.Any, SomethingNewRevision2.port_Global); byte[] Packet = Client.Receive(ref UDPServer); SomethingNewRecources.GlobalLogbox("Command Recieved : " + Encoding.ASCII.GetString(Packet)); //TODO add a message saying that this is an invalid command to the logbox but i have to do somthing from EXECUTION.cs } }
//TODO Find another way to get the IP other than web string pulling private static void SetPublicIP() { Form1.LogBox.AppendText("Getting External IP" + Environment.NewLine); try { string ExtIp = new WebClient().DownloadString("http://icanhazip.com"); PublicIP = ExtIp.ToString(); } catch (Exception exception) { SomethingNewRecources.GlobalLogbox("There was an error with getting the public IP the error was : " + exception); } }
public static void Startup() { Pulling.GetNetData(); Form1.toolStripStatusLabel2.Text = "Getting Card File Information... Please Wait..."; Form1.toolStripStatusLabel2.Text = Pulling.Oem_Label; if (Form1.toolStripStatusLabel2.Text == "") { StartError(); } Form1.LogBox.AppendText("SomethingNew Revision 2.1 Loading" + Environment.NewLine); if (File.Exists("LessConnectServerInfo.card")) { //Do nothing } else { try { /* * Testing Encryption of card File */ SomethingNewRecources.GlobalLogbox("Making a Network Card File..."); File.Create("lessConnectServerInfo.card"); //Adding Default Server Information StreamWriter ServerFile = new StreamWriter("LessConnectServerInfo.LessInfo"); //Starting Port ServerFile.WriteLine(4525); ServerFile.WriteLine("OEM Verified BETA"); EncryptCardFile("", "", ""); SomethingNewRecources.GlobalLogbox("Network Card File Created Succesfully!"); } catch (Exception e) { SomethingNewRecources.GlobalLogbox("There Was a problem Making the Card file for the networking : " + e); throw; } } }
public static void StartError() { SomethingNewRecources.GlobalLogbox("There Was a problem reading the card file."); }