public void Send(ProjectX_V3_Lib.Network.DataPacket packet) { if (Owner == null) return; Owner.Send(packet); }
public void SendToScreen(ProjectX_V3_Lib.Network.DataPacket packet) { if (Owner == null) return; Owner.SendToScreen(packet, true, false); }
public static bool HandleExchange(GameCrypto Crypto, ProjectX_V3_Lib.Network.SocketClient sClient, ProjectX_V3_Lib.Network.DataPacket Packet) { try { byte[] packet = Packet.Copy(); ushort position = 7; uint PacketLen = BitConverter.ToUInt32(packet, position); position += 4; int JunkLen = BitConverter.ToInt32(packet, position); position += 4; position += (ushort)JunkLen; int Len = BitConverter.ToInt32(packet, position); position += 4; byte[] pubKey = new byte[Len]; for (int x = 0; x < Len; x++) pubKey[x] = packet[x + position]; string PubKey = pubKey.GetString(); // System.Text.ASCIIEncoding.ASCII.GetString(pubKey); Crypto = Crypto.DHKeySequence.HandleClientKeyPacket(PubKey, Crypto); Crypto.Exchanged = true; return true; } catch { return false; } }
/// <summary> /// Called whenever the server shuts down CORRECT! /// </summary> /// <param name="sig"></param> /// <returns></returns> private static bool Console_CloseEvent(ProjectX_V3_Lib.Native.Kernel32.CtrlType sig) { AllowConnections = false; try { Shutdown(true); return true; } catch (Exception e) { Console.WriteLine(e.ToString()); return false; } }