예제 #1
0
        private void AddSearchEntry(MieTransSheetEntry mieTransSheetEntry)
        {
            var newEntry = mieTransSheetEntry;
            var numNew   = JapaneseStringUtils.TJapaneseStringUtils.NumJapaneseChars(newEntry.DefaultTranslationText);

            if (numNew == 0)
            {
                return;
            }

            IDictionary <string, MieTransSheetEntry> items = null;

            switch (newEntry.LanguageType)
            {
            case Product.MieProduct.NLanguageType.Chatter:
                break;

            case Product.MieProduct.NLanguageType.Conversations:
                items = this.SearchConvItems;
                break;

            case Product.MieProduct.NLanguageType.Game:
                items = this.SearchGameItems;
                break;

            case Product.MieProduct.NLanguageType.Quests:
                items = this.SearchQuestsItems;
                break;

            default:
                throw new Exception($"Unknown LanguageType({newEntry.LanguageType}).");
            }

            var keyNew = this.GetDiscardedText(mieTransSheetEntry.DefaultText);

            if (items.ContainsKey(keyNew))
            {
                var oldEntry = items[keyNew];
                var keyOld   = this.GetDiscardedText(oldEntry.DefaultText);
                var numOld   = JapaneseStringUtils.TJapaneseStringUtils.NumJapaneseChars(oldEntry.DefaultTranslationText);

                if (numOld < numNew)
                {
                    //// 日本語の文字数が多いので入れ替え
                    items.Remove(keyOld);
                    items.Add(keyNew, mieTransSheetEntry);
                }
            }
            else
            {
                items.Add(keyNew, mieTransSheetEntry);
            }
        }
예제 #2
0
 public void AddEntry(MieTransSheetEntry mieTransSheetEntry)
 {
     if (this.Items.ContainsKey(mieTransSheetEntry.ID))
     {
         var msg = $"Duplicate trans sheet entry({mieTransSheetEntry.ID}) FileID({this.FileID})";
         logger.Error(msg);
         throw new Exception(msg);
     }
     else
     {
         this.Items.Add(mieTransSheetEntry.ID, mieTransSheetEntry);
     }
 }
예제 #3
0
        public void AddEntry(MieTransSheetEntry entry)
        {
            if (this.Items.ContainsKey(entry.FileID))
            {
                var sheetFile = this.Items[entry.FileID];
                sheetFile.AddEntry(entry);
            }
            else
            {
                var mieTransSheetFile = new MieTransSheetFile(entry.FileID);
                this.Items.Add(mieTransSheetFile.FileID, mieTransSheetFile);
                mieTransSheetFile.AddEntry(entry);
            }

            this.AddSearchEntry(entry);
        }