Exemplo n.º 1
0
        /// <summary>
        /// parse an xml node
        /// </summary>
        /// <param name="xnod"></param>
        /// <param name="level"></param>
        public override void LoadFromXml(XmlNode xnod, int level, atomCollection all_atoms)
        {
            if (xnod.Name == "ID")
                atom_ID = Convert.ToInt64(xnod.InnerText);

            if (xnod.Name == "Members")
            {
                String[] IDs = xnod.InnerText.Split(',');
                for (int i = 0; i < IDs.Length; i++)
                {
                    long ID = Convert.ToInt64(IDs[i]);
                    if (all_atoms != null)
                    {
                        atom atm = all_atoms.GetID(ID);
                        Add(atm);
                    }
                }
            }

            // call recursively on all children of the current node
            if (xnod.HasChildNodes)
            {
                XmlNode xnodWorking = xnod.FirstChild;
                while (xnodWorking != null)
                {
                    LoadFromXml(xnodWorking, level + 1);
                    xnodWorking = xnodWorking.NextSibling;
                }
            }
        }