Пример #1
0
 public static byte[] SaveLayerToStream(ILayer paramLayer)
 {
     byte[] buffer = null;
     if (paramLayer is IPersistStream)
     {
         IPersistStream stream = paramLayer as IPersistStream;
         XMLStreamClass class2 = new XMLStreamClass();
         stream.Save(class2, 0);
         buffer = class2.SaveToBytes();
     }
     return(buffer);
 }
Пример #2
0
        /// <summary>
        /// Serializes an object using ArcObjects xml serialization into a BSON Element
        /// Used by the CatalogDataset to store metadata
        /// </summary>
        /// <param name="ipItem">The object to serialize</param>
        /// <returns>The BSON element containing the bytes</returns>
        internal static BsonValue ObjectToBson(System.Object ipItem)
        {
            IXMLStream ipXmlStream = new XMLStreamClass();
            IXMLWriter ipXmlWriter = new XMLWriterClass();

            ipXmlWriter.WriteTo((IStream)ipXmlStream);
            IXMLSerializer ipXmlSer = new XMLSerializerClass();

            ipXmlSer.WriteObject(ipXmlWriter, null, null, "Test", "Test", ipItem);
            byte[] bytes = ipXmlStream.SaveToBytes();
            return(BsonValue.Create(bytes));
        }
Пример #3
0
 public static byte[] SaveLayerToStream(ILayer paramLayer)
 {
     byte[] buffer = null;
     if (paramLayer is IPersistStream)
     {
         IPersistStream stream = paramLayer as IPersistStream;
         XMLStreamClass class2 = new XMLStreamClass();
         stream.Save(class2, 0);
         buffer = class2.SaveToBytes();
     }
     return buffer;
 }