Example #1
0
        private byte[] WriteRootObjectData(object rootObject)
        {
            byte[] rootObjectData = null;

            using (MemoryStream stream = new MemoryStream())
            {
                using (ContentWriter writer = new ContentWriter(stream, this))
                {
                    writer.WriteObject <object>(rootObject);
                    writer.Flush();

                    stream.Flush();
                    rootObjectData = stream.GetBuffer().Take((int)stream.Length).ToArray();
                }
            }

            return(rootObjectData);
        }
Example #2
0
        private List <byte[]> WriteSharedResourcesData(out byte[] sharedResourcesCountData)
        {
            List <byte[]> shareResourcesData = new List <byte[]>();

            using (MemoryStream stream = new MemoryStream())
            {
                using (ContentWriter writer = new ContentWriter(stream, this))
                {
                    writer.WriteEncodedInt32(sharedResources.Count);
                    writer.Flush();

                    stream.Flush();
                    sharedResourcesCountData = stream.GetBuffer().Take((int)stream.Length).ToArray();
                }
            }

            // TODO: Support shared resources
            return(shareResourcesData);
        }