Exemplo n.º 1
0
        public static WudaoOpponent Parse(XElement node)
        {
            try
            {
                WudaoOpponent rst = new WudaoOpponent();
                rst.Rank = Tools.GetXmlAttributeInt(node, "rank");

                XElement content = node.Element("root");
                rst.GameTime = Tools.GetXmlAttributeDate(content, "time");
                foreach (var rnode in content.Elements("role"))
                {
                    rst.Team.Add(Role.Parse(rnode));
                }

                if (content.Attribute("menpai") != null)
                {
                    rst.Menpai = content.Attribute("menpai").Value;
                }
                if (content.Attribute("round") != null)
                {
                    rst.Round = Tools.GetXmlAttributeInt(content, "round");
                }
                if (content.Attribute("say") != null)
                {
                    rst.Say = Tools.GetXmlAttribute(content, "say");
                }
                rst.UUID = content.Attribute("uuid").Value;
                return(rst);
            }catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                return(null);
            }
        }
Exemplo n.º 2
0
        private List <WudaoOpponent> ParseWudaoResult(string content)
        {
            List <WudaoOpponent> rst      = new List <WudaoOpponent>();
            XElement             rootNode = XElement.Parse(content);
            int rank = Tools.GetXmlAttributeInt(rootNode, "rank");

            RuntimeData.Instance.Rank = rank;

            if (rootNode.Element("save") == null)
            {
                return(rst);
            }
            foreach (var node in rootNode.Elements("save"))
            {
                rst.Add(WudaoOpponent.Parse(node));
            }
            return(rst);
        }
Exemplo n.º 3
0
        //WebClient wudaoWebClient = new WebClient();

        public void BeatWudaoOpponent(WudaoOpponent opp)
        {
            WebClient webClient = new WebClient();

            webClient.OpenReadAsync(new Uri(BEAT_URL + RuntimeData.Instance.UUID + "&opp=" + opp.UUID));
        }