Esempio n. 1
0
 public SIMCommon.UserProfile UserRef(string username)
 {
     try
     {
         var request  = new SIMCommon.Requests.UserRef(username);
         var response = JsonConvert.DeserializeObject <SIMCommon.Responses.UserRef>(this.SendEncryptedRequest(request));
         return(response.Profile);
     }
     catch (InvalidResponseException)
     {
         return(null);
     }
 }
Esempio n. 2
0
        private string RequestHandler(IPAddress address, SIMCommon.Requests.UserRef request)
        {
            SIMCommon.Responses.UserRef result;
            if (this.Database.UserExists(request.Username))
            {
                var user = this.Database.GetUser(this.Database.GetUserID(request.Username));
                result = new SIMCommon.Responses.UserRef(new SIMCommon.UserProfile(user.ID, user.Nickname));
            }
            else
            {
                result = new SIMCommon.Responses.UserRef(null);
            }

            return(JsonConvert.SerializeObject(result));
        }