/// <summary>
        /// 指定したフォルダー内の会話ファイルを読み込み会話情報を返す。
        /// </summary>
        /// <param name="folderPath">フォルダーのパス</param>
        /// <param name="fileList">FileLIst</param>
        /// <returns>会話情報</returns>
        public static MieConversationNodeInfo LoadFromFolder(string folderPath, MieFileList fileList)
        {
            MieConversationNodeInfo mieConversationInfo = new MieConversationNodeInfo();

            if (!Directory.Exists(folderPath))
            {
                var msg = $"Error: Folder not exists. Folder({folderPath})";
                logger.Error(msg);
                throw new Exception(msg);
            }

            string[] files = Directory.GetFiles(folderPath, "*.conversationbundle", SearchOption.AllDirectories);
            files
            .Where(file => Path.GetExtension(file).ToLower() == ".conversationbundle")
            .ToList()
            .ForEach(x =>
            {
                var convFile = LoadFromJson(x, fileList);
                if (convFile != null)
                {
                    mieConversationInfo.AddFile(convFile);
                }
            });

            return(mieConversationInfo);
        }
Exemplo n.º 2
0
        /// <summary>
        /// FileList
        /// </summary>
        /// <param name="systemDb">SystemDB</param>
        /// <param name="fileList">FileListオブジェクト</param>
        /// <param name="updateMode">更新モード</param>
        public static void SaveToSystemDB(MieSystemDB systemDb, MieFileList fileList, NUpdateMode updateMode)
        {
            using (SQLiteTransaction trans = systemDb.Connection.BeginTransaction())
            {
                SQLiteCommand cmd = systemDb.Connection.CreateCommand();
                switch (updateMode)
                {
                case NUpdateMode.Add:
                    cmd.CommandText = "INSERT INTO FileList VALUES(@FileCode,@FileID,@LanguageType,@UpdatedAt);";
                    ExecuteUpsertCommand(cmd, fileList);
                    break;

                case NUpdateMode.Update:
                    cmd.CommandText = "REPLACE INTO FileList VALUES(@FileCode,@FileID,@LanguageType,@UpdatedAt);";
                    ExecuteUpsertCommand(cmd, fileList);
                    break;

                case NUpdateMode.Delete:
                    cmd.CommandText = "DELETE FROM FileList WHERE FileCode = @FileCode";
                    ExecuteDeleteCommand(cmd, fileList);
                    break;

                default:
                    var msg = $"Unknown Update Mode({updateMode}).";
                    logger.Fatal(msg);
                    throw new InvalidEnumArgumentException(msg);
                }

                trans.Commit();
            }
        }
        /// <summary>
        /// FileListのDB化。
        /// </summary>
        /// <param name="systemDb">データベース接続情報</param>
        /// <param name="fileList">FileList</param>
        public void ConvertFileList(MieSystemDB systemDb, MieFileList fileList)
        {
            var         oldFileList    = MieTableFileListDao.LoadFromSystemDB(systemDb);
            MieFileList fileListAdd    = fileList.GetAdd(oldFileList);
            MieFileList fileListUpdate = fileList.GetUpdate(oldFileList);

            MieTableFileListDao.SaveToSystemDB(systemDb, fileListAdd, MieTableFileListDao.NUpdateMode.Add);
            MieTableFileListDao.SaveToSystemDB(systemDb, fileListUpdate, MieTableFileListDao.NUpdateMode.Update);
        }
Exemplo n.º 4
0
        /// <summary>
        /// チャッター付加情報ファイルを読み込み、チャッターノード情報を返す。
        /// チャッター付加情報は1ファイルの中に複数ファイルの情報が格納されている。
        /// </summary>
        /// <param name="path">チャッター付加情報ファイルのパス</param>
        /// <param name="fileList">ファイルリストのパス</param>
        /// <returns>チャッターノード情報</returns>
        public static MieChatterNodeInfo LoadFromJson(string path, MieFileList fileList)
        {
            MieChatterNodeInfo mieChatterInfo = new MieChatterNodeInfo();

            string ctext = LoadJson(path);

            ctext = ctext.Replace("$type", "MieChatterNodeDataTypeTag");
            CreateChatterInfo(ctext, mieChatterInfo, fileList);

            return(mieChatterInfo);
        }
