public static void SetData() { if (AppSettings.Objects == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.Objects = ExeObjectStatistics.FromFile(AppSettings.WorkingDirectory + AppSettings.XwaExeFileName); } } if (AppSettings.SpaceCraft == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.SpaceCraft = File.ReadAllLines(AppSettings.WorkingDirectory + @"FLIGHTMODELS\SPACECRAFT0.LST", Encoding.ASCII); for (int i = 0; i < AppSettings.SpaceCraft.Length; i++) { AppSettings.SpaceCraft[i] = Path.GetFileNameWithoutExtension(AppSettings.SpaceCraft[i]); } } } if (AppSettings.Equipment == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.Equipment = File.ReadAllLines(AppSettings.WorkingDirectory + @"FLIGHTMODELS\EQUIPMENT0.LST", Encoding.ASCII); for (int i = 0; i < AppSettings.Equipment.Length; i++) { AppSettings.Equipment[i] = Path.GetFileNameWithoutExtension(AppSettings.Equipment[i]); } } } }
public static void SetData() { if (AppSettings.ExeSpecies == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.ExeSpecies = AppSettings.ReadExeSpecies(AppSettings.WorkingDirectory + AppSettings.XwaExeFileName); } } if (AppSettings.Objects == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.Objects = ExeObjectStatistics.FromFile(AppSettings.WorkingDirectory + AppSettings.XwaExeFileName); } } if (AppSettings.SpaceCraft == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.SpaceCraft = File.ReadAllLines(AppSettings.WorkingDirectory + @"FLIGHTMODELS\SPACECRAFT0.LST", Encoding.ASCII); for (int i = 0; i < AppSettings.SpaceCraft.Length; i++) { AppSettings.SpaceCraft[i] = Path.GetFileNameWithoutExtension(AppSettings.SpaceCraft[i]); } } } if (AppSettings.Equipment == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.Equipment = File.ReadAllLines(AppSettings.WorkingDirectory + @"FLIGHTMODELS\EQUIPMENT0.LST", Encoding.ASCII); for (int i = 0; i < AppSettings.Equipment.Length; i++) { AppSettings.Equipment[i] = Path.GetFileNameWithoutExtension(AppSettings.Equipment[i]); } } } if (AppSettings.ExePlanets == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.ExePlanets = AppSettings.ReadExePlanets(AppSettings.WorkingDirectory + AppSettings.XwaExeFileName); } } if (AppSettings.BackdropsScale == 0.0f) { if (Directory.Exists(AppSettings.WorkingDirectory)) { string path = AppSettings.WorkingDirectory + AppSettings.XwaExeFileName; if (!File.Exists(path)) { throw new FileNotFoundException(null, path); } ExeVersionString.Match(path); using (BinaryReader file = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read), Encoding.ASCII)) { file.BaseStream.Seek(0x1A83AC, SeekOrigin.Begin); AppSettings.BackdropsScale = file.ReadSingle(); } } } if (AppSettings.FormationOffsetsX == null) { if (Directory.Exists(AppSettings.WorkingDirectory)) { AppSettings.FormationOffsetsX = AppSettings.ReadFormationOffsetsX(AppSettings.WorkingDirectory + AppSettings.XwaExeFileName); AppSettings.FormationOffsetsY = AppSettings.ReadFormationOffsetsY(AppSettings.WorkingDirectory + AppSettings.XwaExeFileName); AppSettings.FormationOffsetsZ = AppSettings.ReadFormationOffsetsZ(AppSettings.WorkingDirectory + AppSettings.XwaExeFileName); AppSettings.FormationSpacings = AppSettings.ReadFormationSpacings(AppSettings.WorkingDirectory + AppSettings.XwaExeFileName); } } }