private EzeResult login(LoginMode mode, string userName, string passkey) { Console.WriteLine("...Login User <" + mode + ":" + userName + ":" + passkey + ">"); LoginInput loginInput = LoginInput.CreateBuilder() .SetLoginMode(MapLoginMode(mode)) .SetUsername(userName) .SetPasskey(passkey).Build(); ApiInput apiInput = ApiInput.CreateBuilder() .SetMsgType(ApiInput.Types.MessageType.LOGIN) .SetMsgData(loginInput.ToByteString()).Build(); this.send(apiInput); EzeResult result = null; while (true) { result = this.getResult(this.receive()); if (result.getEventName() != EventName.LOGIN) { continue; } if ((result.getStatus().ToString() == com.eze.ezecli.ApiOutput.Types.ResultStatus.FAILURE.ToString())) { throw new EzeException("Login failed. " + result.ToString()); } break; } Console.WriteLine("2......" + result); return(result); }