Exemplo n.º 5
0
        private static void ExecuteDeleteCommand(SQLiteCommand cmd, MieFileList fileList)
        {
            //// パラメータのセット
            cmd.Parameters.Add("FileCode", System.Data.DbType.Int64);
            foreach (var file in fileList.Items.Values)
            {
                //// SystemDBにデータがない場合のみ登録する。
                cmd.Parameters["FileCode"].Value = file.FileCode;

                cmd.ExecuteNonQuery();
            }
        }
Exemplo n.º 6
0
 public void LoadFromFolder(
     string folderPath,
     MieProduct.NProductLine productLine,
     MieProduct.NLanguageType languageType,
     MieFileList fileList)
 {
     this.languageInfo = MieStringTableDao.LoadFromFolder(
         folderPath,
         productLine,
         languageType,
         fileList);
     Console.WriteLine(this.languageInfo.FileCount);
 }
Exemplo n.º 7
0
        /// <summary>
        /// 指定されたDBから言語情報を取得する。
        /// </summary>
        /// <param name="path">DBのパス</param>
        public MieStringMargeUtils(string path)
        {
            var systemDb = new MieSystemDB();

            systemDb.Open(path);

            var sysApp = new MieSystemDbApp();

            sysApp.LoadFromDB(systemDb);
            this.languageInfo = sysApp.LanguageInfo;
            this.fileList     = sysApp.FileList;

            systemDb.Close();
        }
        public void ConvertChatter(MieSystemDB systemDb, string chatterPath, MieFileList fileList)
        {
            if (this.LanguageInfo == null)
            {
                var msg = $"LanguageInfo が未設定です。ConvertLanguage()で言語情報を先に作成してください。";
                logger.Fatal(msg);
                throw new Exception(msg);
            }

            var chatterNodeInfo = MieChatterDesignDao.LoadFromFolder(chatterPath, fileList);

            //// NodeLink情報をDBに格納する。
            MieTableChatterNodeLinksDao.SaveToDB(systemDb, chatterNodeInfo);
            //// 付加情報(チャッター)の取得
            MieTableChatterEntriesDao.SaveToDB(systemDb, chatterNodeInfo);
        }
        public void ConvertQuests(MieSystemDB systemDb, string questsPath, MieFileList fileList)
        {
            if (this.LanguageInfo == null)
            {
                var msg = $"LanguageInfo が未設定です。ConvertLanguage()で言語情報を先に作成してください。";
                logger.Fatal(msg);
                throw new Exception(msg);
            }

            var questsNodeInfo = MieQuestsDesignDao.LoadFromFolder(questsPath, fileList);

            //// NodeLink情報をDBに格納する。
            MieTableQuestsNodeLinksDao.SaveToDB(systemDb, questsNodeInfo);
            //// 付加情報(クエスト)の取得
            MieTableQuestsEntriesDao.SaveToDB(systemDb, questsNodeInfo);
        }
