コード例 #1
0
        AccountDataObject ReadXmlBuildAccountData(string xml_str)
        {
            string fname = ""; string lname = ""; string datecreated = "";

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(xml_str);

            XmlNodeList parentNode2 = xmlDoc.GetElementsByTagName("account");

            foreach (XmlNode childrenNode2 in parentNode2)
            {
                datecreated = (childrenNode2.SelectSingleNode("created_at").InnerText);
            }

            XmlNodeList parentNode = xmlDoc.GetElementsByTagName("account_holder");

            foreach (XmlNode childrenNode in parentNode)
            {
                fname = (childrenNode.SelectSingleNode("first_name").InnerText);
                lname = (childrenNode.SelectSingleNode("last_name").InnerText);
            }

            AccountDataObject accountObject = new AccountDataObject(fname, lname, datecreated);

            return(accountObject);
        }
コード例 #2
0
        /// <summary>
        /// Gets a player's account by its nickname or ID.
        /// </summary>
        /// <param name="playerId"></param>
        /// <param name="accountNameOrId"></param>
        /// <returns></returns>
        public Promise <AccountDataObject> GetAccount(ulong playerId, string accountNameOrId)
        {
            return(new Promise <AccountDataObject>((result, reject) =>
            {
                GetAccounts(playerId)
                .Then(accounts =>
                {
                    AccountDataObject account = null;
                    if (long.TryParse(accountNameOrId, out var accountId))
                    {
                        account = accounts.FirstOrDefault(a => a.Id == accountId);
                    }
                    else
                    {
                        account = accounts.FirstOrDefault(a => a.Nickname.StartsWith(accountNameOrId));
                    }

                    if (account == null)
                    {
                        reject(new Exception($"Unable to find account with a name or id of {accountNameOrId}."));
                        return;
                    }

                    result(account);
                });
            }));
        }
コード例 #3
0
        ActionResult _ACCOUNTFUINC(string XML)
        {
            AccountDataObject AccountOBJ = ReadXmlBuildAccountData(XML);

            return(View(AccountOBJ));
        }