Esempio n. 1
0
        public static GcInput ReadFrom(ArcXmlReader reader)
        {
            try
            {
                GcInput gcInput = new GcInput();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "description": gcInput.Description = value; break;

                            case "id": gcInput.ID = value; break;

                            case "label": gcInput.Label = value; break;

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

                            case "width": gcInput.Width = Convert.ToInt32(value); break;
                            }
                        }
                    }

                    reader.MoveToElement();
                }

                return(gcInput);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException("Could not read " + XmlName + " element.", ex);
                }
            }
        }
Esempio n. 2
0
        public object Clone()
        {
            GcInput clone = (GcInput)this.MemberwiseClone();

            return(clone);
        }
Esempio n. 3
0
        public static GcStyle ReadFrom(ArcXmlReader reader)
        {
            try
            {
                GcStyle gcStyle = new GcStyle();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "name": gcStyle.Name = value; break;

                            case "endoffset": gcStyle.EndOffset = Convert.ToInt32(value); break;

                            case "sideoffset": gcStyle.SideOffset = Convert.ToInt32(value); break;

                            case "sideoffsetunits": gcStyle.SideOffsetUnits = (Units)ArcXmlEnumConverter.ToEnum(typeof(Units), value); break;

                            case "spellingsensitivity": gcStyle.SpellingSensitivity = Convert.ToInt32(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 GcInput.XmlName: gcStyle.GcInputs.Add(GcInput.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

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