ArtemisComm.GameMessageSubPackets.AllShipSettingsSubPacket.LoadData C# (CSharp) Méthode

LoadData() public méthode

public LoadData ( Stream stream, int index ) : void
stream Stream
index int
Résultat void
        void LoadData(Stream stream, int index)
        {
            if (stream != null)
            {
                try
                {
                    List<PlayerShip> ships = new List<PlayerShip>();
                    using (MemoryStream dataStream = stream.GetMemoryStream(index))
                    {
                        int position = 0;
                        do
                        {
                            PlayerShip p = new PlayerShip(dataStream, position);
                            ships.Add(p);
                            position += p.Length;

                        } while (position < dataStream.Length);
                    }
                    Ships = new ReadOnlyCollection<PlayerShip>(ships);
                }
                catch (Exception ex)
                {
                    errors.Add(ex);
                }
            }
        }
        //public byte[] GetBytes()