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

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

                        if (value.Length > 0)
                        {
                            switch (reader.Name)
                            {
                            case "default": dataFrameInfo.Default = Convert.ToBoolean(value); break;

                            case "name": dataFrameInfo.Name = 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 Properties.XmlName: dataFrameInfo.Properties = Properties.ReadFrom(reader); break;

                            case LayerInfo.XmlName: dataFrameInfo.LayerInfos.Add(LayerInfo.ReadFrom(reader)); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(dataFrameInfo);
            }
            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 ServiceInfo ReadFrom(ArcXmlReader reader)
        {
            try
            {
                ServiceInfo serviceInfo = new ServiceInfo();

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

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

                            case Properties.XmlName: serviceInfo.Properties = Properties.ReadFrom(reader); break;

                            case LayoutInfo.XmlName: serviceInfo.LayoutInfo = LayoutInfo.ReadFrom(reader); break;

                            case DataFrameInfo.XmlName:
                                if (serviceInfo.DataFrameInfos == null)
                                {
                                    serviceInfo.DataFrameInfos = new DataFrameInfoList();
                                }

                                serviceInfo.DataFrameInfos.Add(DataFrameInfo.ReadFrom(reader));
                                break;

                            case LayerInfo.XmlName:
                                if (serviceInfo.LayerInfos == null)
                                {
                                    serviceInfo.LayerInfos = new LayerInfoList();
                                }

                                serviceInfo.LayerInfos.Add(LayerInfo.ReadFrom(reader));
                                break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(serviceInfo);
            }
            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()
        {
            DataFrameInfo clone = (DataFrameInfo)this.MemberwiseClone();

            clone._layerInfos = (LayerInfoList)_layerInfos.Clone();

            if (Properties != null)
            {
                clone.Properties = (Properties)Properties.Clone();
            }

            return(clone);
        }