private void HandleWelcomeMessage(string msg) { MessageWelcome welcomeMsg = (MessageWelcome)JsonConvert.DeserializeObject(msg, typeof(MessageWelcome)); ServerVersion = welcomeMsg.Server_Version; // We have some autologin going, ignore welcome message if (autologinKey != null) { return; } switch (welcomeMsg.AuthMethod) { // AuthMethod: User&Password or Both case 1: case 3: MessageIdentify identificationMessage = new MessageIdentify(); identificationMessage.Authenticate = new Authenticate(AuthenticationInformation.Username, AuthenticationInformation.GetPassword()); SendCommand(identificationMessage); break; // AuthMethod: Passcode case 2: Log.Warn("WifiRemoteClient: Passcode authentication not yet implemented"); break; // AuthMethod: None case 0: default: SendCommand(new MessageIdentify()); break; } }
/// <summary> /// Constructor. /// Initialise and setup the socket server. /// </summary> public SocketServer(UInt16 port) { _welcomeMessage = new MessageWelcome(); _port = port; _instance = this; InitSocket(); }