public StateIndexer(BaseGameReader gameReader, ModFileReader modReader, string statesPath) { StatesPath = statesPath; baseGame = gameReader; modFile = modReader; string baseGameStatesPath = baseGame.BaseFolder + "history/states/"; LoadBaseGameStates(baseGameStatesPath); LoadModStates(modFile.RootFolder + "history/states/"); // Iterate through all states with this List <State> allStatesList = new List <State>(); stateOwnerLookup = new Dictionary <string, List <State> >(); foreach (int stateID in stateIdLookup.Keys) { State newState = stateIdLookup[stateID]; allStatesList.Add(newState); if (stateOwnerLookup.ContainsKey(newState.Owner)) { stateOwnerLookup[newState.Owner].Add(newState); } else { stateOwnerLookup.Add(newState.Owner, new List <State>() { newState }); } } AllStates = allStatesList.ToArray(); }
public ModFileReader(string filePath, string mainModFolder) { ModFile = this; StreamReader sr = new StreamReader(filePath); string[] fullText = sr.ReadToEnd().Split('\n'); sr.Close(); foreach (string line in fullText) { if (line.Trim().StartsWith("name")) { Name = line.Split('=')[1].Trim(); } else if (line.Trim().StartsWith("path")) { FolderPath = mainModFolder + line.Split('=')[1].Trim().Replace("mod/", "").Replace("\"", ""); } } FlagFolder = FolderPath + "gfx/flags/"; StatesPath = FolderPath + "history/states/"; CommonFolder = FolderPath + "common/"; LocalisationFolder = FolderPath + "localisation/"; RootFolder = FolderPath; CheckFolder(FlagFolder); CheckFolder(StatesPath); CheckFolder(CommonFolder); CheckFolder(LocalisationFolder); CheckFolder(FolderPath + "map/strategicregions"); CheckFolder(CommonFolder + "country_tags/"); CheckFolder(FolderPath + "history/countries/"); foreach (string file in Directory.GetFiles(LocalisationFolder)) { BaseGameReader.BaseGame.ReadLocalisationFile(file); } }