Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        public void Do(int no, StrCmpType cmpType)
        {
            MatchCollection results;
            Regex           regex;

            if (this.procType == EngineType.CS2)
            {
                regex = new Regex(@"^([^\x01-\x7E]+)(\r\n\t)(.+)\r", RegexOptions.Multiline);
            }
            else
            //if (this.procType == EngineType.EngineType_yuris)
            {
                regex = new Regex(@"(.*)\r\n【(.*)】(.+)\r", RegexOptions.Multiline);
            }

            string newStr, serifText, voiceName, destText, charName;

            results = regex.Matches(this.textFileList[no].textData);
            foreach (Match tmp in results)
            {
                string tmpStr = tmp.Groups[1].ToString();
                if (this.procType == EngineType.yuris && tmpStr.IndexOf("\\VO") != -1)
                {
                    continue;                                                                           //名前の前に\voがあるならスルー。
                }
                if (this.procType == EngineType.CS2 && tmpStr.IndexOf(" pcm") != -1)
                {
                    continue;                                                                        //名前の前にpcmがあるならスルー。
                }
                if (this.procType == EngineType.CS2)
                {
                    serifText = tmp.Groups[3].ToString();
                    destText  = tmp.Groups[1].ToString() + tmp.Groups[2].ToString() + tmp.Groups[3].ToString();
                    serifText = serifText.Replace("\\@", "");
                }
                else
                //if (this.procType == EngineType.EngineType_yuris)
                {
                    serifText = tmp.Groups[3].ToString();
                    destText  = "【" + tmp.Groups[2].ToString() + "】" + tmp.Groups[3].ToString();
                }

                charName  = (this.procType == EngineType.CS2 ?  tmp.Groups[1].ToString() : tmp.Groups[2].ToString());
                voiceName = this.VoiceNameGet(serifText, charName, cmpType);
                if (this.procType == EngineType.CS2)
                {
                    newStr = "\t" + @"pcm " + voiceName + Environment.NewLine + tmp.Groups[1].ToString() + tmp.Groups[2].ToString() + tmp.Groups[3].ToString();
                }
                else
                {
                    newStr = @"\VO(" + voiceName + ")" + Environment.NewLine + "【" + tmp.Groups[2].ToString() + "】" + tmp.Groups[3].ToString();
                }

                //実際にボイスなしセリフにボイスを追加置換。
                if (voiceName != "")
                {
                    this.textFileList[no].textData = this.textFileList[no].textData.Replace(destText, newStr);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public bool Proc(string scenarioPath, string takecheckPath, EngineType type, StrCmpType cmpType)
        {
            this.procType = type;

            ScriptDataLoad(scenarioPath);

            TakeDataLoad(takecheckPath);

            for (int i = 0; i < this.textFileList.Count; i++)
            {
                Do(i, cmpType);
            }

            return(true);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="searchText"></param>
        /// <returns></returns>
        public string VoiceNameGet(string searchText, string charName, StrCmpType cmpType)
        {
            string ret = "";

            bool  isDo     = false;
            float sameRate = 1.0f;

            //キャラ名でディクショナリーゲット
            if (takeCheckData.takeDataDic.TryGetValue(charName, out list) == false)
            {
                return(ret);
            }

            foreach (var tmp in list)
            {
                if (cmpType == StrCmpType.StrCmpType_SAME)
                {
                    if (tmp.serifText.IndexOf(searchText) != -1 && tmp.hitCount == 0)
                    {
                        isDo = true;
                    }
                }
                else
                {
                    sameRate = LevenshteinRate(searchText, tmp.serifText);
                    if (cmpType == StrCmpType.StrCmpType_80 && sameRate <= 0.2f)
                    {
                        isDo = true;
                    }
                    if (cmpType == StrCmpType.StrCmpType_60 && sameRate <= 0.4f)
                    {
                        isDo = true;
                    }
                }

                //テキストの比較
                if (isDo)
                {
                    tmp.hitCount++;
                    ret = tmp.voiceText;
                    break;
                }
            }
            return(ret);
        }