static CurrentMap() { try { iniFlag = File.ReadAllText(Scriptfiles.GetPath("flag_position.ini")); } catch (FileNotFoundException e) { Console.WriteLine($"Error {e.StackTrace} Reason: {e.Message}"); } }
public static void LoadMapNames() { try { string[] fileEntries = Directory.GetFiles(Scriptfiles.GetPath("maps")); MAX_MAPS = fileEntries.Length; mapName = new string[MAX_MAPS]; for (int i = 0; i < MAX_MAPS; ++i) { mapName[i] = Path.GetFileName(fileEntries[i]).Replace(".ini", ""); } Rand.Shuffle(mapName); } catch (DirectoryNotFoundException e) { Console.WriteLine($"Error {e.StackTrace} Reason: {e.Message}"); } }
/* Loads the specific data of a map. */ public static void LoadMapData() { try { var path = Scriptfiles.GetPath($"maps{Path.DirectorySeparatorChar}{GetCurrentMap()}.ini"); var sectionFile = new IniDataSection(path); LoadPositionsTeam(sectionFile, TeamID.Alpha); LoadPositionsTeam(sectionFile, TeamID.Beta); Interior = Int(sectionFile.GetContentSection("Interior")?[0]) ?? DEFAULT_INTERIOR; Weather = Int(sectionFile.GetContentSection("Weather")?[0]) ?? DEFAULT_WEATHER; WorldTime = Int(sectionFile.GetContentSection("WorldTime")?[0]) ?? DEFAULT_WORLDTIME; } catch (FileNotFoundException e) { Console.WriteLine($"Error {e.StackTrace} Reason: {e.Message}"); } catch (DirectoryNotFoundException e) { Console.WriteLine($"Error {e.StackTrace} Reason: {e.Message}"); } }
public Dini(string filename, string section) { Section = section; Data = new IniDataParser().Parse(File.ReadAllText(Scriptfiles.GetPath(filename))); }