Exemplo n.º 1
0
        private Packet TransferRequestHandler(Packet packet, IPEndPoint simulator)
        {
            TransferRequestPacket trp = (TransferRequestPacket)packet;

            byte[] b = new byte[4];
            byte[] u = new byte[16];
            Buffer.BlockCopy(trp.TransferInfo.Params, 0, u, 0, 16);
            Buffer.BlockCopy(trp.TransferInfo.Params, 16, b, 0, 4);
            UUID uid = new UUID(
                u, 0);
            bool goon = true;


            if (Utils.BytesToInt(b) == 20)
            {
                //its an animation

                if (form.getChecked() <= 0)
                {
                    if (gdebug)
                    {
                        writethis("File Refused because no anims are allowed", ConsoleColor.Gray, ConsoleColor.DarkRed);
                    }

                    goon = false;
                }
                if (form.getChecked() <= 1)
                {
                    if (!new List <string>(llanims).Contains(uid.ToString()))
                    {
                        if (gdebug)
                        {
                            writethis("File Refused because it wasnt a linden one", ConsoleColor.Gray, ConsoleColor.DarkRed);
                        }

                        goon = false;
                    }
                }
                if (uid.ToString().ToLower().Equals("a7b1699c-fa67-0242-4136-79b7a8a3daa0"))
                {
                    if (gdebug)
                    {
                        writethis("File Refused because its on the ban list", ConsoleColor.Gray, ConsoleColor.DarkRed);
                    }

                    goon = false;
                }

                gd1 temp = new gd1();
                temp.bytes = new byte[1024 * 300];

                if (goon)
                {
                    if (new List <string>(llanims).Contains(uid.ToString()))
                    {
                        //linden anim, safe
                        if (gdebug)
                        {
                            writethis("File allowed because its a lidnen one ", ConsoleColor.Gray, ConsoleColor.DarkGreen);
                        }
                    }
                    else
                    {
                        if (!dls.ContainsKey(trp.TransferInfo.TransferID))
                        {
                            dls.Add(trp.TransferInfo.TransferID, temp);
                        }
                        else
                        {
                            dls[trp.TransferInfo.TransferID] = temp;
                        }
                        if (gdebug)
                        {
                            writethis("We got an animation trafer, it was " + uid.ToString(), ConsoleColor.Black, ConsoleColor.Green);
                        }
                    }
                }

                if (gdebug)
                {
                    writethis("FYI., checked is " + form.getChecked().ToString(), ConsoleColor.Gray, ConsoleColor.DarkBlue);
                }
            }
            if (goon == false)
            {
                sendNotAnim(trp.TransferInfo.TransferID);
                //send bad packet
                return(null);
            }

            return(packet);
        }
Exemplo n.º 2
0
Arquivo: PAnim.cs Projeto: zadark/par
        private Packet TransferRequestHandler(Packet packet, IPEndPoint simulator)
        {
            TransferRequestPacket trp = (TransferRequestPacket)packet;
            byte[] b = new byte[4];
            byte[] u = new byte[16];
            Buffer.BlockCopy(trp.TransferInfo.Params, 0, u, 0, 16);
            Buffer.BlockCopy(trp.TransferInfo.Params, 16, b, 0, 4);
            UUID uid = new UUID(
                u, 0);
            bool goon = true;

            if (Utils.BytesToInt(b) == 20)
            {
                //its an animation

                if (form.getChecked() <= 0)
                {
                    if (gdebug) writethis("File Refused because no anims are allowed", ConsoleColor.Gray, ConsoleColor.DarkRed);

                    goon = false;
                }
                if (form.getChecked() <= 1)
                {
                    if (!new List<string>(llanims).Contains(uid.ToString()))
                    {
                        if (gdebug) writethis("File Refused because it wasnt a linden one", ConsoleColor.Gray, ConsoleColor.DarkRed);

                        goon = false;
                    }
                }
                if (uid.ToString().ToLower().Equals("a7b1699c-fa67-0242-4136-79b7a8a3daa0"))
                {
                    if (gdebug) writethis("File Refused because its on the ban list", ConsoleColor.Gray, ConsoleColor.DarkRed);

                    goon = false;
                }

                gd1 temp = new gd1();
                temp.bytes = new byte[1024 * 300];

                if (goon)
                {
                    if (new List<string>(llanims).Contains(uid.ToString()))
                    {
                        //linden anim, safe
                        if (gdebug) writethis("File allowed because its a lidnen one ", ConsoleColor.Gray, ConsoleColor.DarkGreen);

                    }
                    else
                    {
                        if (!dls.ContainsKey(trp.TransferInfo.TransferID))
                        {
                            dls.Add(trp.TransferInfo.TransferID, temp);
                        }
                        else
                        {
                            dls[trp.TransferInfo.TransferID] = temp;
                        }
                        if (gdebug) writethis("We got an animation trafer, it was " + uid.ToString(), ConsoleColor.Black, ConsoleColor.Green);

                    }
                }

                if (gdebug) writethis("FYI., checked is " + form.getChecked().ToString(), ConsoleColor.Gray, ConsoleColor.DarkBlue);

            }
            if (goon == false)
            {
                sendNotAnim(trp.TransferInfo.TransferID);
                //send bad packet
                return null;
            }

            return packet;
        }