Exemple #1
0
 public static string CharacterDetails(string character)
 {
     RequestCharacter req = new RequestCharacter()
     {
         RequestedCharacter = character,
         SessionId = SessionId,
         UserId = UserId
     };
     try
     {
         string wrURI = baseServerTarget + "characterdetails";
         string msg = req.ToString();
         WebRequest wreq = WebRequest.Create(wrURI + "?message=" + msg);
         wreq.Method = "POST";
         wreq.ContentLength = 0;
         WebResponse wresp = wreq.GetResponse();
         using (TextReader sr = new StreamReader(wresp.GetResponseStream()))
         {
             XmlSerializer xml = new XmlSerializer(typeof(string), StringNamespace);
             string resp = (string)xml.Deserialize(sr);
             return resp;
         }
     }
     catch
     {
         return String.Empty;
     }
 }
Exemple #2
0
        public string CharacterDetails(string message)
        {
            RequestCharacter upd = new RequestCharacter(message);
            Account acct = Account.LoadAccount(upd.UserId);
            if(acct == null)
            {
                return String.Empty;
            }
            string ip = (OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty).Address;
            if (acct.SessionId != upd.SessionId || acct.Address != ip)
            {
                return "Error: incorrect address or session Id";
            }
            acct.KeepAlive();

            Character cha = acct.LoadCharacter(upd.RequestedCharacter);
            if(cha != null)
            {
                return cha.ToString();
            }
            return String.Empty;
        }
Exemple #3
0
        public string ListCharacters(string message)
        {
            RequestCharacter upd = new RequestCharacter(message);
            Account acct = Account.LoadAccount(upd.UserId);
            if (acct == null)
            {
                return String.Empty;
            }
            string ip = (OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty).Address;
            if (acct.SessionId != upd.SessionId || acct.Address != ip)
            {
                return "Error: incorrect address or session Id";
            }
            acct.KeepAlive();

            StringBuilder str = new StringBuilder();
            foreach(string cha in acct.Characters)
            {
                str.Append(cha);
                str.Append("|");
            }
            return str.ToString();
        }