Esempio n. 1
0
        public static async Task <string> Replace(string word)
        {
            if (banned_word_list == null)
            {
                banned_word_list = await BannedWordQuery.GetBannedWord();
            }

            string resultWord = null;

            resultWord = word;
            string replaceWord = null;

            foreach (var banned_word in banned_word_list)
            {
                if (resultWord.Contains(banned_word) == true)
                {
                    for (int i = 0; i < banned_word.Length; i++)
                    {
                        replaceWord = replaceWord + "*";
                    }
                    resultWord  = resultWord.Replace(banned_word, replaceWord);
                    replaceWord = null;
                }
            }

            return(resultWord);
        }
Esempio n. 2
0
        public static async Task <bool> Check(string word)
        {
            if (banned_word_list == null)
            {
                banned_word_list = await BannedWordQuery.GetBannedWord();
            }

            foreach (var banned_word in banned_word_list)
            {
                if (word.Contains(banned_word) == true)
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 3
0
        public static void QueryListUp()
        {
            Task.Run(async() =>
            {
                try
                {
                    //await MemberQuery.GetMember("G310f55c2d9ad4c068a80fb0bcdc3d96e");
                    //await MemberQuery.AddMember(new Models.Member() { player_id = "test", last_play_time = DateTime.UtcNow });
                    //await MemberQuery.UpdateMember(5996, 1);
                    //await MemberQuery.UpdateMember(5996, "test234dfasd");

                    //await UserQuery.GetUser(4888);
                    //await UserQuery.UpdateUser(4888, 0);
                    //await UserQuery.AddUser(new Models.User() { });
                    //await UserQuery.UpdateUser(new Models.User() {user_no = 4888, battle_coin = 1});

                    //await new CharacterQuery().Gets(5335);
                    //await new CharacterQuery().Get(2682);
                    //await new CharacterQuery().Insert(new Models.Character() { user_no = 5335, character_type = 7});
                    //await new CharacterQuery().Update(new Models.Character() { character_no = 2782, user_no = 5335, character_level = 1});
                    //await CharacterQuery.Remove(new Models.Character() { character_no = 2782, user_no = 5335, character_level = 1 });

                    //await new ShopQuery().Gets(5335);
                    //await new ShopQuery().Get(15);
                    //await new ShopQuery().Insert(new Models.Shop() { user_no = 5335, shop_id = 1, occ_time = DateTime.UtcNow, shop_item_id = 0, quantity = 0, purchase_count = 0 });
                    //await new ShopQuery().Update(new Models.Shop() { shop_no= 183, user_no = 5335, shop_id = 1, occ_time = DateTime.UtcNow, shop_item_id = 0, quantity = 0, purchase_count = 1 });
                    //await ShopQuery.Remove(new Models.Shop() { shop_no= 183, user_no = 5335, shop_id = 1, occ_time = DateTime.UtcNow, shop_item_id = 0, quantity = 0, purchase_count = 1 });

                    //await new MissionQuery().Gets(5335);
                    //await new MissionQuery().Get(26);
                    //await new MissionQuery().Insert(new Models.Mission() { user_no = 5335, mission_base_id = 2, occ_time = DateTime.UtcNow });
                    //await new MissionQuery().Update(new Models.Mission() { user_no = 5335, mission_base_id = 2, occ_time = DateTime.UtcNow, mission_no = 42 });
                    //await MissionQuery.Remove(new Models.Mission() { user_no = 5335, mission_base_id = 2, occ_time = DateTime.UtcNow, mission_no = 42 });

                    //History.Info(1, 1, HistoryLogAction.Login, HistoryLogReason.None, 0, 0, "", "");


                    await BannedWordQuery.GetBannedWord();
                }
                catch (Exception ex)
                {
                    Log.Information(ex.ToString());
                }
            });
        }
Esempio n. 4
0
        public static void Test()
        {
            TestMail().Wait();

            TestString();

            var r111 = TestRanking().Result;

            return;

            {
                var values = new StackExchange.Redis.SortedSetEntry[]
                {
                    new StackExchange.Redis.SortedSetEntry("a:1", 0),
                    new StackExchange.Redis.SortedSetEntry("b:2", 0),
                    new StackExchange.Redis.SortedSetEntry("c:3", 0),
                    new StackExchange.Redis.SortedSetEntry("d:4", 0),
                    new StackExchange.Redis.SortedSetEntry("e:5", 0),
                    new StackExchange.Redis.SortedSetEntry("f:6", 0),
                    new StackExchange.Redis.SortedSetEntry("g:7", 0),
                };

                Cache.Instance.GetDatabase().SortedSetAdd("myzset", values);

                var redis_ret = Cache.Instance.GetDatabase().SortedSetRangeByValue("myzset", "c:", "+", StackExchange.Redis.Exclude.Start, 0, 1, StackExchange.Redis.CommandFlags.None);
                //var redis_ret = Cache.Instance.GetDatabase().SortedSetRangeByValue("myzset", "c:", "c:");
            }



            {
                var r21 = PlayerLog.GetPlayerInfo("990252821976346", 6029, 6029).Result;

                var r22 = WebAPIClient.Web.writeLog("990252821976346", "/log/writeActionLog", JsonConvert.SerializeObject(new ActionLog(r21)
                {
                    category = "캐릭터", action = "획득", label = "1"
                }));
            }

            {
                var ret_a = core.MathHelpers.GetResetTime("00:00:00", new DateTime(2020, 11, 13, 9, 10, 3));
                var ret_b = core.MathHelpers.GetResetTime("00:00:00", new DateTime(2020, 11, 14, 0, 0, 0));

                if (ret_a != ret_b)
                {
                }
            }


            var first  = new DateTime(2020, 9, 6);
            var second = new DateTime(2020, 9, 7);

            var dif2 = core.MathHelpers.weekDiff(first, second);

            first  = new DateTime(2020, 9, 8);
            second = new DateTime(2020, 9, 7);
            dif2   = core.MathHelpers.weekDiff(first, second);

            using (var context = new Lobby.Models.GameContext(0))
            {
                try
                {
                    var rows = context.shop.ToList();

                    foreach (var row in rows)
                    {
                        row.Clear();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }


            Task.Run(async() =>
            {
                await using (var user = await UserCache.GetUser(0, 4888, true, true))
                {
                    user.medal_charge_time = DateTime.UtcNow;
                    user.IsDirty           = true;
                    //UserQuery.UpdateUserMedalCharge(user).Wait();
                }
            });



            return;

            var list = BannedWordQuery.GetBannedWord().Result;


            //bool isLetter = false;
            if (Char.IsLetterOrDigit("test한글", 0))
            {
                //isLetter = true;
            }


            string letter = "test한글&\n";
            var    sret   = letter.IsLetterOrDigit();

            letter = "test한글111";
            sret   = letter.IsLetterOrDigit();


            //var r33 = UserQuery.UpdateUser(2672, "test15").Result;

            Task.Run(async() =>
            {
                //await LobbyService.LoadUserInfo(2672);
                //await LobbyService.LoadUserInfo(2672);

                var characters = await CharacterCache.Instance.GetEntities(0, 2672, true);

                await CharacterCache.Instance.RemoveEntity(0, characters[0]);

                await CharacterCache.Instance.RemoveEntities(0, 2672);

                characters = await CharacterCache.Instance.GetEntities(0, 2672, false);
            });

            Task.Run(async() =>
            {
                await using (var mylock = await RedLock.CreateLockAsync("lock:character:1"))
                {
                    var ret = mylock.IsAcquired;
                }
            });

            Task.Run(async() =>
            {
                await using (var mylock = await RedLock.CreateLockAsync("lock:character:1"))
                {
                    var ret = mylock.IsAcquired;
                }
            });

            var r  = WebAPIClient.Web.validate("990252821976346", "fwPla7fQ8ty9+DZT/lD//opW3OMPm7j2xvs2KuD+uYr9sjDBcwhG6af5snAmhRvRlplBuo/unVh4Ugt9HD7BWi2WfhT1va61xImzER4+UZzS7WO986OqafxFUTWyLV/k5UWPbS3ijhByFvqFR9j1kYk15clNysZGWi92KZTFr2BzzZ3rCKzcT6oVZjBFc3TqObRQBTI/40qwze1NQA7qReTr6OzO45hUebMuluFiHac=").Result;
            var r2 = WebAPIClient.Web.getInfo("990252821976346").Result;
            var r3 = WebAPIClient.Web.request("990252821976346", "/player/memberKey/get").Result;

            TestHttpClient().ConfigureAwait(false);


            //var charac = CharacterCache.InsertCharacter(new Models.Character() { user_no = 4 }).Result;


            var ret  = CharacterCache.Instance.GetEntities(0, 2019, true).Result;
            var ret2 = CharacterCache.Instance.GetEntities(0, 2019, true).Result;

            //WebAPIClient.Web.test();
            TestRankSeq();

            Lobby.Models.CommonContext.test();
            Lobby.Models.GameContext.test();
            Lobby.Models.LogContext.test();


            Task.Run(async() => await TestCache());
        }