Beispiel #1
0
        public static void QueueSearch(int pid, SearchSpecial special, ushort species, SearchMetagames meta, byte country, byte region)
        {
            switch (special)
            {
            case SearchSpecial.Latest30:
                Console.WriteLine("Searching for latest 30 videos.");
                break;

            case SearchSpecial.TopLinkBattles:
                Console.WriteLine("Searching for top link battles.");
                break;

            case SearchSpecial.TopSubwayBattles:
                Console.WriteLine("Searching for top Subway battles.");
                break;

            default:
            {
                Console.Write("Searching for ");
                if (species != 0xffff)
                {
                    Console.Write("species {0}, ", species);
                }
                if (meta != SearchMetagames.None)
                {
                    Console.Write("{0}, ", meta);
                }
                if (country != 0xff)
                {
                    Console.Write("country {0}, ", region);
                }
                if (region != 0xff)
                {
                    Console.Write("region {0}", region);
                }
            } break;
            }

            byte[]       data    = new byte[0x15c];
            MemoryStream request = new MemoryStream(data);

            request.Write(new byte[4], 0, 4);                           // length goes here, see end
            request.Write(new byte[] { 0xf1, 0x55, 0x00, 0x00 }, 0, 4); // request type, sanity 0000
            request.Write(BitConverter.GetBytes(pid), 0, 4);            // pid, hopefully this doesn't ban me
            request.Write(new byte[] { 0x14, 0x02 }, 0, 2);

            WriteBase64shit(request);

            request.Write(new byte[0xda], 0, 0xda);

            request.Write(BitConverter.GetBytes((uint)special), 0, 4);
            request.Write(BitConverter.GetBytes(species), 0, 2);
            request.Write(BitConverter.GetBytes((uint)meta), 0, 4);
            request.WriteByte(country);
            request.WriteByte(region);

            request.Write(new byte[] {
                0x64, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00
            }, 0, 16);
            request.Flush();
            PutLength(data);

            byte[] response = Conversation(data);

            if (special != SearchSpecial.Latest30)
            {
                using (MySqlConnection db = CreateConnection())
                {
                    db.Open();
                    db.ExecuteNonQuery("INSERT INTO BattleVideoSearchHistory5 (Metagame, Species, " +
                                       "Country, Region, Special) VALUES (@metagame, @species, @country, @region, @special)",
                                       new MySqlParameter("@metagame", (int)meta),
                                       new MySqlParameter("@species", (int)species),
                                       new MySqlParameter("@country", (int)country),
                                       new MySqlParameter("@region", (int)region),
                                       new MySqlParameter("@special", (int)special));
                    db.Close();
                }
            }

            QueueSearchResults(response);
        }
 public static void QueueSpecial(int pid, SearchSpecial special)
 {
     QueueSearch(pid, special, 0x0000, SearchMetagames.None, 0x00, 0x00);
 }
Beispiel #3
0
 public static void QueueSpecial(int pid, SearchSpecial special)
 {
     QueueSearch(pid, special, 0x0000, SearchMetagames.None, 0x00, 0x00);
 }
        public static void QueueSearch(int pid, SearchSpecial special, ushort species, SearchMetagames meta, byte country, byte region)
        {
            switch (special)
            {
                case SearchSpecial.Latest30:
                    Console.WriteLine("Searching for latest 30 videos.");
                    break;
                case SearchSpecial.TopLinkBattles:
                    Console.WriteLine("Searching for top link battles.");
                    break;
                case SearchSpecial.TopSubwayBattles:
                    Console.WriteLine("Searching for top Subway battles.");
                    break;
                default:
                    {
                        Console.Write("Searching for ");
                        if (species != 0xffff)
                            Console.Write("species {0}, ", species);
                        if (meta != SearchMetagames.None)
                            Console.Write("{0}, ", meta);
                        if (country != 0xff)
                            Console.Write("country {0}, ", region);
                        if (region != 0xff)
                            Console.Write("region {0}", region);
                    } break;
            }

            byte[] data = new byte[0x15c];
            MemoryStream request = new MemoryStream(data);
            request.Write(new byte[4], 0, 4); // length goes here, see end
            request.Write(new byte[] { 0xf1, 0x55, 0x00, 0x00 }, 0, 4); // request type, sanity 0000
            request.Write(BitConverter.GetBytes(pid), 0, 4); // pid, hopefully this doesn't ban me
            request.Write(new byte[] { 0x14, 0x02 }, 0, 2);

            WriteBase64shit(request);

            request.Write(new byte[0xda], 0, 0xda);

            request.Write(BitConverter.GetBytes((uint)special), 0, 4);
            request.Write(BitConverter.GetBytes(species), 0, 2);
            request.Write(BitConverter.GetBytes((uint)meta), 0, 4);
            request.WriteByte(country);
            request.WriteByte(region);

            request.Write(new byte[] {
                                        0x64, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00
            }, 0, 16);
            request.Flush();
            PutLength(data);

            byte[] response = Conversation(data);

            if (special != SearchSpecial.Latest30)
            {
                using (MySqlConnection db = CreateConnection())
                {
                    db.Open();
                    db.ExecuteNonQuery("INSERT INTO BattleVideoSearchHistory5 (Metagame, Species, " +
                        "Country, Region, Special) VALUES (@metagame, @species, @country, @region, @special)",
                        new MySqlParameter("@metagame", (int)meta),
                        new MySqlParameter("@species", (int)species),
                        new MySqlParameter("@country", (int)country),
                        new MySqlParameter("@region", (int)region),
                        new MySqlParameter("@special", (int)special));
                    db.Close();
                }
            }

            QueueSearchResults(response);
        }