Exemple #1
0
        public void TestUuid()
        {
            var  rfc4122Bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf };
            UUID uuid         = new UUID(rfc4122Bytes);

            Assert.AreEqual(rfc4122Bytes, uuid.GetBytes());

            Skin skin = new Skin {
                Slim = false, Texture = Encoding.Default.GetBytes(new string('Z', 8192))
            };
            var packet = new McpeLogin()
            {
                username      = "******",
                protocol      = 34,
                protocol2     = 34,
                clientId      = new Random().Next(),
                clientUuid    = new UUID(),
                serverAddress = "83.249.65.92:19132",
                clientSecret  = "iwmvi45hm85oncyo58",
                skin          = skin,
            };

            var bytes = packet.Encode();

            Console.WriteLine(Package.HexDump(bytes, 16));
        }
Exemple #2
0
        public void SendLogin(string username)
        {
            Skin skin = new Skin {
                Slim = false, Texture = Encoding.Default.GetBytes(new string('Z', 8192))
            };

            skin.SkinType = "Standard_Custom";
            //Skin skin = new Skin { Slim = false, Texture = Encoding.Default.GetBytes(new string('Z', 16384)) };
            var packet = new McpeLogin()
            {
                username      = username,
                protocol      = 38,
                protocol2     = 38,
                clientId      = ClientId,
                clientUuid    = new UUID(Guid.NewGuid().ToByteArray()),
                serverAddress = _serverEndpoint.Address + ":" + _serverEndpoint.Port,
                clientSecret  = "iwmvi45hm85oncyo58",
                //clientSecret = Encoding.ASCII.GetString(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes("" + ClientId + _serverEndpoint.Address + _serverEndpoint.Port))),
                skin = skin,
            };

            byte[] buffer = Player.CompressBytes(packet.Encode(), CompressionLevel.Fastest, true);

            McpeBatch batch = new McpeBatch();

            batch.payloadSize = buffer.Length;
            batch.payload     = buffer;
            batch.Encode();

            SendPackage(batch);
            LoginSent = true;
        }
		public void TestUuid()
		{
			var rfc4122Bytes = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf};
			UUID uuid = new UUID(rfc4122Bytes);
			Assert.AreEqual(rfc4122Bytes, uuid.GetBytes());

			Skin skin = new Skin {Slim = false, Texture = Encoding.Default.GetBytes(new string('Z', 8192))};
			var packet = new McpeLogin()
			{
				username = "******",
				protocol = 34,
				protocol2 = 34,
				clientId = new Random().Next(),
				clientUuid = new UUID(Guid.NewGuid().ToByteArray()),
				serverAddress = "83.249.65.92:19132",
				clientSecret = "iwmvi45hm85oncyo58",
				skin = skin,
			};

			var bytes = packet.Encode();
			Console.WriteLine(Package.HexDump(bytes, 16));

			UUID uuid2 = new UUID(rfc4122Bytes);

			Dictionary<UUID, string> uuiDictionary = new Dictionary<UUID, string>();
			uuiDictionary.Add(uuid, "test");

			Assert.AreEqual("test", uuiDictionary[uuid2]);
			
		}
Exemple #4
0
        public void SendLogin(string username)
        {
            Skin skin = new Skin {
                Slim = false, Texture = Encoding.Default.GetBytes(new string('Z', 8192))
            };
            var packet = new McpeLogin()
            {
                clientId = 12345,
                username = username,
                protocol = 27,
                skin     = skin
            };

            McpeBatch batch = new McpeBatch();

            byte[] buffer = CompressBytes(packet.Encode());

            batch.payloadSize = buffer.Length;
            batch.payload     = buffer;

            SendPackage(batch);
        }
Exemple #5
0
        public void SendLogin(string username)
        {
            Skin skin = new Skin {Slim = false, Texture = Encoding.Default.GetBytes(new string('Z', 8192))};
            skin.SkinType = "Standard_Custom";
            //Skin skin = new Skin { Slim = false, Texture = Encoding.Default.GetBytes(new string('Z', 16384)) };
            var packet = new McpeLogin()
            {
                username = username,
                protocol = 39,
                protocol2 = 39,
                clientId = ClientId,
                clientUuid = new UUID(Guid.NewGuid().ToByteArray()),
                serverAddress = _serverEndpoint.Address + ":" + _serverEndpoint.Port,
                clientSecret = "iwmvi45hm85oncyo58",
                //clientSecret = Encoding.ASCII.GetString(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes("" + ClientId + _serverEndpoint.Address + _serverEndpoint.Port))),
                skin = skin,
            };

            byte[] buffer = Player.CompressBytes(packet.Encode(), CompressionLevel.Fastest, true);

            McpeBatch batch = new McpeBatch();
            batch.payloadSize = buffer.Length;
            batch.payload = buffer;
            batch.Encode();

            SendPackage(batch);
            LoginSent = true;
        }
Exemple #6
0
        public void SendLogin(string username)
        {
            Skin skin = new Skin {Slim = false, Texture = Encoding.Default.GetBytes(new string('Z', 8192))};
            var packet = new McpeLogin()
            {
                clientId = 12345,
                username = username,
                protocol = 27,
                skin = skin
            };

            McpeBatch batch = new McpeBatch();
            byte[] buffer = CompressBytes(packet.Encode());

            batch.payloadSize = buffer.Length;
            batch.payload = buffer;

            SendPackage(batch);
        }