Esempio n. 1
0
        public static byte[] SerializeToBytes(IFBSerializable root)
        {
            serializing = true;
            ClearCache();
            fbBuilder = new FlatBufferBuilder(5000000);

            var rootResult = root.Serialize(fbBuilder);

            fbBuilder.Finish(rootResult);
            // TODO: Check: Is this the whole buffer? Or is it even more?
            var buf = fbBuilder.DataBuffer.ToSizedArray();

            serializing = false;
            return(buf);
        }
Esempio n. 2
0
        public static void SerializeToFileDomain(FileSystem.FSDomain domain, String filename, IFBSerializable root)
        {
            var buf = SerializeToBytes(root);
            var fs  = Kernel.Instance.Container.Resolve <Service.FileSystem.IFileSystemService>();

            fs.WriteBytesToFileAtDomain(domain, filename, buf);
        }