private void LoadDatFile(string path) { using (Logger.EnterStage("Reading DAT file: " + path)) { using (StreamReader fin = new StreamReader(path)) { string line; while ((line = fin.ReadLine()) != null) { line = line.Trim(); if (line.Length == 0 || line.StartsWith("#")) continue; if (line.StartsWith("TEXDICTION")) { TexturesStorage.Instance.AddTexturesArchive(line.Substring("TEXDICTION ".Length)); } else if (line.StartsWith("IDE")) { string fileName = line.Substring(4); var objs = new IDEFileLoader(fileName, gtaVersion).Load(); foreach (var obj in objs) objDefinitions.Add(obj.Key, obj.Value); } else if (line.StartsWith("IPL")) { string fileName = line.Substring(4); var objs = new IPLFileLoader(fileName, gtaVersion).Load(); foreach (var obj in objs) objPlacements.Add(obj); } else if (line.StartsWith("IMG")) // in SanAndreas only { // Ignoring it, there is no interesting information for us } else if (line.StartsWith("SPLASH") || line.StartsWith("COLFILE") || line.StartsWith("MAPZONE") || line.StartsWith("MODELFILE")) { // Ignoring this commands } else { int sep_idx = line.IndexOf(' '); if (sep_idx == -1) sep_idx = line.IndexOf('\t'); if (sep_idx == -1) sep_idx = line.Length; string command = line.Substring(0, sep_idx); Logger.Print("Unsupported command in DAT file: " + command, MessageType.Error); } } } } }
private void LoadDatFile(string path) { using (Logger.EnterStage("Reading DAT file: " + path)) { using (StreamReader fin = new StreamReader(path)) { string line; while ((line = fin.ReadLine()) != null) { line = line.Trim(); if (line.Length == 0 || line.StartsWith("#")) { continue; } if (line.StartsWith("TEXDICTION")) { TexturesStorage.Instance.AddTexturesArchive(line.Substring("TEXDICTION ".Length)); } else if (line.StartsWith("IDE")) { string fileName = line.Substring(4); var objs = new IDEFileLoader(fileName, gtaVersion).Load(); foreach (var obj in objs) { objDefinitions.Add(obj.Key, obj.Value); } } else if (line.StartsWith("IPL")) { string fileName = line.Substring(4); var objs = new IPLFileLoader(fileName, gtaVersion).Load(); foreach (var obj in objs) { objPlacements.Add(obj); } } else if (line.StartsWith("IMG")) // in SanAndreas only { // Ignoring it, there is no interesting information for us } else if (line.StartsWith("SPLASH") || line.StartsWith("COLFILE") || line.StartsWith("MAPZONE") || line.StartsWith("MODELFILE")) { // Ignoring this commands } else { int sep_idx = line.IndexOf(' '); if (sep_idx == -1) { sep_idx = line.IndexOf('\t'); } if (sep_idx == -1) { sep_idx = line.Length; } string command = line.Substring(0, sep_idx); Logger.Print("Unsupported command in DAT file: " + command, MessageType.Error); } } } } }