Пример #1
0
            private void SaveGame(string file)
            {
                _saveLocation = file;

                using (FileStream stream = new FileStream(file, FileMode.Create))
                {
                    stream.Write(TYPE.ToByteArray(), 0, 3);

                    stream.Write(new[]
                    {
                        _players[0].Rounds
                    }, 0, 1);

                    foreach (Player player in _players)
                    {
                        byte nameLen = (byte)player.Name.Length;
                        stream.WriteByte(nameLen);

                        foreach (char c in player.Name)
                        {
                            stream.WriteByte((byte)c);
                        }

                        foreach (byte[] tricks in player.Tricks)
                        {
                            stream.Write(tricks, 0, 2);
                        }
                    }
                }
            }
Пример #2
0
            private void SaveGame(string file)
            {
                _saveLocation = file;

                using (FileStream stream = new FileStream(file, FileMode.Create))
                {
                    stream.Write(TYPE.ToByteArray(), 0, 3);

                    stream.Write(new[]
                    {
                        (byte)_players[0].PointArray.Length
                    }, 0, 1);

                    foreach (Player player in _players)
                    {
                        int nameLength = player.Name.Length;
                        stream.WriteByte((byte)nameLength);

                        foreach (char c in player.Name)
                        {
                            stream.WriteByte((byte)c);
                        }

                        stream.Write(player.PointArray, 0, player.PointArray.Length);
                    }
                }
            }