예제 #1
0
        private void GreetHook(Session oS, bool IsGuildMessage = false)
        {
            this.ReadStart();
            GreetList = new List <UserIf>();
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;

            dynamic test     = jsonFull;
            dynamic list     = test.list;
            int     MaxCount = 0;

            foreach (var item in list)
            {
                MaxCount++;
            }
            this.ProgressStatus         = new LimitedValue();
            this.ProgressStatus.Max     = MaxCount;
            this.ProgressStatus.Min     = 0;
            this.ProgressStatus.Current = 0;

            foreach (var item in list)
            {
                UserIf temp = new UserIf();
                temp.UserComment = new UserComment();
                string userName, userComment, userLevel, userTime;

                JProperty SkillProperty = item;
                var       Firsts        = SkillProperty.First;
                if (IsGuildMessage)
                {
                    userName    = "******";
                    userComment = "user_comment";
                    userLevel   = "user_level";
                    userTime    = "chat_time";
                }
                else
                {
                    userName    = "******";
                    userComment = "from_user_comment";
                    userLevel   = "from_user_level";
                    userTime    = "from_greet_time";
                }
                temp.from_user_name = (string)Firsts[userName];
                int userlevelint = (int)Firsts[userLevel];
                temp.from_greet_time      = (string)Firsts[userTime];
                temp.from_user_level      = "Rank " + userlevelint.ToString();
                temp.UserComment.text     = (string)Firsts[userComment]["text"];
                temp.UserComment.is_stamp = (bool)Firsts[userComment]["is_stamp"];
                if (temp.UserComment.is_stamp)
                {
                    temp.UserComment = ReturnStampImage(temp.UserComment);
                }
                temp.UserComment.text   = GrandcypherClient.Current.ScenarioHooker.RemoveWebTag(temp.UserComment.text);
                temp.UserComment.TrText = GrandcypherClient.Current.ScenarioHooker.Translator(temp.UserComment.text, GrandcypherClient.Current.ScenarioHooker.TranslateSite);

                GreetList.Add(temp);
#if DEBUG
                Console.WriteLine("=======================================================");
                Console.WriteLine(temp.from_user_name + " : " + temp.UserComment.text);
                Console.WriteLine(temp.from_user_name + " : " + temp.UserComment.TrText);
                Console.WriteLine("Stamp Url: " + temp.UserComment.StampUrl);
#endif
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }
            this.TranslatieEnd();
        }
예제 #2
0
        private void GreetHook(Session oS, bool IsGuildMessage = false)
        {
            this.ReadStart();
            GreetList = new List<UserIf>();
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;

            dynamic test = jsonFull;
            dynamic list = test.list;
            int MaxCount = 0;
            foreach (var item in list)
            {
                MaxCount++;
            }
            this.ProgressStatus = new LimitedValue();
            this.ProgressStatus.Max = MaxCount;
            this.ProgressStatus.Min = 0;
            this.ProgressStatus.Current = 0;

            foreach (var item in list)
            {
                UserIf temp = new UserIf();
                temp.UserComment = new UserComment();
                string userName, userComment, userLevel, userTime;

                JProperty SkillProperty = item;
                var Firsts = SkillProperty.First;
                if (IsGuildMessage)
                {
                    userName = "******";
                    userComment = "user_comment";
                    userLevel = "user_level";
                    userTime = "chat_time";
                }
                else
                {
                    userName = "******";
                    userComment = "from_user_comment";
                    userLevel = "from_user_level";
                    userTime = "from_greet_time";
                }
                temp.from_user_name = (string)Firsts[userName];
                int userlevelint = (int)Firsts[userLevel];
                temp.from_greet_time = (string)Firsts[userTime];
                temp.from_user_level = "Rank " + userlevelint.ToString();
                temp.UserComment.text = (string)Firsts[userComment]["text"];
                temp.UserComment.is_stamp = (bool)Firsts[userComment]["is_stamp"];
                if (temp.UserComment.is_stamp)
                {
                    temp.UserComment = ReturnStampImage(temp.UserComment);
                }
                temp.UserComment.text = GrandcypherClient.Current.ScenarioHooker.RemoveWebTag(temp.UserComment.text);
                temp.UserComment.TrText = GrandcypherClient.Current.ScenarioHooker.Translator(temp.UserComment.text, GrandcypherClient.Current.ScenarioHooker.TranslateSite);

                GreetList.Add(temp);
            #if DEBUG
                Console.WriteLine("=======================================================");
                Console.WriteLine(temp.from_user_name + " : " + temp.UserComment.text);
                Console.WriteLine(temp.from_user_name + " : " + temp.UserComment.TrText);
                Console.WriteLine("Stamp Url: " + temp.UserComment.StampUrl);
            #endif
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }
            this.TranslatieEnd();
        }