public Hotkey GetclientHotkey(ConnectedClientInfo client) { if (client.ClientId == Guid.Empty) { return(inputMan.GetFunctionHotkey(HotkeyFunction.SwitchToLocalInput)); } return(inputMan.GetClientHotkey(client.ClientId)); }
public void SetClientHotkey(ConnectedClientInfo client, Hotkey key) { if (client.ClientId == Guid.Empty) { inputMan.SetFunctionHotkey(key, HotkeyFunction.SwitchToLocalInput); ConfigManager.WriteConfig("HotkeyLocal", key.ToSettingsString()); return; } inputMan.SetUpdateClientHotkey(key, client.ClientId); ConfigManager.WriteConfig(client.ClientId.ToString() + "Hotkey", key.ToSettingsString()); }
public ConnectedClientInfo(string clientName, Guid clientId, IPAddress clientAddress, Hotkey key, ConnectedClientInfo leftClient, ConnectedClientInfo rightClient, ConnectedClientInfo aboveClient, ConnectedClientInfo belowClient) { ClientName = clientName; ClientId = clientId; ClientAddress = clientAddress; Key = key; if (leftClient == null) { LeftClient = None; } else { LeftClient = leftClient; } if (rightClient == null) { RightClient = None; } else { RightClient = rightClient; } if (belowClient == null) { BelowClient = None; } else { BelowClient = belowClient; } if (aboveClient == null) { AboveClient = None; } else { AboveClient = aboveClient; } }
private void TcpListener_ClientConnected(object sender, ClientConnectedArgs e) { ConnectedClient c = new ConnectedClient(e.ClientSocket, e.ClientName, e.ClientId); try { clientMan.AddClient(c); } catch (ClientManager.DuplicateNameException) { ISLogger.Write("Declining client {0}: Name already in use", c.ClientName); c.SendMessage(InputshareLib.Net.Messages.MessageType.ClientDuplicateName); c.Dispose(); return; } catch (ClientManager.DuplicateGuidException) { ISLogger.Write("Declining client {0}: Guid already in use", c.ClientName); c.SendMessage(InputshareLib.Net.Messages.MessageType.ClientDuplicateGuid); c.Dispose(); return; } catch (ClientManager.MaxClientsReachedException) { ISLogger.Write("Declining client {0}: Max clients reached", c.ClientName); c.SendMessage(InputshareLib.Net.Messages.MessageType.ClientLimitReached); c.Dispose(); return; } ApplyClientConfig(c.ClientGuid); c.SendMessage(InputshareLib.Net.Messages.MessageType.ServerOK); ISLogger.Write("{0} connected from {1}", e.ClientName, e.ClientSocket.RemoteEndPoint); ConnectedClientInfo info = CreateClientInfo(c, true); ClientConnected?.Invoke(this, CreateClientInfo(c, true)); c.ClipboardTextCopied += C_ClipboardTextCopied; c.ConnectionError += C_ConnectionError; c.ClientEdgeHit += OnAnyEdgeHit; }
public ConnectedClientInfo[] GetClients() { if (clientMan == null) { return new ConnectedClientInfo[1] { ConnectedClientInfo.None } } ; ConnectedClientInfo[] list = new ConnectedClientInfo[clientMan.AllClients.Length]; int index = 0; foreach (var client in clientMan.AllClients) { list[index] = CreateClientInfo(client, true); index++; } return(list); }
public ClientDisconnectedArgs(ConnectedClientInfo client, string reason) { Client = client; Reason = reason; }
public void SetClientEdge(ConnectedClientInfo clientA, BoundEdge sideof, ConnectedClientInfo clientB) { ConnectedClient a = null; if (clientA != null) { a = clientMan.GetClientFromGuid(clientA.ClientId); } ConnectedClient b = clientMan.GetClientFromGuid(clientB.ClientId); if (a == null) { switch (sideof) { case BoundEdge.Left: if (b.LeftClient != null) { b.LeftClient.RightClient = null; } break; case BoundEdge.Right: if (b.RightClient != null) { b.RightClient.LeftClient = null; } break; case BoundEdge.Bottom: if (b.BelowClient != null) { b.BelowClient.AboveClient = null; } break; case BoundEdge.Top: if (b.AboveClient != null) { b.AboveClient.BelowClient = null; } break; } } switch (sideof) { case BoundEdge.Bottom: b.BelowClient = a; if (a != null) { a.AboveClient = b; } break; case BoundEdge.Right: b.RightClient = a; if (a != null) { a.LeftClient = b; } break; case BoundEdge.Left: b.LeftClient = a; if (a != null) { a.RightClient = b; } break; case BoundEdge.Top: b.AboveClient = a; if (a != null) { a.BelowClient = b; } break; } if (a == null) { ISLogger.Write("Set None {0}of {1}", sideof, b.ClientName); } else { ISLogger.Write("Set {0} {1}of {2}", a.ClientName, sideof, b.ClientName); } DisplayConfigChanged(this, null); }