PeekDataBuffer() public method

Returns the internal data buffer, don't modify
public PeekDataBuffer ( ) : byte[]
return byte[]
Beispiel #1
0
 public static NetOutgoingMessage Compress(NetOutgoingMessage msg)
 {
     msg.WritePadBits();
     byte[] input = msg.PeekDataBuffer();
     byte[] output = new byte[input.Length*2];
     int outlength = ZipCompressor.Instance.Compress(input, msg.LengthBytes, output);
     msg.EnsureBufferSize(outlength*8);
     input = msg.PeekDataBuffer();
     Array.Copy(output, input, outlength);
     msg.LengthBytes = outlength;
     msg.LengthBits = outlength * 8;
     return msg;
 }
Beispiel #2
0
        public virtual void SendNot(NetOutgoingMessage m, IPEndPoint ep)
        {
            if (server.ConnectionsCount == 0 && Root.Instance.Recorder == null)
                return;
            if (ep == null)
                throw new Exception("ep==null");

            if (Root.Instance.Recorder != null)
            {
                byte[] buf = m.PeekDataBuffer();
                Root.Instance.Recorder.WritePacket((int)(Root.Instance.Time * 1000), buf, buf.Length);
            }

            List<NetConnection> list = new List<NetConnection>();
            foreach (NetConnection s in Clients)
            {
                if (s != null)
                {
                    if (ep.ToString() != s.RemoteEndpoint.ToString())
                        list.Add(s);
                }
            }
            server.SendMessage(compress?NetCompressor.Compress(m):m, list, NetDeliveryMethod.Unreliable, 0);
        }