Ejemplo n.º 1
0
            public void ReadXml(XmlReader r)
            {
                while (r.MoveToNextAttribute())
                {
                    if (r.Name == "appid")
                    {
                        appid = r.Value;
                    }
                    else if (r.Name == "version")
                    {
                        version = r.Value;
                    }
                    else if (r.Name == "nextversion")
                    {
                        nextversion = r.Value;
                    }
                    else if (r.Name == "lang")
                    {
                        lang = r.Value;
                    }
                    else if (r.Name == "brand")
                    {
                        brand = r.Value;
                    }
                    else if (r.Name == "client")
                    {
                        client = r.Value;
                    }
                    else if (r.Name == "installage")
                    {
                        installage = Int32.Parse(r.Value);
                    }
                }

                while (r.Read())
                {
                    if (r.NodeType == XmlNodeType.Element)
                    {
                        if (r.Name == "updatecheck")
                        {
                            updatecheck = new UpdateCheck();
                            XmlReader s = r.ReadSubtree();
                            s.Read();
                            updatecheck.ReadXml(s);
                            s.Close();
                        }
                        else if (r.Name == "ping")
                        {
                            ping = new PingRequest();
                            XmlReader s = r.ReadSubtree();
                            s.Read();
                            ping.ReadXml(s);
                            s.Close();
                        }
                        else if (r.Name == "event")
                        {
                            if (events == null)
                            {
                                events = new List <EventReport>();
                            }
                            EventReport e_rpt = new EventReport();
                            XmlReader   s     = r.ReadSubtree();
                            s.Read();
                            e_rpt.ReadXml(s);
                            s.Close();
                            events.Add(e_rpt);
                        }
                        else if (r.Name == "data")
                        {
                            if (data == null)
                            {
                                data = new List <DataRequest>();
                            }
                            DataRequest d_rpt = new DataRequest();
                            XmlReader   s     = r.ReadSubtree();
                            s.Read();
                            d_rpt.ReadXml(s);
                            s.Close();
                            data.Add(d_rpt);
                        }
                    }
                }
            }