Exemplo n.º 10
0
        private static void ExecuteUpsertCommand(SQLiteCommand cmd, MieFileList fileList)
        {
            //// パラメータのセット
            cmd.Parameters.Add("FileCode", System.Data.DbType.Int64);
            cmd.Parameters.Add("FileID", System.Data.DbType.String);
            cmd.Parameters.Add("LanguageType", System.Data.DbType.Int32);
            cmd.Parameters.Add("UpdatedAt", System.Data.DbType.Int64);
            foreach (var file in fileList.Items.Values)
            {
                //// SystemDBにデータがない場合のみ登録する。
                cmd.Parameters["FileCode"].Value     = file.FileCode;
                cmd.Parameters["FileID"].Value       = file.FileID;
                cmd.Parameters["LanguageType"].Value = (int)file.LanguageType;
                cmd.Parameters["UpdatedAt"].Value    = file.UpdateAt.Ticks;

                cmd.ExecuteNonQuery();
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 指定したフォルダー内のクエストファイルを読み込みクエスト情報を返す。
        /// </summary>
        /// <param name="folderPath">フォルダーのパス</param>
        /// <param name="fileList">FileList</param>
        /// <returns>クエスト情報</returns>
        public static MieQuestsNodeInfo LoadFromFolder(string folderPath, MieFileList fileList)
        {
            MieQuestsNodeInfo mieQuestsInfo = null;

            if (!Directory.Exists(folderPath))
            {
                var msg = $"Error: Folder not exists. Folder({folderPath})";
                logger.Error(msg);
                throw new Exception(msg);
            }

            string[] files = Directory.GetFiles(folderPath, "*.questbundle", SearchOption.AllDirectories);
            files
            .Where(file => Path.GetExtension(file).ToLower() == ".questbundle")
            .ToList()
            .ForEach(x =>
            {
                var questsNodeInfo = LoadFromJson(x, fileList);
                mieQuestsInfo      = questsNodeInfo;
            });

            return(mieQuestsInfo);
        }
Exemplo n.º 12
0
        public static MieFileList LoadFromSystemDB(MieSystemDB systemDB)
        {
            MieFileList fileList = new MieFileList();

            SQLiteCommand command = systemDB.Connection.CreateCommand();

            command.CommandText = @"SELECT * FROM FileList;";
            using (SQLiteDataReader sdr = command.ExecuteReader())
            {
                while (sdr.Read() == true)
                {
                    var fileCode      = (long)sdr["FileCode"];
                    var fileID        = (string)sdr["FileID"];
                    var xLanguageType = (int)(long)sdr["LanguageType"];
                    var updatedAt     = (long)sdr["UpdatedAt"];

                    MieProduct.NLanguageType languageType = (MieProduct.NLanguageType)Enum.ToObject(typeof(MieProduct.NLanguageType), xLanguageType);
                    MieFileEntry             fileEntry    = new MieFileEntry(fileCode, fileID, languageType, updatedAt);
                    fileList.AddEntry(fileEntry);
                }
            }

            return(fileList);
        }
Exemplo n.º 13
0
        public static MieLanguageInfo LoadFromFolder(
            string folderPath,
            MieProduct.NProductLine productLine,
            MieProduct.NLanguageType languageType,
            MieFileList fileList)
        {
            var mieLanguageInfo = new MieLanguageInfo();

            string[] files = Directory.GetFiles(folderPath, "*.stringtable", SearchOption.AllDirectories);
            files
            .Where(file => Path.GetExtension(file).ToLower() == ".stringtable")
            .ToList()
            .ForEach(x =>
            {
                var fileID       = string.Empty;
                var languageFile = LoadFromXml(x, productLine, out fileID);
                //// 言語情報の登録
                mieLanguageInfo.AddFile(languageFile, false);
                //// FileListの作成
                fileList.AddEntryByFileIdAndFileCode(fileID, languageFile.FileCode, languageType);
            });

            return(mieLanguageInfo);
        }
        /// <summary>
        /// 付加情報(会話)のDB化
        /// </summary>
        /// <param name="systemDb">データベース接続情報</param>
        /// <param name="conversationPath">会話情報フォルダーのパス</param>
        /// <param name="fileList">FileList</param>
        public void ConvertConversations(MieSystemDB systemDb, string conversationPath, MieFileList fileList)
        {
            if (this.LanguageInfo == null)
            {
                var msg = $"LanguageInfo が未設定です。ConvertLanguage()で言語情報を先に作成してください。";
                logger.Fatal(msg);
                throw new Exception(msg);
            }

            //// 付加情報(会話)の取得
            var convNodeInfo = MieConversationsDesignDao.LoadFromFolder(conversationPath, fileList);

            //// NodeLink情報をDBに格納する。
            MieTableConversationNodeLinksDao.SaveToDB(systemDb, convNodeInfo);

            //// 会話情報をDBに格納する。
            MieTableConversationEntriesDao.SaveToDB(systemDb, convNodeInfo);
        }
        /// <summary>
        /// JSON形式の会話ファイルを読み込み、会話ファイルを返す。
        /// [非OE DLL]
        /// </summary>
        /// <param name="path">会話ファイルのパス</param>
        /// <param name="fileList">FileLIst</param>
        /// <returns>会話ファイル</returns>
        private static MieConversationNodeFile LoadFromJson(string path, MieFileList fileList)
        {
            MieConversationNodeFile mieConversationsFile = null;

            var ctext = LoadJson(path);

            ctext = ctext.Replace("$type", "MieFlowChartsDataTypeTag");
            var oeConversations = JsonConvert.DeserializeObject <MieOEConversations>(ctext);

            foreach (var conv in oeConversations.Conversations)
            {
                var fileID = conv.Filename.Replace(".conversation", string.Empty);
                //// FileIDを統一形式に変換する。
                fileID = MieFileUtils.ConvertFileIDToCommon(fileID);
                fileID = MieStringUtils.NormalizedFileID(fileID);

                var fileCode = fileList.GetHashByFileID(fileID);
                if (fileCode == 0)
                {
                    //// 言語情報から生成されたFileListに含まれないものは無視する。
                    continue;
                }
                else
                {
                    mieConversationsFile = new MieConversationNodeFile(fileCode);
                }

                //// ノード情報作成
                foreach (var node in conv.Nodes)
                {
                    var nodeType = GetFlowChartsDataTypeTag(node.MieFlowChartsDataTypeTag);

                    MieConversationNodeEntry conversationNode = null;

                    Guid speakerGuid;
                    if (node.SpeakerGuid == null)
                    {
                        speakerGuid = default(Guid);
                    }
                    else
                    {
                        speakerGuid = new Guid(node.SpeakerGuid);
                    }

                    Guid listenerGuid;
                    if (node.ListenerGuid == null)
                    {
                        listenerGuid = default(Guid);
                    }
                    else
                    {
                        listenerGuid = new Guid(node.ListenerGuid);
                    }

                    //// Root node は NodeIDで判断する。
                    conversationNode = new MieConversationNodeEntry(
                        nodeType,
                        node.NodeID,
                        speakerGuid,
                        listenerGuid,
                        node.NodeID == 0 ? true : false,
                        node.IsQuestionNode);

                    //// リンク情報作成
                    foreach (var link in node.Links)
                    {
                        MieConversationLink mieConversationLinks = new MieConversationLink(link.FromNodeID, link.ToNodeID);
                        mieConversationsFile.AddLinkEntry(mieConversationLinks);
                    }

                    mieConversationsFile.AddFlatNodeEntry(conversationNode);
                }

                //// キャラクターマップ情報作成
                foreach (var map in conv.CharacterMappings)
                {
                    MieCharacterMapEntry mapEntry = new MieCharacterMapEntry(new Guid(map.Guid));
                    mieConversationsFile.AddCharacterMapEntry(mapEntry);
                }
            }

            if (mieConversationsFile != null)
            {
                mieConversationsFile.BuildLink();
                mieConversationsFile.UpdateDepth();
            }

            return(mieConversationsFile);
        }
Exemplo n.º 16
0
        /// <summary>
        /// クエスト付加情報ファイルを読み込み、クエストノード情報を返す。
        /// クエスト付加情報は1ファイルの中に複数ファイルの情報が格納されている。
        /// </summary>
        /// <param name="path">クエスト付加情報ファイルのパス</param>
        /// <param name="fileList">FileList</param>
        /// <returns>クエストノード情報</returns>
        public static MieQuestsNodeInfo LoadFromJson(string path, MieFileList fileList)
        {
            MieQuestsNodeInfo mieQuestsNodeInfo = new MieQuestsNodeInfo();
            string            jtext             = LoadJson(path);

            jtext = jtext.Replace("$type", "MieQuestsNodeDataTypeTag");
            var oeQuests = JsonConvert.DeserializeObject <MieOEQuests>(jtext);

            foreach (var questFile in oeQuests.Quests)
            {
                var questTypeNumber = questFile.QuestType;

                //// QuestsFileの処理
                MieQuestsNodeFile mieQuestsNodeFile = null;

                var fileID = questFile.Filename.Replace(".quest", string.Empty);
                //// FileIDを統一形式に変換する。
                fileID = MieFileUtils.ConvertFileIDToCommon(fileID);
                fileID = MieStringUtils.NormalizedFileID(fileID);

                var fileCode = fileList.GetHashByFileID(fileID);
                if (fileCode == 0)
                {
                    //// 言語情報から生成されたFileListに含まれないものは無視する。
                    continue;
                }
                else
                {
                    mieQuestsNodeFile = new MieQuestsNodeFile(fileCode);
                    mieQuestsNodeInfo.AddFile(mieQuestsNodeFile);
                }

                //// QuestEntryの処理
                foreach (var node in questFile.Nodes)
                {
                    var  nodeType   = GetQuestNodeDataTypeTag(node.MieQuestsNodeDataTypeTag);
                    bool isRootNode = node.NodeID == 0 ? true : false;

                    var questsNode = new MieQuestsNodeEntry(
                        nodeType,
                        node.NodeID,
                        isRootNode);
                    mieQuestsNodeFile.AddFlatNodeEntry(questsNode);

                    //// EndStatusNodeを追加する。
                    AddEndStatusNode(mieQuestsNodeFile, node);

                    //// リンク情報作成
                    foreach (var link in node.Links)
                    {
                        MieQuestsLink mieQuestsLinks = new MieQuestsLink(link.FromNodeID, link.ToNodeID);
                        mieQuestsNodeFile.AddLinkEntry(mieQuestsLinks);
                    }
                }

                mieQuestsNodeFile.BuildLink();
                mieQuestsNodeFile.UpdateDepth();
            }

            return(mieQuestsNodeInfo);
        }
Exemplo n.º 17
0
        private static void OE2DB_No2(TOptions.TArgs opt)
        {
            MieSystemDB systemDb = new MieSystemDB();
            systemDb.Open(opt.FileNameSystemDB);
            MieDataConvertConversationApp convertConvApp = new MieDataConvertConversationApp();
            var productLine = MieProduct.GetProductLineFromText(opt.ProductLine);

            //// FileListの作成と言語情報のDB化。
            MieFileList fileList = new MieFileList();
            {
                var langPath = string.Empty;
                //// 会話情報の取り込み
                switch (productLine)
                {
                    case MieProduct.NProductLine.Vanilla:
                        //// チャッター情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\chatter");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Chatter, fileList);
                        //// 会話情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\conversations");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Conversations, fileList);
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);
                        //// クエスト情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\quests");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Quests, fileList);

                        break;
                    case MieProduct.NProductLine.LaxA:
                        //// チャッター情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\chatter");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Chatter, fileList);
                        //// 会話情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\conversations");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Conversations, fileList);
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);

                        break;
                    case MieProduct.NProductLine.LaxB:
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);

                        break;
                    case MieProduct.NProductLine.LaxC:
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);

                        break;
                    case MieProduct.NProductLine.LaxD:
                        //// 会話情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\conversations");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Conversations, fileList);
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);

                        break;
                    case MieProduct.NProductLine.LaxE:

                        break;
                    case MieProduct.NProductLine.LaxF:
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);

                        break;
                    case MieProduct.NProductLine.LaxG:
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);

                        break;
                    case MieProduct.NProductLine.LaxH:
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);

                        break;
                    case MieProduct.NProductLine.LaxI:
                        //// 会話情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\conversations");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Conversations, fileList);
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);

                        break;
                    case MieProduct.NProductLine.DLC1:
                        //// チャッター情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\chatter");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Chatter, fileList);
                        //// 会話情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\conversations");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Conversations, fileList);
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);
                        //// クエスト情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\quests");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Quests, fileList);

                        break;
                    case MieProduct.NProductLine.DLC2:
                        //// チャッター情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\chatter");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Chatter, fileList);
                        //// 会話情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\conversations");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Conversations, fileList);
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);
                        //// クエスト情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\quests");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Quests, fileList);

                        break;
                    case MieProduct.NProductLine.DLC3:
                        //// チャッター情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\chatter");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Chatter, fileList);
                        //// 会話情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\conversations");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Conversations, fileList);
                        //// ゲーム情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\game");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Game, fileList);
                        //// クエスト情報の取り込み
                        langPath = Path.Combine(opt.FileNameLang, @"text\quests");
                        convertConvApp.ConvertLanguage(systemDb, langPath, productLine, MieProduct.NLanguageType.Quests, fileList);

                        break;
                    default:
                        var msg = $"Unknown ProductLine({productLine}).";
                        throw new InvalidEnumArgumentException(msg);
                }

                //// 言語ファイルのDB化。
                MieTableLanguageDao.SaveToSysyemDB(systemDb, convertConvApp.LanguageInfo);

                //// FileListのDB化。
                convertConvApp.ConvertFileList(systemDb, fileList);
            }

            //// キャラクター情報と種族情報のDB化。
            {
                var charAttrPath = string.Empty;
                switch (productLine)
                {
                    case MieProduct.NProductLine.Vanilla:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxA:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxa_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxB:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxb_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxC:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxc_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxD:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxd_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxE:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxe_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxF:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxf_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxG:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxg_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxH:
                        //// キャラクター情報および種族情報なし
                        break;
                    case MieProduct.NProductLine.LaxI:
                        //// キャラクター情報および種族情報なし
                        break;
                    case MieProduct.NProductLine.DLC1:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\lax2_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.DLC2:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\lax1_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    case MieProduct.NProductLine.DLC3:
                        charAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\lax3_characters.gamedatabundle");
                        convertConvApp.ConvertCharcterAttributes(systemDb, charAttrPath);
                        break;
                    default:
                        var msg = $"Unknown ProductLine({productLine}).";
                        throw new InvalidEnumArgumentException(msg);
                }
            }

            //// Speaker情報のDB化。
            {
                var speakerAttrPath = string.Empty;
                switch (productLine)
                {
                    case MieProduct.NProductLine.Vanilla:
                        speakerAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\speakers.gamedatabundle");
                        convertConvApp.ConvertSpeakerAttributes(systemDb, speakerAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxA:
                        break;
                    case MieProduct.NProductLine.LaxB:
                        break;
                    case MieProduct.NProductLine.LaxC:
                        speakerAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxc_speakers.gamedatabundle");
                        convertConvApp.ConvertSpeakerAttributes(systemDb, speakerAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxD:
                        speakerAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxd_speakers.gamedatabundle");
                        convertConvApp.ConvertSpeakerAttributes(systemDb, speakerAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxE:
                        speakerAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\laxe_speakers.gamedatabundle");
                        convertConvApp.ConvertSpeakerAttributes(systemDb, speakerAttrPath);
                        break;
                    case MieProduct.NProductLine.LaxF:
                        break;
                    case MieProduct.NProductLine.LaxG:
                        break;
                    case MieProduct.NProductLine.LaxH:
                        break;
                    case MieProduct.NProductLine.LaxI:
                        break;
                    case MieProduct.NProductLine.DLC1:
                        speakerAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\lax2_speakers.gamedatabundle");
                        convertConvApp.ConvertSpeakerAttributes(systemDb, speakerAttrPath);
                        break;
                    case MieProduct.NProductLine.DLC2:
                        speakerAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\lax1_speakers.gamedatabundle");
                        convertConvApp.ConvertSpeakerAttributes(systemDb, speakerAttrPath);
                        break;
                    case MieProduct.NProductLine.DLC3:
                        speakerAttrPath = Path.Combine(opt.FileNameDesign, @"gamedata\lax3_speakers.gamedatabundle");
                        convertConvApp.ConvertSpeakerAttributes(systemDb, speakerAttrPath);
                        break;
                    default:
                        var msg = $"Unknown ProductLine({productLine}).";
                        throw new InvalidEnumArgumentException(msg);
                }
            }

            //// 会話情報のDB化
            {
                var convPath = string.Empty;
                switch (productLine)
                {
                    case MieProduct.NProductLine.Vanilla:
                        convPath = Path.Combine(opt.FileNameDesign, @"conversations");
                        convertConvApp.ConvertConversations(systemDb, convPath, fileList);
                        break;
                    case MieProduct.NProductLine.LaxA:
                        break;
                    case MieProduct.NProductLine.LaxB:
                        break;
                    case MieProduct.NProductLine.LaxC:
                        break;
                    case MieProduct.NProductLine.LaxD:
                        convPath = Path.Combine(opt.FileNameDesign, @"conversations");
                        convertConvApp.ConvertConversations(systemDb, convPath, fileList);
                        break;
                    case MieProduct.NProductLine.LaxE:
                        break;
                    case MieProduct.NProductLine.LaxF:
                        break;
                    case MieProduct.NProductLine.LaxG:
                        break;
                    case MieProduct.NProductLine.LaxH:
                        break;
                    case MieProduct.NProductLine.LaxI:
                        convPath = Path.Combine(opt.FileNameDesign, @"conversations");
                        convertConvApp.ConvertConversations(systemDb, convPath, fileList);
                        break;
                    case MieProduct.NProductLine.DLC1:
                        convPath = Path.Combine(opt.FileNameDesign, @"conversations");
                        convertConvApp.ConvertConversations(systemDb, convPath, fileList);
                        break;
                    case MieProduct.NProductLine.DLC2:
                        convPath = Path.Combine(opt.FileNameDesign, @"conversations");
                        convertConvApp.ConvertConversations(systemDb, convPath, fileList);
                        break;
                    case MieProduct.NProductLine.DLC3:
                        convPath = Path.Combine(opt.FileNameDesign, @"conversations");
                        convertConvApp.ConvertConversations(systemDb, convPath, fileList);
                        break;
                    default:
                        var msg = $"Unknown ProductLine({productLine}).";
                        throw new InvalidEnumArgumentException(msg);
                }
            }

            //// ToDo:クエスト情報のDB化
            {
                var questsPath = string.Empty;
                switch (productLine)
                {
                    case MieProduct.NProductLine.Vanilla:
                        questsPath = Path.Combine(opt.FileNameDesign, @"quests");
                        convertConvApp.ConvertQuests(systemDb, questsPath, fileList);
                        break;
                    case MieProduct.NProductLine.LaxA:
                        break;
                    case MieProduct.NProductLine.LaxB:
                        break;
                    case MieProduct.NProductLine.LaxC:
                        break;
                    case MieProduct.NProductLine.LaxD:
                        break;
                    case MieProduct.NProductLine.LaxE:
                        break;
                    case MieProduct.NProductLine.LaxF:
                        break;
                    case MieProduct.NProductLine.LaxG:
                        break;
                    case MieProduct.NProductLine.LaxH:
                        break;
                    case MieProduct.NProductLine.LaxI:
                        break;
                    case MieProduct.NProductLine.DLC1:
                        questsPath = Path.Combine(opt.FileNameDesign, @"quests");
                        convertConvApp.ConvertQuests(systemDb, questsPath, fileList);
                        break;
                    case MieProduct.NProductLine.DLC2:
                        questsPath = Path.Combine(opt.FileNameDesign, @"quests");
                        convertConvApp.ConvertQuests(systemDb, questsPath, fileList);
                        break;
                    case MieProduct.NProductLine.DLC3:
                        questsPath = Path.Combine(opt.FileNameDesign, @"quests");
                        convertConvApp.ConvertQuests(systemDb, questsPath, fileList);
                        break;
                    default:
                        var msg = $"Unknown ProductLine({productLine}).";
                        throw new InvalidEnumArgumentException(msg);
                }
            }

            //// ToDo:チャッター情報のDB化
            {
                var chatterPath = string.Empty;
                switch (productLine)
                {
                    case MieProduct.NProductLine.Vanilla:
                        chatterPath = Path.Combine(opt.FileNameDesign, @"chatter");
                        convertConvApp.ConvertChatter(systemDb, chatterPath, fileList);
                        break;
                    case MieProduct.NProductLine.LaxA:
                        break;
                    case MieProduct.NProductLine.LaxB:
                        break;
                    case MieProduct.NProductLine.LaxC:
                        break;
                    case MieProduct.NProductLine.LaxD:
                        break;
                    case MieProduct.NProductLine.LaxE:
                        break;
                    case MieProduct.NProductLine.LaxF:
                        break;
                    case MieProduct.NProductLine.LaxG:
                        break;
                    case MieProduct.NProductLine.LaxH:
                        break;
                    case MieProduct.NProductLine.LaxI:
                        break;
                    case MieProduct.NProductLine.DLC1:
                        chatterPath = Path.Combine(opt.FileNameDesign, @"chatter");
                        convertConvApp.ConvertChatter(systemDb, chatterPath, fileList);
                        break;
                    case MieProduct.NProductLine.DLC2:
                        chatterPath = Path.Combine(opt.FileNameDesign, @"chatter");
                        convertConvApp.ConvertChatter(systemDb, chatterPath, fileList);
                        break;
                    case MieProduct.NProductLine.DLC3:
                        chatterPath = Path.Combine(opt.FileNameDesign, @"chatter");
                        convertConvApp.ConvertChatter(systemDb, chatterPath, fileList);
                        break;
                    default:
                        var msg = $"Unknown ProductLine({productLine}).";
                        throw new InvalidEnumArgumentException(msg);
                }
            }

            systemDb.CompactDatabase();
            systemDb.Close();
        }
Exemplo n.º 18
0
        private static void CreateChatterInfo(string ctext, MieChatterNodeInfo mieChatterInfo, MieFileList fileList)
        {
            //// デシリアライズ
            var oeChatter = JsonConvert.DeserializeObject <MieOEChatter>(ctext);

            foreach (var chatterFile in oeChatter.ChatterFiles)
            {
                var fileID = chatterFile.Filename.Replace(".chatter", string.Empty);
                //// FileIDを統一形式に変換する。
                fileID = MieFileUtils.ConvertFileIDToCommon(fileID);
                fileID = MieStringUtils.NormalizedFileID(fileID);

                MieChatterNodeFile chatterNodeFile = null;

                var fileCode = fileList.GetHashByFileID(fileID);
                if (fileCode == 0)
                {
                    //// 言語情報から生成されたFileListに含まれないものは無視する。
                    continue;
                }
                else
                {
                    chatterNodeFile = new MieChatterNodeFile(fileCode);
                    mieChatterInfo.AddFile(chatterNodeFile);
                }

                foreach (var node in chatterFile.Nodes)
                {
                    var dataType = node.MieChatterNodeDataTypeTag;

                    var  nodeID         = node.NodeID;
                    var  isQuestionNode = node.IsQuestionNode;
                    bool isRootNode     = node.NodeID == 0 ? true : false;

                    //// チャッターエントリー
                    MieChatterNodeEntry.NNodeType nodeType  = MieChatterNodeEntry.NNodeType.Unknown;
                    MieChatterNodeEntry           nodeEntry = new MieChatterNodeEntry(nodeType, nodeID, isRootNode);
                    chatterNodeFile.AddFlatNodeEntry(nodeEntry);

                    //// Link情報の登録
                    foreach (var link in node.Links)
                    {
                        MieChatterLink mieChatterLink = new MieChatterLink(link.FromNodeID, link.ToNodeID);
                        chatterNodeFile.AddLinkEntry(mieChatterLink);
                    }
                }
            }
        }
        /// <summary>
        /// 言語DBの初期化とDB化。
        /// </summary>
        /// <param name="systemDb">データベース接続情報</param>
        /// <param name="langPath">言語情報フォルダーのパス</param>
        /// <param name="productLine">製品区分</param>
        /// <param name="languageType">言語区分</param>
        /// <param name="fileList">FileList</param>
        public void ConvertLanguage(MieSystemDB systemDb, string langPath, MieProduct.NProductLine productLine, MieProduct.NLanguageType languageType, MieFileList fileList)
        {
            if (!Directory.Exists(langPath))
            {
                var msg = $"Directory not found({langPath}).";
                if (productLine == MieProduct.NProductLine.Vanilla)
                {
                    logger.Error(msg);
                    throw new DirectoryNotFoundException(msg);
                }
                else
                {
                    logger.Warn(msg);
                    Console.WriteLine(msg);

                    return;
                }
            }

            //// 話者情報の読み込みとFileListの作成。
            var langInfo = MieStringTableDao.LoadFromFolder(langPath, productLine, languageType, fileList);

            if (this.LanguageInfo == null)
            {
                this.LanguageInfo = langInfo;
            }
            else
            {
                foreach (var langFile in langInfo.Items.Values)
                {
                    this.LanguageInfo.AddFile(langFile, true);
                }
            }
        }