public GameSettings(Config.CustomConfig customConfig, Config.LithTechConfig lithTechConfig) { InitializeComponent(); this.customConfig = customConfig; this.lithTechConfig = lithTechConfig; }
private void Mainform_Load(object sender, EventArgs e) { CheckForRequiredGameFiles(); if (!File.Exists("autoexec.cfg")) { ConfigChoice _ConfigChoice = new ConfigChoice(); _ConfigChoice.ShowDialog(); } customConfig = Config.CustomConfig.Load(); lithTechConfig = Config.LithTechConfig.Load(); if (customConfig.LithFixEnabled) { customConfig.LithFixEnabled = customConfig.CheckLithFix(); } if (!File.Exists("avp2cmds.txt")) { MessageBox.Show("No avp2cmds.txt found. The launcher will try to create it based on files in your current directory.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); CreateGenericAVP2Cmds(); } SetPositionFromConfig(); if (skipLauncher) { this.WindowState = FormWindowState.Minimized; StartGame(); } }
private void B_DisplaySettings_Click(object sender, EventArgs e) { using (GameSettings _GraphicsSettings = new GameSettings(new Config.CustomConfig(customConfig), new Config.LithTechConfig(lithTechConfig))) { _GraphicsSettings.StartPosition = FormStartPosition.Manual; _GraphicsSettings.SetDesktopLocation(this.DesktopLocation.X + 20, this.DesktopLocation.Y + 20); if (_GraphicsSettings.ShowDialog() == DialogResult.OK) { lithTechConfig = _GraphicsSettings.lithTechConfig; customConfig = _GraphicsSettings.customConfig; } } }
public LithTechConfig(LithTechConfig originalToCopy) { foreach (var property in originalToCopy.GetType().GetProperties()) { var value = property.GetValue(originalToCopy); this.GetType().GetProperty(property.Name).SetValue(this, value); } OtherLines = new List <string>(); foreach (var line in originalToCopy.OtherLines) { OtherLines.Add(line); } }
public static LithTechConfig Load() { LithTechConfig obj; if (File.Exists(FILEPATH)) { obj = new LithTechConfig(); StreamReader streamReader = new StreamReader(FILEPATH); while (!streamReader.EndOfStream) { var line = streamReader.ReadLine(); if (line.Contains(" ")) { var split = line.Split(new char[] { ' ' }, 2); var key = split[0].Trim(new char[] { '\"' }); var value = split[1].Trim(new char[] { '\"' }); var propInfo = obj.GetType().GetProperty(key); if (propInfo != null && propInfo.PropertyType == typeof(uint)) { propInfo.SetValue(obj, uint.Parse(value)); } else { obj.OtherLines.Add(line); } } else { obj.OtherLines.Add(line); } } streamReader.Close(); return(obj); } else { return(new LithTechConfig()); } }