public static string Main1(string u) { string ss=""; ServerClient s = new ServerClient(); ss= Convert.ToString(s.DoQuery(u, true)); return ss; }
internal void Connect(string addressString) { System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding("BasicHttpBinding_Server"); System.ServiceModel.EndpointAddress address = new System.ServiceModel.EndpointAddress(Config.ServerBaseAddress(addressString)); client = new ServerClient(binding, address); LoadRemoteShares(); }
public static void AddClient(ServerClient client) { lock (m_servers.SyncRoot) { if (m_servers.Contains(client)) return; m_servers.Add(client, client); } }
public static void RemoveClient(ServerClient client) { lock (m_servers.SyncRoot) { if (m_servers.Contains(client) == false) return; m_servers.Remove(client); } }
public ProxyRoom(int roomId, int orientRoomId, IGamePlayer[] players, ServerClient client) { m_roomId = roomId; m_orientRoomId = orientRoomId; m_players = new List<IGamePlayer>(); m_players.AddRange(players); m_client = client; // GetBaseProperty(); }
public static ServerClient[] GetAllClient() { ServerClient[] list = null; lock (m_servers.SyncRoot) { list = new ServerClient[m_servers.Count]; m_servers.Keys.CopyTo(list, 0); } return list; }
private static void Main(string[] args) { var serverClient = new ServerClient(); serverClient.Connect(); var chatClient = serverClient.GetChatClient(); var message = chatClient.Echo("I am so damn good!"); serverClient.Disconnect(); Console.WriteLine("Connection was successful!"); Console.WriteLine("Server returned: {0}", message); Console.ReadLine(); }
public void Run() { while (true) { Socket socket = Listener.AcceptSocket(); lock (this) { ServerClient client = new ServerClient(socket, this); client.OnConnect(); client.Run(); Clients.Add(client); } } }
public ProxyPlayer(ServerClient client, PlayerInfo character, ItemTemplateInfo currentWeapon, ItemInfo secondweapon, double baseAttack, double baseDefence, double baseAglilty, double baseBoold, double gprate, double offerrate, double rate, List<BufferInfo> infos, int serverid) { m_client = client; m_character = character; m_baseAttack = baseAttack; m_baseDefence = baseDefence; m_baseAglilty = baseAglilty; m_baseBlood = baseBoold; m_currentWeapon = currentWeapon; m_secondWeapon = secondweapon; m_equipEffect = new List<int>(); GPRate = gprate; OfferRate = offerrate; Rate = rate; Buffers = infos; m_serverid = serverid; }
public RemoteBulkInsertOperation(BulkInsertOptions options, ServerClient client) { this.client = client; items = new BlockingCollection<RavenJObject>(options.BatchSize*8); string requestUrl = "/bulkInsert?"; if (options.CheckForUpdates) requestUrl += "checkForUpdates=true"; if (options.CheckReferencesInIndexes) requestUrl += "&checkReferencesInIndexes=true"; // this will force the HTTP layer to authenticate, meaning that our next request won't have to HttpJsonRequest req = client.CreateRequest("POST", requestUrl + "&no-op=for-auth-only", disableRequestCompression: true); req.ExecuteRequest(); httpJsonRequest = client.CreateRequest("POST", requestUrl, disableRequestCompression: true); // the request may take a long time to process, so we need to set a large timeout value httpJsonRequest.Timeout = TimeSpan.FromHours(6); nextTask = httpJsonRequest.GetRawRequestStream() .ContinueWith(task => { Stream requestStream = task.Result; while (true) { var batch = new List<RavenJObject>(); RavenJObject item; while (items.TryTake(out item, 200)) { if (item == null) // marker { FlushBatch(requestStream, batch); return; } batch.Add(item); if (batch.Count >= options.BatchSize) break; } FlushBatch(requestStream, batch); } }); }
private void OnIncomingData(ServerClient c, string data) { Debug.Log("Server: " + data); string[] aData = data.Split('|'); switch (aData[0]) { case "Username": c.clientName = aData[1]; c.isHost = (aData[2] == "0") ? false : true; BroadCast("UserDisconnected |" + c.clientName, clients); break; case "Spawn": BroadCast2("HostHasSpawned |" + aData[0] + CL.returnCharID("Ragna")); BroadCast2("ClientHasSpawned |" + aData[1] + CL.returnCharID("Jin")); break; case "Move": // BroadCast("PlayerIsMovin |"); break; } }
public async Task <IActionResult> LoginAsync(String emailAddress, String password) { if (emailAddress == null || password == null) { ViewBag.Message = "All fields are required, please try again!"; return(View("LoginPage")); } else { var baseUri = new Uri(urlString); var serverClient = new ServerClient(urlString); LoginInfo loginInfo = new LoginInfo(emailAddress, password); login_user = await serverClient.LoginAsync(loginInfo); String pwd = login_user.pwd; String userName = login_user.userName; int userID = login_user.userID; double balance = login_user.balance; if (pwd.Equals("noExist")) { return(RegisterPage()); } else if (pwd.Equals("wrong")) { return(WrongPwd()); } else { String record_login = "******"; Log log_login = new Log(login_user.userID, record_login); await serverClient.RecordLog(log_login); return(await AfterLoginAsync()); } } }
/// <summary> /// Remove a ServerClient object from a Channel's subscriber list. /// </summary> /// <param name="channel">The Channel from which the Client should be removed.</param> /// <param name="clientGuid">The GUID of the ServerClient that should be removed from the channel.</param> /// <returns>Boolean indicating success or failure.</returns> public bool RemoveChannelSubscriber(Channel channel, string clientGuid) { if (channel == null) { return(false); } if (String.IsNullOrEmpty(clientGuid)) { return(false); } lock (_ChannelsLock) { Channel curr = _Channels.FirstOrDefault(c => c.Value.ChannelGUID.ToLower().Equals(channel.ChannelGUID.ToLower())).Value; if (curr == null || curr == default(Channel)) { return(false); } ServerClient sc = curr.Subscribers.FirstOrDefault(m => m.ClientGUID.ToLower().Equals(clientGuid.ToLower())); if (sc == null || sc == default(ServerClient)) { return(false); } if (curr.Subscribers != null && curr.Subscribers.Count > 0) { List <ServerClient> updated = curr.Subscribers.Where(m => !m.ClientGUID.ToLower().Equals(clientGuid.ToLower())).ToList(); curr.Subscribers = updated; _Channels.Remove(curr.ChannelGUID); _Channels.Add(curr.ChannelGUID, curr); return(true); } return(false); } }
/// <summary> /// Adds a ServerClient object to a Channel as a subscriber. /// </summary> /// <param name="channel">The Channel.</param> /// <param name="client">The ServerClient.</param> /// <returns>Boolean indicating success or failure.</returns> public bool AddChannelSubscriber(Channel channel, ServerClient client) { if (channel == null) { return(false); } if (client == null) { return(false); } lock (_ChannelsLock) { Channel curr = _Channels.FirstOrDefault(c => c.Value.ChannelGUID.ToLower().Equals(channel.ChannelGUID.ToLower())).Value; if (curr == null || curr == default(Channel)) { return(false); } ServerClient sc = curr.Subscribers.FirstOrDefault(m => m.ClientGUID.ToLower().Equals(client.ClientGUID.ToLower())); if (sc == null || sc == default(ServerClient)) { curr.Subscribers.Add(client); _Channels.Remove(curr.ChannelGUID); _Channels.Add(curr.ChannelGUID, curr); } else { curr.Subscribers.Remove(sc); curr.Subscribers.Add(client); _Channels.Remove(curr.ChannelGUID); _Channels.Add(curr.ChannelGUID, curr); } } return(true); }
/* Function that Reads from the Client */ private void OnIncomingData(ServerClient c, string data) { //Debug for incoming data (server) Debug.Log("Server: " + data); /* Process Data */ //Debug.Log(c.clientName +" : " +data); //debug place holder //Debug.Log("Data: " + data); string[] aData = data.Split('|'); switch (aData[0]) { case "CWHO": c.clientName = aData[1]; c.isHost = (aData[2] == "0") ? false : true; //tells server which client is host or not; 3rd index of aData is host value Broadcast("SCNN|" + c.clientName, clients); break; //case "CMOV": // if (aData[2] == "1") // Broadcast("SMOV|" + aData[1] +"|" +aData[2], clients); // break; case "P1": Broadcast("SMOV|" + aData[1], clients[1]); break; case "P2": Broadcast("SMOV|" + aData[1], clients[0]); break; case "CJUMP": Broadcast("SJUMP", clients); break; } }
void hilo(object t) { var token = (CancellationToken)t; while (!token.IsCancellationRequested) { if (!conectado) { try { var ip = Configuracion.GetConfiguracion("IpServidor"); var puerto = Configuracion.GetConfiguracion("PuertoServidor"); var retorno = new ServerClient(ip, int.Parse(puerto)); sesion.Server = retorno; sesion.Server.Connect += server_Connect; sesion.Server.Disconnect += server_Disconnect; sesion.Server.DBRespuesta += server_DBRespuesta; var msg = new MsgConexion() { From = guid.ToString(), Mensaje = "conectar", Fecha = DateTime.Now }; msg.To.Add(guid.ToString()); sesion.Server.SendToServer(msg); break; } catch (Exception ex) { } } Thread.Sleep(5000); } }
private static void SyncDisks() { _computer = JsonLocalDatabase.Instance.Computer; //var disks = _computer.Disks.Where(d => !d.Synced).Select(d => d.ToResourceModel(_computer.ComputerId)).ToList(); var disks = _computer.Disks; if (disks.All(d => d.Synced)) { return; } LocalLogger.Log($"Syncing {disks.Count}."); var client = new ServerClient(); var response = client.PostToServer(Settings.ApiUrl, "api/Disks", disks.Select(d => d.ToResourceModel(_computer.ComputerId)).ToList(), _jsonWebToken); //LocalLogger.Log(response); if (!response.IsSuccessStatusCode) { return; } var returnDisks = response.Content.ReadAsAsync <List <DiskResource> >().Result.Select(d => d.ToLocal()).ToList(); _computer.Disks = returnDisks; JsonLocalDatabase.Instance.Computer = _computer; }
private void OnConnection(int conId) { // Add the player to a list. When a player joins the // server, tell them their ID and request their name. // And send the name of all the other players. ServerClient c = new ServerClient(); c.connectionId = conId; c.playerName = "TEMP"; clients.Add(c); string msg = "ASKNAME|" + conId + '|'; foreach (ServerClient sc in clients) { msg += sc.playerName + '%' + sc.connectionId + '|'; } msg = msg.Trim('|'); // ASKNAME|3|DAVE%1|BOB%2|TEMP%3 Send(msg, reliableChannel, conId); }
// Callback method for listening for tcp clients void AcceptTcpClient(IAsyncResult result) { // Get the listener TcpListener listener = (TcpListener)result.AsyncState; string allUsers = ""; // Loop through all currrently connected clients foreach (ServerClient i in clients) { // Append with client name allUsers += i.clientName + '|'; } // Get the connected clien from the listener ServerClient connectedClient = new ServerClient(listener.EndAcceptTcpClient(result)); // Add newly connected client to the list clients.Add(connectedClient); // Continue lsitening for more clients StartListening(); // Broadcast to all clients that there is a newly connected client Broadcast("SWHO|" + allUsers, connectedClient); }
private void OnConnection(int cnnID) { // add him to a list ServerClient c = new ServerClient(); c.connectionID = cnnID; c.PlayerName = "TEMP"; clients.Add(c); // when the player joins the server, tell him his ID // request his name and send the name of all the other players string msg = "ASKNAME|" + cnnID + "|"; foreach (ServerClient sc in clients) { msg += sc.PlayerName + '%' + sc.connectionID + '|'; } msg = msg.Trim('|'); // ASKNAME|3|DAVE%1|MICH%2 Send(msg, reliableChannelID, cnnID); }
private void OnConnection(int cnnId) { //Add too a list ServerClient c = new ServerClient(); c.connectionId = cnnId; c.playerName = "TEMP"; clients.Add(c); //Notify them of their Id //Request name and send the name of all the other players string msg = "ASKNAME|" + cnnId + "|"; foreach (ServerClient sc in clients) { msg += sc.playerName + "%" + sc.connectionId + "|"; } msg = msg.Trim('|'); //ASKNAME|3|DAVE%1|MICHAEL%2|TEMP%3 Send(msg, reliableChannel, cnnId); }
private void AcceptTcpClient(IAsyncResult ar) { TcpListener listener = (TcpListener)ar.AsyncState; string allUsers = ""; foreach (ServerClient i in clients) { allUsers += i.clientName + '|'; } try { ServerClient sc = new ServerClient(listener.EndAcceptTcpClient(ar)); clients.Add(sc); StartListening(); Broadcast("Server:WhoIsThere|" + allUsers, clients[clients.Count - 1]); } catch (Exception e) { Debug.Log("Server AcceptTcpClient error: " + e.Message); } }
private void AcceptTcpClient(IAsyncResult ar) { TcpListener listener = (TcpListener)ar.AsyncState; if (listener == server) { //Debug.Log("this listener is the server"); //Debug.Log("now player's index is " + _GameManager.Instance.PlayerIndex); } else { Debug.Log("this Listener is not the server"); } string UniqueId = System.Guid.NewGuid().ToString(); ServerClient sc = new ServerClient(listener.EndAcceptTcpClient(ar), UniqueId); clients.Add(sc); BroadCast("SWho|" + UniqueId, sc);//clients[clients.Count -1]可以替换为sc //BroadCast("SNUM|" + clients.Count.ToString(), clients);//同步目前连着的人的总数 SynchronizePlayer(); StartListening(); }
private void OnConnection(int cnnId) { //Add him to a list ServerClient c = new ServerClient(); c.connectionId = cnnId; c.playerName = "TEMP"; clients.Add(c); //When the player joins give him a id //Request his name string msg = "ASKNAME|" + cnnId + "|"; //Also send the name of all the other players foreach (ServerClient sc in clients) { msg += sc.playerName + '%' + sc.connectionId + '|'; } //trimming the last pipe msg = msg.Trim('|'); //Now to send the message Send(msg, reliableChannel, cnnId); }
public void OnSocketListenerMessageReceiveConnectEx(ServerClient client, ServiceDesc desc) { var clientId = desc.ClientId; var characterId = desc.CharacterId; //ClientRouting server; if (desc.ServiceType == 2) { //连接的是Gate var gateGuid = (int)clientId; client.UserData = gateGuid; GateProxy gateProxy; if (mGates.TryGetValue(gateGuid, out gateProxy)) { gateProxy.Gate = client; } else { mGates[gateGuid] = new GateProxy { Gate = client }; } } }
private void OnConnection(int cnnId) { // add them to a list ServerClient c = new ServerClient(); c.connectionId = cnnId; c.playerName = "TEMP"; clients.Add(c); //when player joins server, tell them the ID //request name and send name of all other players string msg = "ASKNAME|" + cnnId + "|"; foreach (ServerClient sc in clients) { msg += sc.playerName + '%' + sc.connectionId + '|'; } msg = msg.Trim('|'); // ASKNAME|3|DAVE%1|MICHHAEL%2|TEMP%3 Send(msg, reliableChannel, cnnId); }
private void OnSelectPeriodDeleteButtonClicked(object sender, RoutedEventArgs e) { SelectPeriodSelectWindow window = new SelectPeriodSelectWindow((start, end) => { MessageBoxResult result = MessageBox.Show("선택한 기간에 포함된 강의도 삭제 할까요?\n(강의가 삭제되면 선택되지 않았던 기간에서도 삭제 됩니다)", "기간 삭제 확인", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); if (result == MessageBoxResult.Cancel) { MessageBox.Show("취소되었습니다", "삭제 취소", MessageBoxButton.OK, MessageBoxImage.Information); } else { try { ServerClient.getInstance().reservationDeletePeriod(start, end, result == MessageBoxResult.Yes); MessageBox.Show("삭제에 성공 했습니다.", "", MessageBoxButton.OK, MessageBoxImage.Information); refresh(); } catch (ServerResult ex) { MessageBox.Show("알 수 없는 오류로 삭제에 실패 했습니다.", "", MessageBoxButton.OK, MessageBoxImage.Error); } refresh(); } }); window.ShowInTaskbar = false; window.ShowDialog(); }
public RemoteBulkInsertOperation(BulkInsertOptions options, ServerClient client) { this.options = options; this.client = client; items = new BlockingCollection<RavenJObject>(options.BatchSize*8); string requestUrl = "/bulkInsert?"; if (options.CheckForUpdates) requestUrl += "checkForUpdates=true"; if (options.CheckReferencesInIndexes) requestUrl += "&checkReferencesInIndexes=true"; var expect100Continue = client.Expect100Continue(); // this will force the HTTP layer to authenticate, meaning that our next request won't have to HttpJsonRequest req = client.CreateRequest("POST", requestUrl + "&op=generate-single-use-auth-token", disableRequestCompression: true); var token = req.ReadResponseJson(); httpJsonRequest = client.CreateRequest("POST", requestUrl, disableRequestCompression: true); // the request may take a long time to process, so we need to set a large timeout value httpJsonRequest.PrepareForLongRequest(); httpJsonRequest.AddOperationHeader("Single-Use-Auth-Token", token.Value<string>("Token")); nextTask = httpJsonRequest.GetRawRequestStream() .ContinueWith(task => { try { expect100Continue.Dispose(); } catch (Exception) { } WriteQueueToServer(task); }); }
//Чтение с сервера private void OnIncomingData(ServerClient c, string data) { Debug.Log("Server:" + data); string[] aData = data.Split('|'); switch (aData [0]) { case "CWHO": c.clientName = aData [1]; c.isHost = (aData [2] == "0") ? false : true; Broadcast("SCNN|" + c.clientName, clients); break; case "CMOV": Broadcast("SMOV|" + aData[1] + "|" + aData[2] + "|" + aData[3] + "|" + aData[4], clients); break; case "CMSG": Broadcast("SMSG|" + c.clientName + " : " + aData[1], clients); break; } }
//leer y enviar datos en el menu principal private async Task ReadAsync(ServerClient clients) { if (clients?.tcp == null) { return; } _manualReset.WaitOne(); if (!clients.GetisInGame()) { NetworkStream networkStream = clients.tcp.GetStream(); if (networkStream.DataAvailable) { StreamReader streamReader = new StreamReader(networkStream, true); string data = await streamReader.ReadLineAsync(); if (data != null) { await OnIncomingDataAsync(clients, data); } } } }
private void OnIncomingData(ServerClient c, string data) // server read - parse incoming data { print("Server: " + data); string[] aData = data.Split('|'); // parse first parameter switch (aData[0]) { case "CWHO": c.clientName = aData[1]; c.isHost = (aData[2] == "0") ? false : true; Broadcast("SCNN|" + c.clientName + "|" + GameManager.Instance.numPlayers.ToString(), clients); // tell all users a new users has just connected break; case "CMOV": Broadcast(data, clients); break; case "CTRB": Broadcast(data, clients); break; } }
private void OnFrame(ServerClient channel, MessageFrame frame) { if (frame.SequenceNumber == 65535) { _batchCounter++; Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss.fff") + " " + (_batchCounter * 65535) + " messages."); } if (frame.Payload != null) { if (frame.Payload.ToString()[0] == 'm') { Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss.fff") + " done"); var buffer = Encoding.ASCII.GetBytes("completed"); channel.Send(new MessageFrame(buffer)); } } else if (frame.PayloadBuffer.Array[1] == 'm') { Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss.fff") + " done"); var buffer = Encoding.ASCII.GetBytes("completed"); channel.Send(new MessageFrame(buffer)); } }
public override void Execute(ServerClient client, string[] args) { if (client.Account == null || !client.Account.Role.Equals("admin")) { client.SendMessage("§2That command is admin only!"); return; } if (args.Length != 1) { SendUsage(client); return; } string username = args[0]; if (ClientRepository.Instance.Find(username) == null) { client.SendMessage("§2No client found with that username."); return; } ClientRepository.Instance.Find(username).Disconnect("§2Kicked from server."); client.SendMessage("§4" + username + " was kicked from the server."); }
private void OnIncomingData(ServerClient c, string data) { /* * if (data.Contains("&NAME")) * { * c.clientName = data.Split('|')[1]; * Broadcast(c.clientName + " has connected", clients); * Broadcast("Clients connected>>>" + clients.Count.ToString(), clients); * * return; * } * //&STARTGAME| * if (data == "&STARTGAME") * { * Broadcast("START", clients); * return; * } * Debug.Log(c.clientName + " sent: " + data); * //Broadcast("<b>"+c.clientName + ": </b>"+data, clients); * Broadcast(c.clientName + ": " + data, clients); */ Debug.Log(c.clientName + " sent: " + data); CommandReader.instance.ServerReadCommand(this, c, data); }
//-----------------------------------------------------SocketListener------------------------ //客户端链接进来时 private void OnSocketListenerConnectedEx(ServerClient sender) { int i = 0; if (BlackList.TryGetValue(((IPEndPoint)sender.RemoteEndPoint).Address, out i)) { //sender.SendMessage(new ServiceDesc{Type = (byte)MessageType.DROP, ClientId = 30}); sender.Disconnect(); return; } sender.MessageReceived += OnSocketListenerMessageReceivedEx; var clientId = GetUniqueClientId((uint)mId, sender.ClientId); //Logger.Fatal("Gate Connect ------ 1---{0} -- {1}", DateTime.Now.ToBinary(), clientId); var characterInfo = new CharacterInfoEx(); characterInfo.mState = GateClientState.NotAuthorized; characterInfo.ClientId = clientId; Logger.Info("Client: " + clientId + " connected."); sender.UserData = characterInfo; mFromClientId2Client.AddOrUpdate(characterInfo.ClientId, sender, (l, arg2) => sender); }
private void OnMyPosition(int connID, string[] splitData) { // Check if the split data size is greater than 2 if (splitData.Length > 2) { // Parse the data from split data float posX = float.Parse(splitData[1]); float posY = float.Parse(splitData[2]); float velX = float.Parse(splitData[3]); float velY = float.Parse(splitData[4]); float rotZ = float.Parse(splitData[5]); float rotW = float.Parse(splitData[6]); // Find the server client ServerClient sc = clients.Find(c => c.connectionID == connID); // If we have data, then the player is alive sc.isAlive = true; // Update the position, velocity, and rotation we have stored sc.playerPosition = new Vector2(posX, posY); sc.playerVelocity = new Vector2(velX, velY); sc.playerRotation = new Quaternion(0, 0, rotZ, rotW); } // Otherwise, the player has no avatar, set position, velocity and rotation to null else { // Find the server client ServerClient sc = clients.Find(c => c.connectionID == connID); // If we don't have data, then the player is not alive sc.isAlive = false; // Don't update positions, no need } }
private void RegisterClient(ClientJoinEvent e) { ServerClient client = new ServerClient(e.Client, e.User.ID); BroadCast(new Packet(Packet.Target.SERVER, Packet.Target.ALL, Packet.Type.REGISTER_CLIENT, e.User)); Send(client, new Packet(Packet.Target.SERVER, Packet.Target.ACCESS_REQUESTER, Packet.Type.OK, new byte[2] { 2, e.User.ID }), true); client.Tcp.ReceiveBufferSize = 500; client.Tcp.SendBufferSize = 500; clients.Add(client.ID, client); Thread thread = new Thread(() => ClientInComingPacket(client)); thread.Start(); packetReceiveThread.Add(thread); }
private void OnConnection(int cnnId) { //Añadir a la lista ServerClient c = new ServerClient(); c.connectionId = cnnId; c.playerName = "TEMP"; clients.Add(c); //Despues de añadir el cliente al servidor //mandamos un cliente a los clientes string msg = "ASKNAME|" + cnnId + "|"; foreach (ServerClient sc in clients) { msg += sc.playerName + "%" + sc.connectionId + '|'; } msg = msg.Trim('|'); ToLog("Sent to all clients -> " + msg); msg += "|" + Player1Balls + "|" + Player2Balls; Send(msg, reliableChannel, cnnId); }
private void OnConnection(int connectionId) { // Add user to a list ServerClient client = new ServerClient(); client.connectionId = connectionId; client.playerName = "TEMP"; clients.Add(client); // When the platey joins the server, tell him his id // Reequest his name and send the name of all the other players string message = "ASKNAME|" + connectionId + "|"; foreach (var serverClient in clients) { message += serverClient.connectionId + "%" + serverClient.playerName + "|"; } message = message.Trim('|'); // Expected message: // ASKNAME|3|DAVE%1|LINA%2|TEMP%3 Send(message, reliableChannel, connectionId); }
public bool Process(ServerClient client) { if (client.State != ClientState.Playing) { return(false); } Player player = MapLogic.Instance.GetNetPlayer(client); if (player == null) { return(false); // huehue, same as "order error" in a2server.exe, except we just boot them } MapUnit unit = MapLogic.Instance.GetUnitByTag(Tag); // we can't do anything with units that don't belong to our player. if (unit.Player != player) { return(true); } unit.SetState(new PickupState(unit, X, Y)); return(true); }
//Server Read private void OnIncomingData(ServerClient c, string data) { Debug.Log("Server:" + data); string[] aData = data.Split('|'); switch (aData [0]) { //Client WHO? // CWHO| clientName| ishost case "CWHO": c.clientName = aData [1]; c.isHost = (aData [2] == "0") ? false : true; Broadcast("SCNN|" + c.clientName, clients); break; case "CFLIP": Broadcast("SFLIP|" + aData[1], clients); break; case "CARDS": Broadcast(data, clients); break; } }
public ShowCommand(ServerClient client) { this.client = client; }
public DisconnectCommand(ServerClient client) { this.client = client; }
public PackageSendLib(ServerClient client) { m_serverClient = client; }
public Operation(ServerClient serverClient, long id) { client = serverClient; this.id = id; }
public CreateRoomAction(IGamePlayer[] players,int oriendRoomId,ServerClient client) { m_players = players; m_orientRoomId = oriendRoomId; m_client = client; }
public override ChatType OnSay(string Message, ServerClient Client, bool teamChat) { string userIsInGroup = getUserGroup(Client.XUID); string lowMsg = Message.ToLower(); List<string> allowed_commands = getCommandsAllowedInGroup(userIsInGroup); if (!lowMsg.StartsWith("!")) { if(specialChat && !teamChat && groupHasSpecialSay(userIsInGroup)) { string formatString = getSpecialChatGroupString(userIsInGroup); ServerSay(string.Format(formatString, getUserGroup(Client.XUID), Client.Name, Message), true); return ChatType.ChatNone; } return ChatType.ChatContinue; } if (lowMsg.StartsWith("!getxuid")) //Can't be used in the permission plugin OH THE IRONY (or something?) { logCommand(Client.XUID, Client.Name, "!getxuid", true, userIsInGroup); TellClient(Client.ClientNum, "Your xuid is: \'" + Client.XUID + "\'.", true); return ChatType.ChatNone; } if (lowMsg.StartsWith("!gettype")) { logCommand(Client.XUID, Client.Name, "!gettype", true, userIsInGroup); TellClient(Client.ClientNum, "Your user type is: \'" + userIsInGroup + "\'.", true); return ChatType.ChatNone; } if (lowMsg.StartsWith("!help") || lowMsg.StartsWith("!cmdlist")) { logCommand(Client.XUID, Client.Name, "!help", true, userIsInGroup); string msg = "You can use the following commands^1:^7 "; for (int i = 0; i < allowed_commands.Count; i++) { if (i == (allowed_commands.Count - 2)) msg += allowed_commands[i] + "^1 and^7 "; else if (i == (allowed_commands.Count - 1)) msg += allowed_commands[i] + "^1."; else msg += allowed_commands[i] + "^1,^7 "; } TellClient(Client.ClientNum, msg, true); return ChatType.ChatNone; } if (!checkCommandExist(lowMsg.Split(' ')[0])) { TellClient(Client.ClientNum, "^1That command doesn't exist.", true); return ChatType.ChatNone; } //if (allowed_commands.Contains(lowMsg.Split(' ')[0])) if(canUseCommand(lowMsg.Split(' ')[0], userIsInGroup)) { logCommand(Client.XUID, Client.Name, lowMsg.Split(' ')[0], true, userIsInGroup); return ChatType.ChatContinue; } else { logCommand(Client.XUID, Client.Name, lowMsg.Split(' ')[0], false, userIsInGroup); TellClient(Client.ClientNum, "^1You aren't allowed to use that command!", true); return ChatType.ChatNone; } }
public NameCommand(ServerClient client) { Client = client; }
public PackageHandlers(ServerClient client) { m_client = client; }
public ChatCommand(ServerClient client) { this.client = client; }
protected virtual void InitializeInternal() { ReplicationInformer replicationInformer = new ReplicationInformer(this.Conventions); this.databaseCommandsGenerator = (Func<IDatabaseCommands>) (() => { ServerClient local_0 = new ServerClient(this.Url, this.Conventions, this.credentials, replicationInformer, this.jsonRequestFactory, DocumentStore.currentSessionId); if (string.IsNullOrEmpty(this.DefaultDatabase)) return (IDatabaseCommands) local_0; else return local_0.ForDatabase(this.DefaultDatabase); }); this.asyncDatabaseCommandsGenerator = (Func<IAsyncDatabaseCommands>) (() => { AsyncServerClient local_0 = new AsyncServerClient(this.Url, this.Conventions, this.credentials, this.jsonRequestFactory, DocumentStore.currentSessionId); if (string.IsNullOrEmpty(this.DefaultDatabase)) return (IAsyncDatabaseCommands) local_0; else return local_0.ForDatabase(this.DefaultDatabase); }); }
public void OnDisconnect(ServerClient client) { Clients.Remove(client); }