using System;
using System.Collections.Generic;

namespace Kasizuki
{
	public static class LikabilityReplace
	{
		public static string GetLikabilityName(int likability)
		{
			LikabilityReplace.CreateData();
			string text = string.Empty;
			foreach (KeyValuePair<int, string> keyValuePair in LikabilityReplace.basicData)
			{
				int key = keyValuePair.Key;
				if (likability < key)
				{
					break;
				}
				text = keyValuePair.Value;
			}
			if (string.IsNullOrEmpty(text))
			{
				NDebug.Assert("Error LikabilityRelation.GetRelationName(int)", false);
			}
			return text;
		}

		private static void CreateData()
		{
			if (LikabilityReplace.basicData != null)
			{
				return;
			}
			LikabilityReplace.basicData = new SortedDictionary<int, string>();
			string str = "kasizuki_likability_convert_list";
			using (AFileBase afileBase = GameUty.FileSystem.FileOpen(str + ".nei"))
			{
				using (CsvParser csvParser = new CsvParser())
				{
					bool condition = csvParser.Open(afileBase);
					NDebug.Assert(condition, str + "\nopen failed.");
					for (int i = 1; i < csvParser.max_cell_y; i++)
					{
						int num = 0;
						int cellAsInteger = csvParser.GetCellAsInteger(num++, i);
						string cellAsString = csvParser.GetCellAsString(num++, i);
						LikabilityReplace.basicData.Add(cellAsInteger, cellAsString);
					}
				}
			}
		}

		private const string csvFileName = "kasizuki_likability_convert_list";

		private static SortedDictionary<int, string> basicData;
	}
}
