Esempio n. 1
0
        static void WriteAsset(IAsset a, String destination)
        {
            Console.WriteLine ("\t\tabout to write asset to " + destination);

            using (var stream = new FileStream (destination, FileMode.OpenOrCreate))
            {
                using (var sc = new SerialisationChannel
                    <BinaryStreamSerialiser>
                        (stream, ChannelMode.Write))
                {
                    // Cor Binary Asset File Header
                    //------------------------------------------------------------------------------------------------//
                    WriteFileHeader (sc);

                    // Now write the object
                    //------------------------------------------------------------------------------------------------//
                    Type assetType = a.GetType ();
                    sc.WriteReflective (assetType, a);

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine ("\t\tBUILT " + destination);
                    Console.ResetColor ();
                }
            }
        }