Exemplo n.º 1
0
        public bool Save(FlyScene scene)
        {
            try
            {
                string directory = SaveFolder;
                Directory.CreateDirectory(directory);

                string fullPath = Path.Combine(directory, "test.flys");

                using (var stream = new MemoryStream())
                {
                    var context = new BinarySerializationContext(stream);
                    Save(scene, context);

                    stream.Flush();
                    StorageUtilities.CopyToFile(stream, fullPath);
                }

                Console.WriteLine("Saved!");
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(false);
            }
        }