예제 #1
0
        /// <summary>
        /// This method serializes the serialization info.
        /// </summary>
        /// <param name="header">The header.</param>
        /// <param name="entity">The entity.</param>
        /// <param name="info">The serialization info.</param>
        protected virtual void ContentSerializeInternal(
            IXimuraContentFormatterCapabilities header, Content entity, SerializationInfo info)
        {
            IXimuraContentSerializationReaderWriter rwHelper = header.RWHelper;

            int bodyCount = info.GetInt32("bodycount");
            bool contentDirty = info.GetBoolean("dirty");

            //Write the content dirty status
            rwHelper.Write(contentDirty);

            //Write the blob count.
            rwHelper.Write(bodyCount);

            //Loop through each blob and save it to the stream.
            for (int loop = 0; loop < bodyCount; loop++)
            {
                byte[] blob =
                    (byte[])info.GetValue("body" + loop.ToString(), typeof(byte[]));

                if (header.StreamCompressed)
                    rwHelper.WriteCompressedBlob(blob);
                else
                    rwHelper.WriteBlob(blob);

            }
            rwHelper.BaseStream.Flush();
        }
예제 #2
0
 /// <summary>
 /// This is a shortcut method for creating an entity.
 /// </summary>
 /// <param name="inData">The content to create in the CDS.</param>
 /// <returns>Returns the CDS status</returns>
 public static CDSResponse CDSCreate(this IXimuraSessionRQ SessionRQ, Content inData)
 {
     return SessionRQ.CDSExecute(CDSData.Get(CDSAction.Create), inData);
 }
예제 #3
0
        /// <summary>
        /// This method is used to get the header object which can 
        /// parse or write to the stream.
        /// </summary>
        /// <param name="entity">The entity type.</param>
        /// <returns>A header object.</returns>
        protected virtual IXimuraContentFormatterCapabilities GetHeader(Content entity)
        {
            IXimuraContentFormatterCapabilities header = new ContentFormatterCapabilities();

            return header;
        }