コード例 #1
0
        public static Extension ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Extension extension = new Extension();

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "type": extension.Type = (ExtensionType)ArcXmlEnumConverter.ToEnum(typeof(ExtensionType), 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 GcStyle.XmlName: extension.GcStyle = GcStyle.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(extension);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
コード例 #2
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);
                }
            }
        }
コード例 #3
0
        public object Clone()
        {
            GcStyle clone = (GcStyle)this.MemberwiseClone();

            return(clone);
        }