/// <summary> /// Serializes this instance /// </summary> /// <param name="s"></param> public virtual void Serialize(MgBinarySerializer s) { s.Write(this.Group); if (s.SiteVersion >= SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2)) { s.WriteClassId(12001); } else { s.WriteClassId(19001); } s.Write(this.Name); s.Write(this.ObjectId); s.Write(this.Type); s.Write(this.Visible); s.Write(this.ShowInLegend); s.Write(this.ExpandInLegend); s.Write(this.LegendLabel); }
/// <summary> /// Serializes this instance using the specified serializer. /// </summary> /// <param name="s">The serializer.</param> public void Serialize(MgBinarySerializer s) { var m_selection = new XmlDocument(); m_selection.LoadXml(ToXml()); if (m_selection["FeatureSet"] == null) //NOXLATE { s.Write((int)0); return; } XmlNodeList lst = m_selection["FeatureSet"].SelectNodes("Layer"); //NOXLATE s.Write(lst.Count); foreach (XmlNode n in lst) { if (n.Attributes["id"] == null) //NOXLATE { throw new Exception(Strings.ErrorSelectedLayerHasNoId); } s.Write(n.Attributes["id"].Value); //NOXLATE XmlNodeList cls = n.SelectNodes("Class"); //NOXLATE s.Write(cls.Count); foreach (XmlNode c in cls) { s.Write(c.Attributes["id"].Value); //NOXLATE XmlNodeList ids = c.SelectNodes("ID"); //NOXLATE s.Write(ids.Count); foreach (XmlNode id in ids) { s.Write(id.InnerText); } } } }
/// <summary> /// Serializes this instance to a binary stream /// </summary> /// <param name="s"></param> public virtual void Serialize(MgBinarySerializer s) { s.Write(this.Group); if (s.SiteVersion <= SiteVersions.GetVersion(KnownSiteVersions.MapGuideEP1_1)) { s.WriteClassId(19003); } else { s.WriteClassId(30501); } s.WriteResourceIdentifier(this.LayerDefinitionID); if (s.SiteVersion < SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2)) { s.Write(this.Name); s.Write(this.ObjectId); s.Write(this.Type); s.Write((byte)(this.Visible ? 1 : 0)); s.Write((byte)(this.Selectable ? 1 : 0)); s.Write((byte)(this.ShowInLegend ? 1 : 0)); s.Write((byte)(this.ExpandInLegend ? 1 : 0)); s.Write(this.LegendLabel); s.Write((byte)(this.NeedsRefresh ? 1 : 0)); s.Write(this.DisplayOrder); s.Write(_scaleRanges.Length); foreach (double d in _scaleRanges) { s.Write(d); } s.Write(this.FeatureSourceID); s.Write(this.QualifiedClassName); s.Write(this.GeometryPropertyName); s.Write(this.IdentityProperties.Length); foreach (var x in this.IdentityProperties) { s.Write((short)ConvertNetTypeToMgType(x.Type)); s.Write(x.Name); } } else { s.WriteStringInternal(this.Name); s.WriteStringInternal(this.ObjectId); s.WriteRaw(BitConverter.GetBytes(this.Type)); int flags = 0; flags |= this.Visible ? 1 : 0; flags |= this.Selectable ? 2 : 0; flags |= this.ShowInLegend ? 4 : 0; flags |= this.ExpandInLegend ? 8 : 0; flags |= this.NeedsRefresh ? 16 : 0; flags |= this.HasTooltips ? 32 : 0; s.WriteRaw(new byte[] { (byte)flags }); s.WriteStringInternal(this.LegendLabel); s.WriteRaw(BitConverter.GetBytes(this.DisplayOrder)); s.WriteRaw(BitConverter.GetBytes(_scaleRanges.Length)); foreach (double d in _scaleRanges) { s.WriteRaw(BitConverter.GetBytes(d)); } s.WriteStringInternal(this.FeatureSourceID); s.WriteStringInternal(this.QualifiedClassName); if (s.SiteVersion > SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS2_1)) { s.WriteStringInternal(this.Filter); } s.WriteStringInternal(this.SchemaName); s.WriteStringInternal(this.GeometryPropertyName); s.WriteRaw(BitConverter.GetBytes(this.IdentityProperties.Length)); foreach (var x in this.IdentityProperties) { s.WriteRaw(BitConverter.GetBytes((short)ConvertNetTypeToMgType(x.Type))); s.WriteStringInternal(x.Name); } } }