Beispiel #1
0
        public static void WriteToStream(SaveFileHeader header, object data, Stream stream)
        {
            var formatter = CreateFormatter();

            formatter.Serialize(stream, header);
            formatter.Serialize(stream, data);
        }
Beispiel #2
0
        public static void Write(SaveFileHeader header, object data)
        {
            using (var stream = new MemoryStream())
            {
                WriteToStream(header, data, stream);
                var filename = String.Format("{0}.savegame", Guid.NewGuid());

                Folder.WriteFile(filename, stream.ToArray());
            }
        }
Beispiel #3
0
        public static void Write(SaveFileHeader header, object data)
        {
            using (var stream = new MemoryStream())
              {
            WriteToStream(header, data, stream);
            var filename = String.Format("{0}.savegame", Guid.NewGuid());

            Folder.WriteFile(filename, stream.ToArray());
              }
        }
Beispiel #4
0
        public void WriteDebugReport(string filename = null)
        {
            var header = new SaveFileHeader {
                Description = "Debug information to reproduce a bug which caused the error."
            };
            var savedGame = Save();

            filename = filename ?? String.Format("debug-report-{0}.report", Guid.NewGuid());
            using (var stream = new FileStream(filename, FileMode.Create))
            {
                SavedGames.WriteToStream(header, savedGame, stream);
            }
        }
Beispiel #5
0
 public SaveGameFile(SaveFileHeader header, object data, DateTime?createdAt)
 {
     Header    = header;
     Data      = data;
     CreatedAt = createdAt;
 }
Beispiel #6
0
 public static void WriteToStream(SaveFileHeader header, object data, Stream stream)
 {
     var formatter = CreateFormatter();
       formatter.Serialize(stream, header);
       formatter.Serialize(stream, data);
 }
Beispiel #7
0
 public SaveGameFile(SaveFileHeader header, object data, DateTime? createdAt)
 {
     Header = header;
       Data = data;
       CreatedAt = createdAt;
 }