Example #1
0
        public List <string> SplitContents(string rawString)
        {
            var temp = rawString.Split('\n');

            this.ContentProgressStatus         = new LimitedValue();
            this.ContentProgressStatus.Max     = temp.Count();
            this.ContentProgressStatus.Min     = 0;
            this.ContentProgressStatus.Current = 0;

            List <string> translated = new List <string>();

            foreach (var item in temp.ToList())
            {
                translated.Add(GrandcypherClient.Current.ScenarioHooker.Translator(item, GrandcypherClient.Current.ScenarioHooker.TranslateSite));
                this.ContentProgressStatus.Current++;
                this.ContentProgress();
            }
            return(translated);
        }
Example #2
0
        private void NoticeDetail(Session oS)
        {
            this.NoticeListLoad();

            if (this.NoticeLists == null)
                this.NoticeLists = new List<NoticeInfo>();
            else
            {
                this.NoticeLists.Clear();
                this.NoticeLists.TrimExcess();
            }
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic test = jsonFull;
            dynamic list = test.list;

            List<dynamic> NoticeList = new List<dynamic>();

            for (int i = 0; i < list.Count; i++)
            {
                NoticeList.Add(list[i]);
            }

            this.ProgressStatus = new LimitedValue();
            this.ProgressStatus.Max = NoticeList.Count;
            this.ProgressStatus.Min = 0;
            this.ProgressStatus.Current = 0;

            this.ProgressBar();

            for (int i = 0; i < NoticeList.Count; i++)
            {
                NoticeInfo temp = new NoticeInfo
                {
                    contents = NoticeList[i].contents,
                    title = NoticeList[i].title,
                    date = NoticeList[i].date,
                    created_at = NoticeList[i].created_at,
                    updated_at = NoticeList[i].updated_at,
                };
                temp.contents = GrandcypherClient.Current.ScenarioHooker.RemoveWebTag(temp.contents, false);
                temp.contents = temp.contents.Replace("「", "[");
                temp.contents = temp.contents.Replace("」", "]");

                temp.title = temp.title.Replace("「", "[");
                temp.title = temp.title.Replace("」", "]");

                temp.TrContents = SplitContents(temp.contents);
                temp.TrTitle = GrandcypherClient.Current.ScenarioHooker.Translator(GrandcypherClient.Current.ScenarioHooker.RemoveWebTag(temp.title), GrandcypherClient.Current.ScenarioHooker.TranslateSite);

                NoticeLists.Add(temp);
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }
            this.LoadingEnd();
        }
Example #3
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();
        }