Пример #1
0
 public void ToCxml(string filePath)
 {
     using (StreamWriter writer = File.CreateText(filePath))
     {
         CxmlSerializer.Serialize(writer.BaseStream, this);
     }
 }
Пример #2
0
        /// <summary>
        /// Write a collection object as CXML into the given stream.
        /// </summary>
        /// <param name="outputStream">The output stream.</param>
        /// <param name="collection">The collection.</param>
        public static void Serialize(Stream outputStream, Collection collection)
        {
            CxmlSerializer s = new CxmlSerializer(collection);

            using (XmlWriter writer = XmlWriter.Create(outputStream))
            {
                s.Write(writer);
            }
        }
Пример #3
0
        public void ProcessRequest(HttpContext context)
        {
            string src = context.Request.QueryString["src"];

            //Build the collection in response to any query parameters.
            //Collection collection = FileExplorerCollection.MakeCollection(src);
            Collection collection = ODataCollectionSource.MakeOdataCollection(src);

            string cacheKey = Guid.NewGuid().ToString("N") + ".dzc";

            collection.ImgBaseName  = cacheKey;
            context.Cache[cacheKey] = collection;
            context.Cache.Add(cacheKey, collection, null, DateTime.MaxValue, new TimeSpan(1, 0, 0),
                              CacheItemPriority.High, null);
            context.Response.ContentType = "text/xml";
            CxmlSerializer.Serialize(context.Response.Output, collection);
        }
Пример #4
0
        /// <summary>
        /// Write a collection object as CXML into an XmlWriter.
        /// </summary>
        /// <param name="outputWriter">The output writer.</param>
        /// <param name="collection">The collection.</param>
        public static void Serialize(XmlWriter outputWriter, Collection collection)
        {
            CxmlSerializer s = new CxmlSerializer(collection);

            s.Write(outputWriter);
        }
Пример #5
0
 public void ToCxml(TextWriter textWriter)
 {
     CxmlSerializer.Serialize(textWriter, this);
 }
Пример #6
0
 public string ToCxml()
 {
     return(CxmlSerializer.Serialize(this));
 }