Exemplo n.º 1
0
        /// <summary>
        ///     ユニット名定義行を解釈する
        /// </summary>
        /// <param name="lexer">字句解析器</param>
        private static void ParseLine(CsvLexer lexer)
        {
            string[] tokens = lexer.GetTokens();

            // 空行を読み飛ばす
            if (tokens == null)
            {
                return;
            }

            // トークン数が足りない行は読み飛ばす
            if (tokens.Length != 3)
            {
                Log.Warning("[UnitName] Invalid token count: {0} ({1} L{2})", tokens.Length, lexer.FileName,
                            lexer.LineNo);
                // 余分な項目がある場合は解析を続ける
                if (tokens.Length < 3)
                {
                    return;
                }
            }

            // 国タグ
            string countryName = tokens[0].ToUpper();

            if (!Countries.StringMap.ContainsKey(countryName))
            {
                Log.Warning("[UnitName] Invalid country: {0} ({1} L{2})", tokens[0], lexer.FileName, lexer.LineNo);
                return;
            }
            Country country = Countries.StringMap[countryName];

            // ユニット種類
            string typeName = tokens[1].ToUpper();

            if (!TypeStringMap.ContainsKey(typeName))
            {
                Log.Warning("[UnitName] Invalid unit type: {0} ({1} L{2})", tokens[1], lexer.FileName, lexer.LineNo);
                return;
            }
            UnitNameType type = TypeStringMap[typeName];

            if (!Types.Contains(type))
            {
                Log.Warning("[UnitName] Invalid unit type: {0} ({1} L{2})", tokens[1], lexer.FileName, lexer.LineNo);
                return;
            }

            // ユニット名
            string name = tokens[2];

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            // ユニット名を追加する
            AddName(name, country, type);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     研究機関ファイルを読み込む
        /// </summary>
        /// <param name="fileName">対象ファイル名</param>
        private static void LoadFile(string fileName)
        {
            Log.Verbose("[Team] Load: {0}", Path.GetFileName(fileName));

            using (CsvLexer lexer = new CsvLexer(fileName))
            {
                // 空ファイルを読み飛ばす
                if (lexer.EndOfStream)
                {
                    return;
                }

                // 国タグ読み込み
                string[] tokens = lexer.GetTokens();
                if (tokens == null || tokens.Length == 0 || string.IsNullOrEmpty(tokens[0]))
                {
                    return;
                }
                // サポート外の国タグの場合は何もしない
                if (!Countries.StringMap.ContainsKey(tokens[0].ToUpper()))
                {
                    return;
                }
                Country country = Countries.StringMap[tokens[0].ToUpper()];

                // ヘッダ行のみのファイルを読み飛ばす
                if (lexer.EndOfStream)
                {
                    return;
                }

                while (!lexer.EndOfStream)
                {
                    Team team = ParseLine(lexer, country);

                    // 空行を読み飛ばす
                    if (team == null)
                    {
                        continue;
                    }

                    Items.Add(team);
                }

                ResetDirty(country);

                if (country != Country.None && !FileNameMap.ContainsKey(country))
                {
                    FileNameMap.Add(country, lexer.FileName);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     ランダム指揮官名定義行を解釈する
        /// </summary>
        /// <param name="lexer">字句解析器</param>
        /// <returns>閣僚データ</returns>
        private static void ParseLine(CsvLexer lexer)
        {
            string[] tokens = lexer.GetTokens();

            // 空行を読み飛ばす
            if (tokens == null)
            {
                return;
            }

            // トークン数が足りない行は読み飛ばす
            if (tokens.Length != 2)
            {
                Log.Warning("[RandomLeader] Invalid token count: {0} ({1} L{2})", tokens.Length, lexer.FileName,
                            lexer.LineNo);
                // 余分な項目がある場合は解析を続ける
                if (tokens.Length < 2)
                {
                    return;
                }
            }

            // 国タグ
            string countryName = tokens[0].ToUpper();

            if (!Countries.StringMap.ContainsKey(countryName))
            {
                Log.Warning("[RandomLeader] Invalid country: {0} ({1} L{2})", countryName, lexer.FileName, lexer.LineNo);
                return;
            }
            Country country = Countries.StringMap[countryName];

            // ランダム指揮官名
            string name = tokens[1];

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            // ランダム指揮官名を追加する
            AddName(name, country);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     研究機関定義行を解釈する
        /// </summary>
        /// <param name="lexer">字句解析器</param>
        /// <param name="country">国家タグ</param>
        /// <returns>研究機関データ</returns>
        private static Team ParseLine(CsvLexer lexer, Country country)
        {
            string[] tokens = lexer.GetTokens();

            // ID指定のない行は読み飛ばす
            if (string.IsNullOrEmpty(tokens?[0]))
            {
                return(null);
            }

            // トークン数が足りない行は読み飛ばす
            if (tokens.Length != 39)
            {
                Log.Warning("[Team] Invalid token count: {0} ({1} L{2})", tokens.Length, lexer.FileName, lexer.LineNo);
                // 末尾のxがない/余分な項目がある場合は解析を続ける
                if (tokens.Length < 38)
                {
                    return(null);
                }
            }

            Team team = new Team {
                Country = country
            };
            int index = 0;

            // ID
            int id;

            if (!int.TryParse(tokens[index], out id))
            {
                Log.Warning("[Team] Invalid id: {0} ({1} L{2})", tokens[index], lexer.FileName, lexer.LineNo);
                return(null);
            }
            team.Id = id;
            index++;

            // 名前
            team.Name = tokens[index];
            index++;

            // 画像ファイル名
            team.PictureName = tokens[index];
            index++;

            // スキル
            int skill;

            if (int.TryParse(tokens[index], out skill))
            {
                team.Skill = skill;
            }
            else
            {
                team.Skill = 1;
                Log.Warning("[Team] Invalid skill: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id, team.Name,
                            lexer.FileName, lexer.LineNo);
            }
            index++;

            // 開始年
            int startYear;

            if (int.TryParse(tokens[index], out startYear))
            {
                team.StartYear = startYear;
            }
            else
            {
                team.StartYear = 1930;
                Log.Warning("[Team] Invalid start year: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id, team.Name,
                            lexer.FileName, lexer.LineNo);
            }
            index++;

            // 終了年
            int endYear;

            if (int.TryParse(tokens[index], out endYear))
            {
                team.EndYear = endYear;
            }
            else
            {
                team.EndYear = 1970;
                Log.Warning("[Team] Invalid end year: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id, team.Name,
                            lexer.FileName, lexer.LineNo);
            }
            index++;

            // 研究特性
            for (int i = 0; i < Team.SpecialityLength; i++, index++)
            {
                string s = tokens[index].ToLower();

                // 空文字列
                if (string.IsNullOrEmpty(s))
                {
                    team.Specialities[i] = TechSpeciality.None;
                    continue;
                }

                // 無効な研究特性文字列
                if (!Techs.SpecialityStringMap.ContainsKey(s))
                {
                    team.Specialities[i] = TechSpeciality.None;
                    Log.Warning("[Team] Invalid speciality: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id,
                                team.Name, lexer.FileName, lexer.LineNo);
                    continue;
                }

                // サポート外の研究特性
                TechSpeciality speciality = Techs.SpecialityStringMap[s];
                if (!Techs.Specialities.Contains(speciality))
                {
                    Log.Warning("[Team] Invalid speciality: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id,
                                team.Name, lexer.FileName, lexer.LineNo);
                    continue;
                }

                team.Specialities[i] = speciality;
            }

            return(team);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     指揮官定義行を解釈する
        /// </summary>
        /// <param name="lexer">字句解析器</param>
        /// <returns>指揮官データ</returns>
        private static Leader ParseLine(CsvLexer lexer)
        {
            string[] tokens = lexer.GetTokens();

            // 空行を読み飛ばす
            if (tokens == null)
            {
                return null;
            }

            // トークン数が足りない行は読み飛ばす
            if (tokens.Length != (Misc.EnableRetirementYearLeaders ? 19 : 18))
            {
                Log.Warning("[Leader] Invalid token count: {0} ({1} L{2})", tokens.Length, lexer.FileName, lexer.LineNo);
                // 末尾のxがない/余分な項目がある場合は解析を続ける
                if (tokens.Length < (Misc.EnableRetirementYearLeaders ? 18 : 17))
                {
                    return null;
                }
            }

            // 名前指定のない行は読み飛ばす
            if (string.IsNullOrEmpty(tokens[0]))
            {
                return null;
            }

            Leader leader = new Leader();
            int index = 0;

            // 名前
            leader.Name = tokens[index];
            index++;

            // ID
            int id;
            if (!int.TryParse(tokens[index], out id))
            {
                Log.Warning("[Leader] Invalid id: {0} [{1}] ({1} L{2})", tokens[index], leader.Name, lexer.FileName,
                    lexer.LineNo);
                return null;
            }
            leader.Id = id;
            index++;

            // 国家
            if (string.IsNullOrEmpty(tokens[index]) || !Countries.StringMap.ContainsKey(tokens[index].ToUpper()))
            {
                Log.Warning("[Leader] Invalid country: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id, leader.Name,
                    lexer.FileName, lexer.LineNo);
                return null;
            }
            leader.Country = Countries.StringMap[tokens[index].ToUpper()];
            index++;

            // 任官年
            for (int i = 0; i < 4; i++)
            {
                int rankYear;
                if (int.TryParse(tokens[index], out rankYear))
                {
                    leader.RankYear[i] = rankYear;
                }
                else
                {
                    leader.RankYear[i] = 1990;
                    Log.Warning("[Leader] Invalid rank{0} year: {1} [{2}: {3}] ({4} L{5})", i, tokens[index], leader.Id,
                        leader.Name, lexer.FileName, lexer.LineNo);
                }
                index++;
            }

            // 理想階級
            int idealRank;
            if (int.TryParse(tokens[index], out idealRank) && 0 <= idealRank && idealRank <= 3)
            {
                leader.IdealRank = (LeaderRank) (4 - idealRank);
            }
            else
            {
                leader.IdealRank = LeaderRank.None;
                Log.Warning("[Leader] Invalid ideal rank: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id,
                    leader.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // 最大スキル
            int maxSkill;
            if (int.TryParse(tokens[index], out maxSkill))
            {
                leader.MaxSkill = maxSkill;
            }
            else
            {
                leader.MaxSkill = 0;
                Log.Warning("[Leader] Invalid max skill: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id,
                    leader.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // 指揮官特性
            uint traits;
            if (uint.TryParse(tokens[index], out traits))
            {
                leader.Traits = traits;
            }
            else
            {
                leader.Traits = LeaderTraits.None;
                Log.Warning("[Leader] Invalid trait: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id,
                    leader.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // スキル
            int skill;
            if (int.TryParse(tokens[index], out skill))
            {
                leader.Skill = skill;
            }
            else
            {
                leader.Skill = 0;
                Log.Warning("[Leader] Invalid skill: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id, leader.Name,
                    lexer.FileName, lexer.LineNo);
            }
            index++;

            // 経験値
            int experience;
            if (int.TryParse(tokens[index], out experience))
            {
                leader.Experience = experience;
            }
            else
            {
                leader.Experience = 0;
                Log.Warning("[Leader] Invalid experience: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id,
                    leader.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // 忠誠度
            int loyalty;
            if (int.TryParse(tokens[index], out loyalty))
            {
                leader.Loyalty = loyalty;
            }
            else
            {
                leader.Loyalty = 0;
                Log.Warning("[Leader] Invalid loyalty: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id, leader.Name,
                    lexer.FileName, lexer.LineNo);
            }
            index++;

            // 兵科
            int branch;
            if (int.TryParse(tokens[index], out branch))
            {
                leader.Branch = (Branch) (branch + 1);
            }
            else
            {
                leader.Branch = Branch.None;
                Log.Warning("[Leader] Invalid branch: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id, leader.Name,
                    lexer.FileName, lexer.LineNo);
            }
            index++;

            // 画像ファイル名
            leader.PictureName = tokens[index];
            index++;

            // 開始年
            int startYear;
            if (int.TryParse(tokens[index], out startYear))
            {
                leader.StartYear = startYear;
            }
            else
            {
                leader.StartYear = 1930;
                Log.Warning("[Leader] Invalid start year: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id,
                    leader.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // 終了年
            int endYear;
            if (int.TryParse(tokens[index], out endYear))
            {
                leader.EndYear = endYear;
            }
            else
            {
                leader.EndYear = 1970;
                Log.Warning("[Leader] Invalid end year: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id,
                    leader.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // 引退年
            if (Misc.EnableRetirementYearLeaders)
            {
                int retirementYear;
                if (int.TryParse(tokens[index], out retirementYear))
                {
                    leader.RetirementYear = retirementYear;
                }
                else
                {
                    leader.RetirementYear = 1999;
                    Log.Warning("[Leader] Invalid retirement year: {0} [{1}: {2}] ({3} L{4})", tokens[index], leader.Id,
                        leader.Name, lexer.FileName, lexer.LineNo);
                }
            }
            else
            {
                leader.RetirementYear = 1999;
            }

            return leader;
        }
Exemplo n.º 6
0
        /// <summary>
        ///     研究機関ファイルを読み込む
        /// </summary>
        /// <param name="fileName">対象ファイル名</param>
        private static void LoadFile(string fileName)
        {
            Log.Verbose("[Team] Load: {0}", Path.GetFileName(fileName));

            using (CsvLexer lexer = new CsvLexer(fileName))
            {
                // 空ファイルを読み飛ばす
                if (lexer.EndOfStream)
                {
                    return;
                }

                // 国タグ読み込み
                string[] tokens = lexer.GetTokens();
                if (tokens == null || tokens.Length == 0 || string.IsNullOrEmpty(tokens[0]))
                {
                    return;
                }
                // サポート外の国タグの場合は何もしない
                if (!Countries.StringMap.ContainsKey(tokens[0].ToUpper()))
                {
                    return;
                }
                Country country = Countries.StringMap[tokens[0].ToUpper()];

                // ヘッダ行のみのファイルを読み飛ばす
                if (lexer.EndOfStream)
                {
                    return;
                }

                while (!lexer.EndOfStream)
                {
                    Team team = ParseLine(lexer, country);

                    // 空行を読み飛ばす
                    if (team == null)
                    {
                        continue;
                    }

                    Items.Add(team);
                }

                ResetDirty(country);

                if (country != Country.None && !FileNameMap.ContainsKey(country))
                {
                    FileNameMap.Add(country, lexer.FileName);
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        ///     研究機関定義行を解釈する
        /// </summary>
        /// <param name="lexer">字句解析器</param>
        /// <param name="country">国家タグ</param>
        /// <returns>研究機関データ</returns>
        private static Team ParseLine(CsvLexer lexer, Country country)
        {
            string[] tokens = lexer.GetTokens();

            // ID指定のない行は読み飛ばす
            if (string.IsNullOrEmpty(tokens?[0]))
            {
                return null;
            }

            // トークン数が足りない行は読み飛ばす
            if (tokens.Length != 39)
            {
                Log.Warning("[Team] Invalid token count: {0} ({1} L{2})", tokens.Length, lexer.FileName, lexer.LineNo);
                // 末尾のxがない/余分な項目がある場合は解析を続ける
                if (tokens.Length < 38)
                {
                    return null;
                }
            }

            Team team = new Team { Country = country };
            int index = 0;

            // ID
            int id;
            if (!int.TryParse(tokens[index], out id))
            {
                Log.Warning("[Team] Invalid id: {0} ({1} L{2})", tokens[index], lexer.FileName, lexer.LineNo);
                return null;
            }
            team.Id = id;
            index++;

            // 名前
            team.Name = tokens[index];
            index++;

            // 画像ファイル名
            team.PictureName = tokens[index];
            index++;

            // スキル
            int skill;
            if (int.TryParse(tokens[index], out skill))
            {
                team.Skill = skill;
            }
            else
            {
                team.Skill = 1;
                Log.Warning("[Team] Invalid skill: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id, team.Name,
                    lexer.FileName, lexer.LineNo);
            }
            index++;

            // 開始年
            int startYear;
            if (int.TryParse(tokens[index], out startYear))
            {
                team.StartYear = startYear;
            }
            else
            {
                team.StartYear = 1930;
                Log.Warning("[Team] Invalid start year: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id, team.Name,
                    lexer.FileName, lexer.LineNo);
            }
            index++;

            // 終了年
            int endYear;
            if (int.TryParse(tokens[index], out endYear))
            {
                team.EndYear = endYear;
            }
            else
            {
                team.EndYear = 1970;
                Log.Warning("[Team] Invalid end year: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id, team.Name,
                    lexer.FileName, lexer.LineNo);
            }
            index++;

            // 研究特性
            for (int i = 0; i < Team.SpecialityLength; i++, index++)
            {
                string s = tokens[index].ToLower();

                // 空文字列
                if (string.IsNullOrEmpty(s))
                {
                    team.Specialities[i] = TechSpeciality.None;
                    continue;
                }

                // 無効な研究特性文字列
                if (!Techs.SpecialityStringMap.ContainsKey(s))
                {
                    team.Specialities[i] = TechSpeciality.None;
                    Log.Warning("[Team] Invalid speciality: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id,
                        team.Name, lexer.FileName, lexer.LineNo);
                    continue;
                }

                // サポート外の研究特性
                TechSpeciality speciality = Techs.SpecialityStringMap[s];
                if (!Techs.Specialities.Contains(speciality))
                {
                    Log.Warning("[Team] Invalid speciality: {0} [{1}: {2}] ({3} L{4})", tokens[index], team.Id,
                        team.Name, lexer.FileName, lexer.LineNo);
                    continue;
                }

                team.Specialities[i] = speciality;
            }

            return team;
        }
Exemplo n.º 8
0
        /// <summary>
        ///     閣僚定義行を解釈する
        /// </summary>
        /// <param name="lexer">字句解析器</param>
        /// <param name="country">国家タグ</param>
        /// <returns>閣僚データ</returns>
        private static Minister ParseLine(CsvLexer lexer, Country country)
        {
            string[] tokens = lexer.GetTokens();

            // ID指定のない行は読み飛ばす
            if (string.IsNullOrEmpty(tokens?[0]))
            {
                return null;
            }

            // トークン数が足りない行は読み飛ばす
            if (tokens.Length != (Misc.EnableRetirementYearMinisters ? 11 : (Misc.UseNewMinisterFilesFormat ? 10 : 9)))
            {
                Log.Warning("[Minister] Invalid token count: {0} ({1} L{2})", tokens.Length, lexer.FileName,
                    lexer.LineNo);
                // 末尾のxがない/余分な項目がある場合は解析を続ける
                if (tokens.Length < (Misc.EnableRetirementYearMinisters ? 10 : (Misc.UseNewMinisterFilesFormat ? 9 : 8)))
                {
                    return null;
                }
            }

            Minister minister = new Minister { Country = country };
            int index = 0;

            // ID
            int id;
            if (!int.TryParse(tokens[index], out id))
            {
                Log.Warning("[Minister] Invalid id: {0} ({1} L{2})", tokens[index], lexer.FileName, lexer.LineNo);
                return null;
            }
            minister.Id = id;
            index++;

            // 閣僚地位
            string positionName = tokens[index].ToLower();
            if (PositionStringMap.ContainsKey(positionName))
            {
                minister.Position = PositionStringMap[positionName];
            }
            else
            {
                minister.Position = MinisterPosition.None;
                Log.Warning("[Minister] Invalid position: {0} [{1}] ({2} L{3})", tokens[index], minister.Id,
                    lexer.FileName, lexer.LineNo);
            }
            index++;

            // 名前
            minister.Name = tokens[index];
            index++;

            // 開始年
            int startYear;
            if (int.TryParse(tokens[index], out startYear))
            {
                minister.StartYear = startYear + (Misc.UseNewMinisterFilesFormat ? 0 : 1900);
            }
            else
            {
                minister.StartYear = 1936;
                Log.Warning("[Minister] Invalid start year: {0} [{1}: {2}] ({3} L{4})", tokens[index], minister.Id,
                    minister.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // 終了年
            if (Misc.UseNewMinisterFilesFormat)
            {
                int endYear;
                if (int.TryParse(tokens[index], out endYear))
                {
                    minister.EndYear = endYear;
                }
                else
                {
                    minister.EndYear = 1970;
                    Log.Warning("[Minister] Invalid end year: {0} [{1}: {2}] ({3} L{4})", tokens[index], minister.Id,
                        minister.Name, lexer.FileName, lexer.LineNo);
                }
                index++;
            }
            else
            {
                minister.EndYear = 1970;
            }

            // 引退年
            if (Misc.EnableRetirementYearMinisters)
            {
                int retirementYear;
                if (int.TryParse(tokens[index], out retirementYear))
                {
                    minister.RetirementYear = retirementYear;
                }
                else
                {
                    minister.RetirementYear = 1999;
                    Log.Warning("[Minister] Invalid retirement year: {0} [{1}: {2}] ({3} L{4})", tokens[index],
                        minister.Id, minister.Name, lexer.FileName, lexer.LineNo);
                }
                index++;
            }
            else
            {
                minister.RetirementYear = 1999;
            }

            // イデオロギー
            string ideologyName = tokens[index].ToLower();
            if (IdeologyStringMap.ContainsKey(ideologyName))
            {
                minister.Ideology = IdeologyStringMap[ideologyName];
            }
            else
            {
                minister.Ideology = MinisterIdeology.None;
                Log.Warning("[Minister] Invalid ideology: {0} [{1}: {2}] ({3} L{4})", tokens[index], minister.Id,
                    minister.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // 閣僚特性
            string personalityName = tokens[index].ToLower();
            if (PersonalityStringMap.ContainsKey(personalityName))
            {
                minister.Personality = PersonalityStringMap[personalityName];
            }
            else
            {
                if (PersonalityStringTypoMap.ContainsKey(personalityName) &&
                    PersonalityStringMap.ContainsKey(PersonalityStringTypoMap[personalityName]))
                {
                    minister.Personality = PersonalityStringMap[PersonalityStringTypoMap[personalityName]];
                    Log.Warning("[Minister] Modified personality: {0} -> {1} [{2}: {3}] ({4} L{5})", tokens[index],
                        Personalities[minister.Personality].String, minister.Id, minister.Name, lexer.FileName,
                        lexer.LineNo);
                }
                else
                {
                    minister.Personality = 0;
                    Log.Warning("[Minister] Invalid personality: {0} [{1}: {2}] ({3} L{4})", tokens[index], minister.Id,
                        minister.Name, lexer.FileName, lexer.LineNo);
                }
            }
            index++;

            // 忠誠度
            string loyaltyName = tokens[index].ToLower();
            if (LoyaltyStringMap.ContainsKey(loyaltyName))
            {
                minister.Loyalty = LoyaltyStringMap[loyaltyName];
            }
            else
            {
                minister.Loyalty = MinisterLoyalty.None;
                Log.Warning("[Minister] Invalid loyalty: {0} [{1}: {2}] ({3} L{4})", tokens[index], minister.Id,
                    minister.Name, lexer.FileName, lexer.LineNo);
            }
            index++;

            // 画像ファイル名
            minister.PictureName = tokens[index];

            return minister;
        }