public static ServerUploadFilter Create(List <PokemonId> pokemon)
        {
            ServerUploadFilter serverUploadFilter = new ServerUploadFilter();

            var pokemonsBinary = PokemonFilterToBinary.ToBinary(pokemon);

            serverUploadFilter.Pokemon    = pokemonsBinary;
            serverUploadFilter.AreaBounds = GlobalSettings.UseGeoLocationBoundsFilter ? GlobalSettings.GeoLocationBounds : null;

            return(serverUploadFilter);
        }
Example #2
0
        public void StartTest()
        {
            //var server = new Server();
            //Task.Run(() => server.Start());
            List <PokemonId> pokemons = Enum.GetValues(typeof(PokemonId)).Cast <PokemonId>().ToList();
            var cookieMonster         = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("filter", PokemonFilterToBinary.ToBinary(pokemons))
            };

            using (var client = new WebSocket("ws://*****:*****@"I've come to talk with you again");
                };

                long timeStamp = default(long);

                client.MessageReceived += (s, e) =>
                {
                    Console.WriteLine($"Client rec: {e.Message}");

                    try
                    {
                        var match = Regex.Match(e.Message, @"^(1?\d+):.*$");
                        if (match.Success)
                        {
                            timeStamp = Convert.ToInt64(match.Groups[1].Value);
                            Console.WriteLine($"Client rec: {e.Message}");
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                };
                client.Error += (s, e) =>
                {
                    Console.WriteLine($"Client error rec: {e.Exception}");
                };
                client.Open();

                for (int i = 0; i < 30; i++)
                {
                    client.Send($"{timeStamp}:I've come to talk with you again");
                    Thread.Sleep(1000);
                }
                client.Close();
            }
            Thread.Sleep(2000);
        }
Example #3
0
        public static Filter Create(List <DiscordChannels> discordChannels = null)
        {
            List <PokemonId> pokemons = GlobalSettings.UseFilter
                ? PokemonParser.ParsePokemons(new List <string>(GlobalSettings.PokekomsToFeedFilter))
                : Enum.GetValues(typeof(PokemonId)).Cast <PokemonId>().ToList();
            var            pokemonsBinary = PokemonFilterToBinary.ToBinary(pokemons);
            List <Channel> channelInfos   = new List <Channel>();

            if (discordChannels != null && discordChannels.Any())
            {
                foreach (DiscordChannels discordChannel in discordChannels)
                {
                    channelInfos.Add(new Channel()
                    {
                        Server = discordChannel.Server, ChannelName = discordChannel.Name
                    });
                }
            }
            if (GlobalSettings.UsePokeSnipers)
            {
                channelInfos.Add(new Channel()
                {
                    Server = PokeSnipersRarePokemonRepository.Channel
                });
            }
            if (GlobalSettings.UsePokemonGoIVClub)
            {
                channelInfos.Add(new Channel()
                {
                    Server = PokemonGoIVClubRarePokemonRepository.Channel
                });
            }
            if (GlobalSettings.UsePokewatchers)
            {
                channelInfos.Add(new Channel()
                {
                    Server = PokeWatchersRarePokemonRepository.Channel
                });
            }
            if (GlobalSettings.UseTrackemon)
            {
                channelInfos.Add(new Channel()
                {
                    Server = TrackemonRarePokemonRepository.Channel
                });
            }
            if (GlobalSettings.UsePokezz)
            {
                channelInfos.Add(new Channel()
                {
                    Server = PokezzRarePokemonRepository.Channel
                });
            }
            if (GlobalSettings.UsePokeSnipe)
            {
                channelInfos.Add(new Channel()
                {
                    Server = PokeSnipeRarePokemonRepository.Channel
                });
            }
            channelInfos.Add(new Channel()
            {
                Server = Constants.PogoFeeder
            });
            channelInfos.Add(new Channel()
            {
                Server = Constants.Bot
            });

            var filter = new Filter();

            filter.Channels                    = channelInfos;
            filter.Pokemon                     = pokemonsBinary;
            filter.VerifiedOnly                = GlobalSettings.VerifiedOnly;
            filter.Version                     = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            filter.AreaBounds                  = GlobalSettings.UseGeoLocationBoundsFilter ? GlobalSettings.GeoLocationBounds : null;
            filter.MinimumIV                   = GlobalSettings.MinimumIV;
            filter.UnverifiedOnly              = GlobalSettings.UnverifiedOnly;
            filter.UseUploadedPokemon          = GlobalSettings.UseUploadedPokemon;
            filter.PokemonNotInFilterMinimumIV = GlobalSettings.PokemonNotInFilterMinimumIV;
            return(filter);
        }