Exemplo n.º 1
0
        public NetPacket(byte[] buffer)
        {
            this.state = PacketStateType.Read;

            this.memoryStream = new MemoryStream(buffer, 0, buffer.Length);
            this.memoryReader = new BinaryReader(this.memoryStream);
        }
Exemplo n.º 2
0
        public NetPacket()
        {
            this.state = PacketStateType.Write;

            this.memoryStream = new MemoryStream();
            this.memoryWriter = new BinaryWriter(this.memoryStream);
            this.Write(0); // packet size
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new NetPacketBase in read-only mode.
 /// </summary>
 /// <param name="buffer"></param>
 protected NetPacketBase(byte[] buffer)
 {
     this._state       = PacketStateType.Read;
     this.MemoryStream = new MemoryStream(buffer, 0, buffer.Length, false, true);
     this.MemoryReader = new BinaryReader(this.MemoryStream);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new NetPacketBase in write-only mode.
 /// </summary>
 protected NetPacketBase()
 {
     this._state       = PacketStateType.Write;
     this.MemoryStream = new MemoryStream();
     this.MemoryWriter = new BinaryWriter(this.MemoryStream);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates and initializes a new <see cref="NetPacketStream"/> instance in read-only mode.
 /// </summary>
 /// <param name="buffer">Input buffer</param>
 public NetPacketStream(byte[] buffer)
     : base(buffer)
 {
     this._memoryReader = new BinaryReader(this);
     this._state        = PacketStateType.Read;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates and initializes a new <see cref="NetPacketStream"/> instance in write-only mode.
 /// </summary>
 public NetPacketStream()
 {
     this._memoryWriter = new BinaryWriter(this);
     this._state        = PacketStateType.Write;
 }