Exemple #1
0
        private IEnumerable <DescrittorePartita> ReadDescrittorePartita()
        {
            List <DescrittorePartita> descrittori = new List <DescrittorePartita>();
            XmlElement rootElement = (XmlElement)_xmlDocument.SelectSingleNode("Descrittori");

            if (rootElement == null)
            {
                throw new IOException("Invalid Format Exception");
            }

            foreach (XmlNode elemento in rootElement.ChildNodes)
            {
                if (elemento.LocalName != "Descrittore")
                {
                    throw new IOException("Invalid Format Exception - Descrittore non valido");
                }
                DescrittorePartita s = new DescrittorePartita();
                if ((s.IdPartita = ((XmlElement)elemento).GetAttribute("idPartita")) == null)
                {
                    throw new IOException("Invalid Format Exception - Attributo non valido");
                }
                if ((s.Nome = ((XmlElement)elemento).GetAttribute("nome")) == null)
                {
                    throw new IOException("Invalid Format Exception - Attributo non valido");
                }
                if ((s.NomeMaster = ((XmlElement)elemento).GetAttribute("master")) == null)
                {
                    throw new IOException("Invalid Format Exception - Attributo non valido");
                }
                if ((s.IpMaster = ((XmlElement)elemento).GetAttribute("ipMaster")) == null)
                {
                    throw new IOException("Invalid Format Exception - Attributo non valido");
                }
                if ((s.Descrizione = ((XmlElement)elemento).GetAttribute("descrizione")) == null)
                {
                    throw new IOException("Invalid Format Exception - Attributo non valido");
                }
                if ((s.Password = ((XmlElement)elemento).GetAttribute("password")) == null)
                {
                    throw new IOException("Invalid Format Exception - Attributo non valido");
                }
                s.Stato = (StatoPartita)Int32.Parse(((XmlElement)elemento).GetAttribute("stato"));

                descrittori.Add(s);
            }
            return(descrittori);
        }
Exemple #2
0
 public virtual void LeavePartita(object sender, EventArgs e)
 {
     _currentDescrittore = null;
     _mainForm.AllowJoin = true;
 }
Exemple #3
0
 public DescrittorePartitaView(DescrittorePartita desc) : this()
 {
     Descrittore = desc;
 }
Exemple #4
0
 public virtual void JoinPartita(DescrittorePartita descrittore)
 {
     _mainForm.AllowJoin = false;
     _currentDescrittore = descrittore;
 }