Пример #1
0
        public bool ConvertTag()
        {
            pgb.Minimum = 0;
            pgb.Maximum = listText.Count;
            pgb.Value   = 0;

            char[] splitChar = { '[', ']' };
            foreach (CTextData data in listText)
            {
                string[] words = data.Text.Split(splitChar);

                for (int i = 1; i < words.Length; i = i + 2)
                {
                    if (words[i] == "user" || words[i] == "class" || words[i] == "race")
                    {
                        continue;
                    }

                    // Text All Data에서 ID를 검색한다.
                    string strConvertText = TextAllDataTable.ConvertTag(words[i]);
                    if (strConvertText != null)
                    {
                        data.Text = data.Text.Replace("[" + words[i] + "]", "[" + strConvertText + "]");
                    }
                }

                pgb.Value = Math.Min(pgb.Maximum, pgb.Value + 1);
            }
            return(true);
        }
Пример #2
0
        void ReplaceTag(Excel.Range rng, LocalizeSource localize)
        {
            char[]        splitChar = { '[', ']' };
            StringBuilder sbText    = new StringBuilder();
            StringBuilder sbOrg     = new StringBuilder();
            StringBuilder sbNew     = new StringBuilder();
            string        text      = null;

            // 스페이스만 있는 경우도 있다. 이 경우도 @처리
            text = rng.Value2.ToString();
            text = text.TrimStart(' ');
            if (text != "")
            {
                sbText.Length = 0;
                sbText.Append(text);

                string[] words          = text.Split(splitChar);
                string   strConvertText = null;
                for (int k = 1; k < words.Length; k = k + 2)
                {
                    if (words[k] == "user" || words[k] == "class" || words[k] == "race" || words[k] == "br")
                    {
                        continue;
                    }

                    // Text All Data에서 ID를 검색한다.
                    if (localize == LocalizeSource.LOCAL_KOREAN)
                    {
                        strConvertText = TextAllDataTable.ConvertTag(words[k]);
                    }
                    else if (localize == LocalizeSource.LOCAL_JAPANESE)
                    {
                        strConvertText = TextAllDataTable.ConvertJapanText(words[k]);
                    }

                    if (strConvertText != null)
                    {
                        sbOrg.Length = 0;
                        sbNew.Length = 0;

                        sbOrg.Append("[");
                        sbOrg.Append(words[k]);
                        sbOrg.Append("]");

                        sbNew.Append("[");
                        sbNew.Append(strConvertText);
                        sbNew.Append("]");

                        sbText.Replace(sbOrg.ToString(), sbNew.ToString());
                    }
                }

                rng.Value2 = sbText.ToString();
            }
        }