Пример #1
0
        /// <summary>
        /// Parses a replica from the element
        /// </summary>
        /// <param name="xe">The replica element</param>
        private void processReplica(XmlElement xe)
        {
            ObjectReplica rep = new ObjectReplica();

            foreach (XmlNode repnode in xe.ChildNodes)
            {
                if (!(repnode is XmlElement))
                {
                    continue;
                }
                XmlElement repelement = (XmlElement)repnode;
                string     tagName    = repelement.LocalName;
                if ("id".Equals(tagName))
                {
                    rep.Id = repelement.InnerText;
                }
                else if ("type".Equals(tagName))
                {
                    rep.ReplicaType = repelement.InnerText;
                }
                else if ("current".Equals(tagName))
                {
                    rep.Current = repelement.InnerText.Equals("true");
                }
                else if ("location".Equals(tagName))
                {
                    rep.Location = repelement.InnerText;
                }
                else if ("storageType".Equals(tagName))
                {
                    rep.StorageType = repelement.InnerText;
                }
                else
                {
                    throw new EsuException("Unknown replica child: " + tagName);
                }
            }
            this.Replicas.Add(rep);
        }
Пример #2
0
        /// <summary>
        /// Parses a replica from the element
        /// </summary>
        /// <param name="xe">The replica element</param>
        private void processReplica(XmlElement xe)
        {
            ObjectReplica rep = new ObjectReplica();
            foreach (XmlNode repnode in xe.ChildNodes)
            {
                if (!(repnode is XmlElement))
                {
                    continue;
                }
                XmlElement repelement = (XmlElement)repnode;
                string tagName = repelement.LocalName;
                if ("id".Equals(tagName))
                {
                    rep.Id = repelement.InnerText;
                }
                else if ("type".Equals(tagName))
                {
                    rep.ReplicaType = repelement.InnerText;
                }
                else if ("current".Equals(tagName))
                {
                    rep.Current = repelement.InnerText.Equals("true");
                }
                else if ("location".Equals(tagName))
                {
                    rep.Location = repelement.InnerText;
                }
                else if ("storageType".Equals(tagName))
                {
                    rep.StorageType = repelement.InnerText;
                }
                else
                {
                    throw new EsuException("Unknown replica child: " + tagName);
                }

            }
            this.Replicas.Add(rep);
        }