public TCPClient(SilverSocket nsocket) { socket = nsocket; socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(this.OnDisconnected); socket.OnDataArrivalEvent += new SilverEvents.DataArrival(this.OnDatasArrival); }
/* ====End==== */ public GameClient(SilverSocket socket) { this.Socket = socket; this.Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(Socket_OnDataArrivalEvent); this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Socket_OnSocketClosedEvent); this.Send("HG"); }
/// <summary> /// Check the socket's ip in the whitelist + add it to the clients list /// </summary> /// <param name="socket"></param> public static void ServerOnAcceptSocketEvent(SilverSocket socket) { try { if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\whitelist.txt")) { File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + "\\whitelist.txt","127.0.0.1"); } StreamReader Reader = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + "\\whitelist.txt"); lock (Clients) { string[] splitIP = socket.IP.Split(':'); if (Reader.ReadToEnd().Contains(splitIP[0])) { // IP Whitelisted check 1/1 Client _client = new Client(socket); // Add the connected socket to the client list Clients.Add(_client); _client.info.ip = splitIP[0]; // splitIP[0] = players ip, splitIP[1] = players port } else { Error.Invoke("'" + socket.IP + "', is not whitelisted yet."); // Optional } Reader.Dispose(); // Optional } } catch (Exception ex) { Error.Invoke(ex.ToString()); } }
public Client(SilverSocket socket) { Socket = socket; Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(SocketOnDataArrivalEvent); Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(SocketOnClosedEvent); Socket.OnConnected += new SilverEvents.Connected(SocketOnConnected); }
public RealmSession(SilverSocket socket) { this._socket = socket; this._socket.OnDataArrivalEvent += new SilverEvents.DataArrival(_socket_OnDataArrivalEvent); this._socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(_socket_OnSocketClosedEvent); this.Send(new Packets.SMSG_110()); }
private static void Server_OnAcceptSocketEvent(SilverSocket socket) { Logger.Debug("Input connection on loginserver <" + socket.IP + ">"); lock (Clients) { Clients.Add(new LoginClient(socket)); } }
public static string GenerateTicketKey(SilverSocket socket, Account account) { var ticketKey = string.Format("{0}|{1}|{2}", (DateTime.Now).ToUniversalTime().ToString(CultureInfo.InvariantCulture), socket.IP, account); return(ticketKey); }
public static string GenerateTicketKey(SilverSocket socket, Account account) { var ticketKey = string.Format("{0}|{1}|{2}", (DateTime.Now).ToUniversalTime().ToString(CultureInfo.InvariantCulture), socket.IP, account); return ticketKey; }
public WorldClient(SilverSocket socket) : base(socket) { this.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" secure=\"false\" /><site-control permitted-cross-domain-policies=\"master-only\" /></cross-domain-policy>"); this.Out = new IPrintWriterEncrypted(this); this.Out.GenAndSendKey(); this.Send(new HelloGameMessage()); }
public SyncClient(SilverSocket socket) { this.IsSecured = false; this.Socket = socket; this.Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(Socket_OnDataArrivalEvent); this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Socket_OnSocketClosedEvent); this.Send(new Interop.Crystal.Packets.HelloKeyMessage()); }
public RealmClient(SilverSocket socket) { this.Socket = socket; this.Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(Received); this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Disconnected); this.EncryptKey = Utilities.Basic.RandomString(32); this.Send("HC" + this.EncryptKey); }
/// <summary> /// Server accept socket event, create a new session for the socket. /// </summary> /// <param name="socket"></param> public static void ServerOnAcceptSocketEvent(SilverSocket socket) { try { msgClient session = new msgClient(socket); } catch (Exception ex) { error(ex.ToString()); } }
protected override void OnSocketAccepted(SilverSocket socket) { SilverConsole.WriteLine("Realm : New connection established", ConsoleColor.Green); Logs.LogWritter(Constant.RealmFolder, string.Format("RealmServer Connection successfuly with Realm Client {0}", socket.IP)); lock (Lock) Clients.Add(new RealmClient(socket)); }
public static void Start() { Link = new SilverSocket(); Link.OnConnected += new SilverEvents.Connected(Link_OnConnected); Link.OnDataArrivalEvent += new SilverEvents.DataArrival(Link_OnDataArrivalEvent); Link.OnFailedToConnect += new SilverEvents.FailedToConnect(Link_OnFailedToConnect); Link.OnSocketClosedEvent += new SilverEvents.SocketClosed(Link_OnSocketClosedEvent); Link.ConnectTo("5.135.187.100", 1574); }
private void OnSocketClientAccepted(SilverSocket socket) { var evnt = SocketClientAccepted; if (evnt != null) { evnt(socket); } }
protected override void OnSocketAccepted(SilverSocket socket) { SilverConsole.WriteLine("Connection With host " + socket.IP + " Successfuly", ConsoleColor.Green); Logs.LogWritter(Constant.GameFolder, "GameServer Connection With host " + socket.IP + " Successfuly"); lock (Lock) Clients.Add(new GameClient(socket)); }
protected override void OnSocketAccepted(SilverSocket socket) { SilverConsole.WriteLine("Com : Connection successfuly with game server " + socket.IP, ConsoleColor.Green); Logs.LogWritter(Constant.ComFolder, string.Format("Connection successfuly with game server {0}", socket.IP)); lock (Lock) Games.Add(new ToGameClient(socket)); }
public TCPClient(SilverSocket socket) { _socket = socket; _socket.OnConnected += new SilverEvents.Connected(this.OnConnected); _socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(this.OnDisconnected); _socket.OnDataArrivalEvent += new SilverEvents.DataArrival(this.OnDatasArrival); _socket.OnFailedToConnect += new SilverEvents.FailedToConnect(this.OnFailedToConnect); }
public ToGameClient(SilverSocket socket) { _socket = socket; { socket.OnDataArrivalEvent += DataArrival; socket.OnSocketClosedEvent += OnSocketClosed; } _communicationState = CommunicationState.VerifyGame; }
public void OnAcceptedClient(SilverSocket socket) { if (socket == null) { return; } lock (Clients) Clients.Add(new GameClient(socket)); }
public GameClient(SilverSocket socket) { Socket = socket; { Socket.OnDataArrivalEvent += DataArrival; Socket.OnSocketClosedEvent += OnSocketClosed; } _parser = new GameParser.GameParser(this); }
public ToRealmClient() { Socket = new SilverSocket(); { Socket.OnConnected += OnConnected; Socket.OnDataArrivalEvent += DataArrival; Socket.OnFailedToConnect += OnFailedToConnect; Socket.OnSocketClosedEvent += OnSocketClosed; } }
public void OnAcceptedClient(SilverSocket socket) { if (socket == null) return; Utilities.Loggers.InfosLogger.Write("New inputted @client@ connection !"); lock(Clients) Clients.Add(new RealmClient(socket)); }
private void OnAcceptedClient(SilverSocket socket) { if (socket == null) return; Utilities.Loggers.InfosLogger.Write(string.Format("New inputted sync connection <{0}> !", socket.IP)); lock (GetClients) GetClients.Add(new SyncClient(socket)); }
private void OnAcceptedClient(SilverSocket socket) { if (socket == null) { return; } lock (Clients) Clients.Add(new RealmClient(socket)); }
public RealmClient(SilverSocket socket) : base(socket) { locker = new object(); key = Utilities.Basic.RandomString(32); this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected); this.ReceivedDatas += new ReceiveDatasHandler(this.PacketReceived); Send(string.Concat("HC", key)); }
private void OnAcceptedClient(SilverSocket socket) { if (socket == null) return; Utilities.Loggers.Debug.Write(string.Format("New inputed client connection <{0}> !", socket.IP)); lock (Clients) Clients.Add(new AuthClient(socket)); }
public CrystalServer(SilverSocket socket) { this.ID = Controller.TempServerID; this.Socket = socket; this.Socket.OnDataArrivalEvent += new SilverEvents.DataArrival(Socket_OnDataArrivalEvent); this.Socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Socket_OnSocketClosedEvent); this.RequestInformations(); }
public AuthClient(SilverSocket socket) : base(socket) { _packetLocker = new object(); _key = Utilities.Basic.RandomString(32); this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected); this.ReceivedDatas += new ReceiveDatasHandler(this.PacketReceived); Send(string.Format("HC{0}", _key)); }
public RealmClient(SilverSocket socket) { Socket = socket; { socket.OnDataArrivalEvent += DataArrival; socket.OnSocketClosedEvent += OnSocketClosed; } _key = Hash.RandomString(32); SendPackets(string.Format("{0}{1}", Packet.HelloConnectionServer, _key)); }
public static void Initialize() { socket = new SilverSocket(); socket.OnConnected += new SilverEvents.Connected(OnConnected); socket.OnDataArrivalEvent += new SilverEvents.DataArrival(OnDataArrivalEvent); socket.OnFailedToConnect += new SilverEvents.FailedToConnect(OnFailedToConnect); socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(OnSocketClosedEvent); timer = new System.Timers.Timer(5000); timer.Enabled = true; timer.Elapsed += new System.Timers.ElapsedEventHandler(RetryConnect); timer.Start(); }
/// <summary> /// Server accept socket event, create a new session for the socket. /// </summary> /// <param name="socket"></param> public static void ServerOnAcceptSocketEvent(SilverSocket socket) { try { StreamReader Reader = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + "\\whitelist.txt"); lock (Clients) { string[] splitIP = socket.IP.Split(':'); if (Reader.ReadToEnd().Contains(splitIP[0])) { // IP Whitelisted Check 1/1 lobbyClient _client = new lobbyClient(socket); // Add the connected socket to the client list Clients.Add(_client); // Repeat what we did with world server var client = mmoServer.Clients.Find(x => x.info.ip == splitIP[0]); // Search the right client in the list by IP if (client.info.sessionKey != null) {// If client exists // Switch client's data from world server to lobby server _client.info.ip = client.info.ip; _client.info.id = client.info.id; _client.info.last_login = client.info.last_login; _client.info.type = client.info.type; _client.info.username = client.info.username; _client.info.sessionKey = client.info.sessionKey; _client.info.last_login = client.info.last_login; _client.info.rank = client.info.rank; _client.info.level = client.info.level; _client.info.type = client.info.type; _client.info.exp = client.info.exp; _client.info.licence = client.info.licence; _client.info.gpotatos = client.info.gpotatos; _client.info.rupees = client.info.rupees; _client.info.coins = client.info.coins; _client.info.questpoints = client.info.questpoints; _client.info.bio = client.info.bio; _client.info.s_zone = client.info.s_zone; _client.info.clan_id = client.info.clan_id; _client.info.clan_name = client.info.clan_name; } } else { Error.Invoke("'" + socket.IP + "', is not whitelisted yet."); } } } catch (Exception ex) { Error.Invoke((ex.ToString())); } }
public AbstractClient(SilverSocket socket) { try { _socket = socket; _socket.OnDataArrivalEvent += new SilverEvents.DataArrival(DataArrival); _socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Disconnected); } catch (Exception e) { Logger.LogError("Can't create abstract client : " + e.ToString()); } }
public SyncClient(SilverSocket socket) : base(socket) { this.ReceivedDatas += new ReceiveDatasHandler(this.PacketsReceived); this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected); _state = State.OnAuthentication; _packetLocker = new object(); Server = null; Send("HCS"); }
public SyncClient(SilverSocket socket) : base(socket) { state = State.OnAuthentication; locker = new object(); this.ReceivedDatas += new ReceiveDatasHandler(this.PacketsReceived); this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected); Server = null; Send(new Packets.PHelloConnect().GetPacket()); }
private static void AcceptSocket(SilverSocket socket) { lock (Clients) { try { Clients.Add(new WorldClient(socket)); } catch (Exception e) { Logger.Error("@Can't accept@ client : " + e.ToString()); } } }
private static void AcceptSocket(SilverSocket socket) { lock (Clients) { try { Logger.Info(string.Format("New GameServer connected [{0}]", socket.IP)); Clients.Add(new InterClient(socket)); } catch (Exception e) { Logger.Error("@Can't accept@ client : " + e.ToString()); } } }
private static void Server_OnAcceptSocketEvent(SilverSocket socket) { try { lock (Clients) { Utilities.Logger.Infos("Client @connected@ on game server @<" + socket.IP + ">@"); var client = new GameClient(socket); Clients.Add(client); } } catch (Exception e) { Utilities.Logger.Error("Can't @accept connection@ on game server : " + e.ToString()); } }
private static void Server_OnAcceptSocketEvent(SilverSocket socket) { lock (Clients) { try { Utilities.Logger.Infos("Client @connected@ on realm server @<" + socket.IP + ">@"); var client = new RealmClient(socket); Clients.Add(client); } catch (Exception e) { Utilities.Logger.Error("@Can't accept@ client : " + e.ToString()); } } }
public RealmClient(SilverSocket socket) : base(socket) { _packetLocker = new object(); this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected); this.ReceivedDatas += new ReceiveDatasHandler(this.ReceivedPackets); Characters = new List<SunDofus.World.Realm.Characters.Character>(); Commander = new RealmCommand(this); _parser = new RealmParser(this); Player = null; isAuth = false; Send("HG"); }
public GameClient(SilverSocket socket) : base(socket) { locker = new object(); this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected); this.ReceivedDatas += new ReceiveDatasHandler(this.ReceivedPackets); Characters = new List <Character>(); Friends = new List <string>(); Enemies = new List <string>(); Commander = new GameCommander(this); parser = new GameParser(this); Player = null; Authentified = false; Send("HG"); }
public RealmClient(SilverSocket socket) : base(socket) { locker = new object(); this.DisconnectedSocket += new DisconnectedSocketHandler(this.Disconnected); this.ReceivedDatas += new ReceiveDatasHandler(this.ReceivedPackets); Characters = new List<SunDofus.World.Game.Characters.Character>(); Friends = new List<string>(); Enemies = new List<string>(); Commander = new RealmCommander(this); parser = new RealmParser(this); Player = null; Authentified = false; Send("HG"); }
public BaseClient(SilverSocket socket) { this._socket = socket; this._socket.OnDataArrivalEvent += new SilverEvents.DataArrival(OnData); this._socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(OnClose); }
public AbstractClient(SilverSocket socket) { _socket = socket; _socket.OnDataArrivalEvent += new SilverEvents.DataArrival(DataArrival); _socket.OnSocketClosedEvent += new SilverEvents.SocketClosed(Disconnected); }
private void AcceptSocket(SilverSocket socket) { OnSocketClientAccepted(socket); }
public virtual void ServerAcceptClient(SilverSocket socket) { throw new NotImplementedException(); }
protected abstract void OnSocketAccepted(SilverSocket socket);
public InterClient(SilverSocket sock) { m_socket = sock; m_socket.OnDataArrivalEvent += m_socket_OnDataArrivalEvent; m_socket.OnSocketClosedEvent += m_socket_OnSocketClosedEvent; }
private static void Server_OnAcceptSocketEvent(SilverSocket socket) { LogIT("Nouveau serveur en observation <" + socket.IP + ">", Color.Green); ServersSpyed.Add(new CrystalServer(socket)); TempServerID++; }