public string GetString() { var ms = new MemoryStream(NumberOfBytes()); var bw = new BinaryWriter(ms); bw.Write(Version); // Version 1 data bw.Write(name); bw.Write(inventory.Length); foreach (var item in inventory) { bw.Write(item.GetString()); } bw.Write(location.x); bw.Write(location.y); var saveData = new ByteSerializer(ms.GetBuffer()); bw.Close(); ms.Close(); return(saveData.GetAsString()); }
public string GetString() { var ms = new MemoryStream(NumberOfBytes()); var bw = new BinaryWriter(ms); bw.Write(Version); // Version 1 data bw.Write(name); bw.Write(description); bw.Write(location.x); bw.Write(location.y); var saveData = new ByteSerializer(ms.GetBuffer()); bw.Close(); ms.Close(); return(saveData.GetAsString()); }
public string GetString() { var ms = new MemoryStream(NumberOfBytes()); var bw = new BinaryWriter(ms); bw.Write(Version); // Version 1 data bw.Write(walls.Length); foreach (var wall in walls) { bw.Write(wall.x); bw.Write(wall.y); } bw.Write(items.Length); foreach (var item in items) { bw.Write(item.GetString()); } bw.Write(levelScore); bw.Write(player.GetString()); bw.Write(width); bw.Write(height); var saveData = new ByteSerializer(ms.GetBuffer()); bw.Close(); ms.Close(); return(saveData.GetAsString()); }