Example #1
0
        /// <summary>
        /// Deserializes this object using the specified deserializer.
        /// </summary>
        /// <param name="d">The deserializer.</param>
        public void Deserialize(MgBinaryDeserializer d)
        {
            XmlDocument doc        = new XmlDocument();
            XmlNode     root       = doc.AppendChild(doc.CreateElement("FeatureSet")); //NOXLATE
            int         layerCount = d.ReadInt32();

            for (int i = 0; i < layerCount; i++)
            {
                XmlNode layer = root.AppendChild(doc.CreateElement("Layer"));              //NOXLATE
                layer.Attributes.Append(doc.CreateAttribute("id")).Value = d.ReadString(); //NOXLATE

                int classCount = d.ReadInt32();
                for (int j = 0; j < classCount; j++)
                {
                    XmlNode @class = layer.AppendChild(doc.CreateElement("Class"));             //NOXLATE
                    @class.Attributes.Append(doc.CreateAttribute("id")).Value = d.ReadString(); //NOXLATE

                    int idCount = d.ReadInt32();
                    for (int k = 0; k < idCount; k++)
                    {
                        @class.AppendChild(doc.CreateElement("ID")).InnerText = d.ReadString(); //NOXLATE
                    }
                }
            }
            LoadXml(doc.OuterXml);
        }
Example #2
0
        /// <summary>
        /// Initialize this instance using the specified binary stream
        /// </summary>
        /// <param name="d"></param>
        public virtual void Deserialize(MgBinaryDeserializer d)
        {
            this.Group = d.ReadString();
            int objid = d.ReadClassId();

            if (d.SiteVersion >= SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2))
            {
                if (objid != 12001)
                {
                    throw new Exception(string.Format(Strings.ErrorInvalidGroupObjectId, objid));
                }
            }
            else if (objid != 19001)
            {
                throw new Exception(string.Format(Strings.ErrorInvalidGroupObjectId, objid));
            }

            this.Name           = d.ReadString();
            this.ObjectId       = d.ReadString();
            this.Type           = d.ReadInt32();
            this.Visible        = d.ReadBool();
            this.ShowInLegend   = d.ReadBool();
            this.ExpandInLegend = d.ReadBool();
            this.LegendLabel    = d.ReadString();
        }
Example #3
0
        /// <summary>
        /// Initializes this instance with the specified binary stream
        /// </summary>
        /// <param name="d"></param>
        public virtual void Deserialize(MgBinaryDeserializer d)
        {
            this.Group = d.ReadString();

            int classid = d.ReadClassId();

            if (d.SiteVersion <= SiteVersions.GetVersion(KnownSiteVersions.MapGuideEP1_1) && classid != 19003)
            {
                throw new Exception(string.Format(Strings.ErrorResourceIdentifierClassIdNotFound, classid));
            }
            if (d.SiteVersion > SiteVersions.GetVersion(KnownSiteVersions.MapGuideEP1_1) && classid != 30501)
            {
                throw new Exception(string.Format(Strings.ErrorResourceIdentifierClassIdNotFound, classid));
            }

            this.LayerDefinitionID = d.ReadResourceIdentifier();

            if (d.SiteVersion < SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2))
            {
                this.Name = d.ReadString();
                _objectId = d.ReadString();
                _type     = d.ReadInt32();

                _visible        = d.ReadByte() > 0;
                _selectable     = d.ReadByte() > 0;
                _showInLegend   = d.ReadByte() > 0;
                _expandInLegend = d.ReadByte() > 0;

                _legendLabel  = d.ReadString();
                _needsRefresh = d.ReadByte() > 0;
                _displayOrder = d.ReadDouble();

                var scaleRanges = new List <double>();
                int scales      = d.ReadInt32();
                while (scales-- > 0)
                {
                    scaleRanges.Add(d.ReadDouble());
                }

                _scaleRanges = scaleRanges.ToArray();

                _featureSourceId      = d.ReadString();
                _qualifiedClassName   = d.ReadString();
                _geometryPropertyName = d.ReadString();

                var ids     = new List <PropertyInfo>();
                int idCount = d.ReadInt32();

                while (idCount-- > 0)
                {
                    short  idType = d.ReadInt16();
                    string idName = d.ReadString();
                    ids.Add(new PropertyInfo(idName, ConvertMgTypeToNetType(idType)));
                }

                this.IdentityProperties = ids.ToArray();
            }
            else
            {
                //AAARGH!!! Now they bypass their own header system ....
                this.Name = d.ReadInternalString();
                _objectId = d.ReadInternalString();
                _type     = BitConverter.ToInt32(d.ReadStreamRepeat(4), 0);

                int flags = d.ReadStreamRepeat(1)[0];
                _visible        = (flags & 1) > 0;
                _selectable     = (flags & 2) > 0;
                _showInLegend   = (flags & 4) > 0;
                _expandInLegend = (flags & 8) > 0;
                _needsRefresh   = (flags & 16) > 0;
                _hasTooltips    = (flags & 32) > 0;

                _legendLabel  = d.ReadInternalString();
                _displayOrder = BitConverter.ToDouble(d.ReadStreamRepeat(8), 0);

                var scaleRanges = new List <double>();
                int scales      = BitConverter.ToInt32(d.ReadStreamRepeat(4), 0);
                while (scales-- > 0)
                {
                    scaleRanges.Add(BitConverter.ToDouble(d.ReadStreamRepeat(8), 0));
                }

                _scaleRanges = scaleRanges.ToArray();

                _featureSourceId    = d.ReadInternalString();
                _qualifiedClassName = d.ReadInternalString();
                if (d.SiteVersion > SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS2_1))
                {
                    _filter = d.ReadInternalString();
                }
                //this.SchemaName = d.ReadInternalString();
                d.ReadInternalString();
                _geometryPropertyName = d.ReadInternalString();

                var ids     = new List <PropertyInfo>();
                int idCount = BitConverter.ToInt32(d.ReadStreamRepeat(4), 0);

                while (idCount-- > 0)
                {
                    short  idType = BitConverter.ToInt16(d.ReadStreamRepeat(2), 0);
                    string idName = d.ReadInternalString();
                    ids.Add(new PropertyInfo(idName, ConvertMgTypeToNetType(idType)));
                }

                this.IdentityProperties = ids.ToArray();
            }

            EnsureOrderedMinMaxScales();
        }