コード例 #1
0
        public void Execute()
        {
            if (String.IsNullOrEmpty(this.ApiRequest.ClientAlertsAuthToken))
            {
                throw new ApplicationException("Invalid call to Login. The ClientAlerts authentication token is null or empty.");
            }

            Logger.Log(LogLevel.Info, "Logging into ClientAlerts...");

            string url = String.Format(this.UrlBase + @"?callname=Login&ClientAlertsAuthToken={0}", EscapeParam(this.ApiRequest.ClientAlertsAuthToken));

            string responseJson = null;

            try
            {
                responseJson = this.JsonWebService.Call(url);
            }
            catch
            {
                this.Logger.Log(LogLevel.Error, "An exception occurred while calling the Login web service.");
                throw;
            }

            try
            {
                JsonDeserializer deserializer = new JsonDeserializer();
                this.ApiResponse = deserializer.DeSerialiseObject <LoginResponseType>(responseJson);
            }
            catch
            {
                Logger.Log(LogLevel.Error, "Failed to deserialise the following: {0}", responseJson);
                throw;
            }

            Logger.Log(LogLevel.Debug, "Login Ack {0}", this.ApiResponse.Ack);
        }
コード例 #2
0
 public static AuthenticationResponse InvalidLogin(LoginResponseType responseType)
 {
     return(new AuthenticationResponse {
         Success = false, ResponseType = responseType
     });
 }
コード例 #3
0
ファイル: Command.cs プロジェクト: jsdodgers/ICS168Swarch
        public static Command loginCommand(long ts, LoginResponseType t, GameState[] gss)
        {
            Command newCommand = new Command();
            newCommand.timeStamp = ts;
            newCommand.cType = CType.Login;
            newCommand.loginResponse = t;
            newCommand.message = newCommand.cType + ":" + t;
            newCommand.message += ":" + gss.Length;
            if((newCommand.loginResponse & LoginResponseType.SucceededLogin) != 0)
            {
                foreach (GameState gs in gss)
                {
                    newCommand.message += ":" + gs.roomName + ":" + gs.numberOfPlayers();
                }
            }

            newCommand.message += ";";

            return newCommand;
        }
コード例 #4
0
ファイル: NexoLogin.cs プロジェクト: pmespace/PMS.NEXO
 public NexoLogin() : base(MessageCategoryEnumeration.Login)
 {
     RequestItem = new LoginRequestType();
     ReplyItem   = new LoginResponseType();
 }
コード例 #5
0
 public static AuthenticationResponse InvalidLogin(LoginResponseType responseType)
 {
     return new AuthenticationResponse { Success = false, ResponseType = responseType };
 }