Esempio n. 1
0
 internal RCONPacket()
 {
     RequestId = 0;
     String1 = "fakefakefake";
     String2 = String.Empty;
     ServerDataSent = SERVERDATA_sent.None;
     ServerDataReceived = SERVERDATA_rec.None;
 }
 internal RCONPacket()
 {
     RequestId          = 0;
     String1            = "fakefakefake";
     String2            = String.Empty;
     ServerDataSent     = SERVERDATA_sent.None;
     ServerDataReceived = SERVERDATA_rec.None;
 }
        internal void ParseFromBytes(byte[] bytes, Rcon parent)
        {
            int           BPtr = 0;
            ArrayList     stringcache;
            ASCIIEncoding Ascii = new ASCIIEncoding();

            // First 4 bytes are ReqId.
            RequestId = BitConverter.ToInt32(bytes, BPtr);
            BPtr     += 4;
            // Next 4 are server data.
            ServerDataReceived = (SERVERDATA_rec)BitConverter.ToInt32(bytes, BPtr);
            BPtr += 4;
            // string1 till /0
            stringcache = new ArrayList();
            while (bytes[BPtr] != 0)
            {
                stringcache.Add(bytes[BPtr]);
                BPtr++;
            }
            String1 = Ascii.GetString((byte[])stringcache.ToArray(typeof(byte)));
            BPtr++;

            // string2 till /0

            stringcache = new ArrayList();
            while (bytes[BPtr] != 0)
            {
                stringcache.Add(bytes[BPtr]);
                BPtr++;
            }
            String2 = Ascii.GetString((byte[])stringcache.ToArray(typeof(byte)));
            BPtr++;

            // Repeat if there's more data?

            if (BPtr != bytes.Length)
            {
                parent.OnError(MessageCode.TooMuchData, null);
            }
        }
Esempio n. 4
0
        internal void ParseFromBytes(byte[] bytes, Rcon parent)
        {
            int BPtr = 0;
            ArrayList stringcache;
            ASCIIEncoding Ascii = new ASCIIEncoding();

            // First 4 bytes are ReqId.
            RequestId = BitConverter.ToInt32(bytes, BPtr);
            BPtr += 4;
            // Next 4 are server data.
            ServerDataReceived = (SERVERDATA_rec)BitConverter.ToInt32(bytes, BPtr);
            BPtr += 4;
            // string1 till /0
            stringcache = new ArrayList();
            while (bytes[BPtr] != 0)
            {
                stringcache.Add(bytes[BPtr]);
                BPtr++;
            }
            String1 = Ascii.GetString((byte[])stringcache.ToArray(typeof(byte)));
            BPtr++;

            // string2 till /0

            stringcache = new ArrayList();
            while (bytes[BPtr] != 0)
            {
                stringcache.Add(bytes[BPtr]);
                BPtr++;
            }
            String2 = Ascii.GetString((byte[])stringcache.ToArray(typeof(byte)));
            BPtr++;

            // Repeat if there's more data?

            if (BPtr != bytes.Length)
            {
                parent.OnError(MessageCode.TooMuchData, null);
            }
        }
Esempio n. 5
0
        internal void ParseFromBytes( byte[] bytes, SourceRcon parent )
        {
            int BPtr = 0;
            ArrayList stringcache;
            UTF8Encoding utf = new UTF8Encoding();

            //if (bytes.Length < 4)
            //	return;
            // First 4 bytes are ReqId.
            RequestId = BitConverter.ToInt32( bytes, BPtr );
            BPtr += 4;
            // Next 4 are server data.
            ServerDataReceived = (SERVERDATA_rec)BitConverter.ToInt32( bytes, BPtr );
            BPtr += 4;
            // string1 till /0
            stringcache = new ArrayList();
            while (bytes[BPtr] != 0)
            {
                stringcache.Add( bytes[BPtr] );
                BPtr++;
            }
            String1 = utf.GetString( (byte[])stringcache.ToArray( typeof( byte ) ) );
            BPtr++;

            // string2 till /0

            stringcache = new ArrayList();
            while (bytes[BPtr] != 0)
            {
                stringcache.Add( bytes[BPtr] );
                BPtr++;
            }
            String2 = utf.GetString( (byte[])stringcache.ToArray( typeof( byte ) ) );
            BPtr++;

            // Repeat if there's more data?

            if (BPtr != bytes.Length)
            {
                parent.OnError( "Urk, extra data!" );
            }
        }