Exemplo n.º 1
0
        public static Cleanup ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Cleanup cleanup = new Cleanup();

                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        string value = reader.ReadContentAsString();

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "interval": cleanup.Interval = Convert.ToInt32(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(cleanup);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Exemplo n.º 2
0
        public object Clone()
        {
            Cleanup clone = (Cleanup)this.MemberwiseClone();

            return(clone);
        }
Exemplo n.º 3
0
        public static Service ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Service service = new Service();

                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        string value = reader.ReadContentAsString();

                        if (value.Length > 0)
                        {
                            switch (reader.Name.ToLower())
                            {
                            case "access": service.Access = (ServiceAccess)ArcXmlEnumConverter.ToEnum(typeof(ServiceAccess), value); break;

                            case "name": service.Name = value; break;

                            case "servicegroup": service.ServiceGroup = value; break;

                            case "status": service.Status = (ServiceStatus)ArcXmlEnumConverter.ToEnum(typeof(ServiceStatus), value); break;

                            case "type": service.Type = value; break;

                            case "version": service.Version = value; break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                if (!reader.IsEmptyElement)
                {
                    reader.Read();

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case Cleanup.XmlName: service.Cleanup = Cleanup.ReadFrom(reader); break;

                            case Environment.XmlName: service.Environment = Environment.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(service);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }