private void WriteFile() { //WriteFile if ((File.GetAttributes(videoConfigpath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { File.SetAttributes(videoConfigpath, FileAttributes.Normal); ApexConfig.WriteDict2File(videoConfig, videoConfigpath); File.SetAttributes(videoConfigpath, FileAttributes.ReadOnly); } else { ApexConfig.WriteDict2File(videoConfig, videoConfigpath); } }
private void PreConfigComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (PreConfigComboBox.Text == "最高性能") { string[] perConfigStr = File.ReadAllLines(preConfigPath + PreConfigComboBox.Text + ".txt"); var preConfig = ApexConfig.Read2Dict(perConfigStr); preConfig["setting.stream_memory"] = videoConfig["setting.stream_memory"]; preConfig["setting.gamma"] = videoConfig["setting.gamma"]; preConfig["setting.fullscreen"] = videoConfig["setting.fullscreen"]; preConfig["setting.nowindowborder"] = videoConfig["setting.nowindowborder"]; preConfig["setting.defaultres"] = videoConfig["setting.defaultres"]; preConfig["setting.defaultresheight"] = videoConfig["setting.defaultresheight"]; File.SetAttributes(videoConfigpath, FileAttributes.Normal); File.Copy(videoConfigpath, videoConfigpath + ".bak", true); ApexConfig.WriteDict2File(preConfig, videoConfigpath); File.SetAttributes(videoConfigpath, FileAttributes.ReadOnly); ConfigReadonlyCheckBox.Checked = true; MessageBox.Show("成功替换配置文件,原文件以.bak后缀备份"); Form1_Load(this, null); this.Left += this.Size.Width / 2; } }
private void Form1_Load(object sender, EventArgs e) { this.Left -= this.Size.Width / 2; preConfigPath = Environment.CurrentDirectory + @"\PresetConfig\"; videoConfigpath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); videoConfigpath = videoConfigpath.Remove(videoConfigpath.Length - 9) + @"Saved Games\Respawn\Apex\local\videoconfig.txt"; string[] vidoeConfigStr = File.ReadAllLines(videoConfigpath); videoConfig = ApexConfig.Read2Dict(vidoeConfigStr); if (videoConfig["setting.configversion"] != "7") { MessageBox.Show("配置文件版本不匹配,请下载更新!"); File.SetAttributes(videoConfigpath, FileAttributes.Normal); System.Diagnostics.Process.Start(@"https://coldthunder11.com/ApexConfiguration/Download"); Application.Exit(); } #region UISet if ((File.GetAttributes(videoConfigpath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { ConfigReadonlyCheckBox.Checked = true; } if (videoConfig["setting.fullscreen"] == "1") { DisplayModeComboBox.Text = "全屏"; } if (videoConfig["setting.fullscreen"] == "0" && videoConfig["setting.nowindowborder"] == "1") { DisplayModeComboBox.Text = "无边框窗口化"; } if (videoConfig["setting.fullscreen"] == "0" && videoConfig["setting.nowindowborder"] == "0") { DisplayModeComboBox.Text = "窗口化"; } RevolutionComboBox.Text = videoConfig["setting.defaultres"] + "*" + videoConfig["setting.defaultresheight"]; DvsMinTextBox.Text = videoConfig["setting.dvs_gpuframetime_min"]; DvsMaxTextBox.Text = videoConfig["setting.dvs_gpuframetime_max"]; if (videoConfig["setting.dvs_supersample_enable"] == "1") { DvsSpuersampleCheckBox1.Checked = true; } LODTextBox.Text = videoConfig["setting.r_lod_switch_scale"]; if (videoConfig["setting.cl_ragdoll_self_collision"] == "1") { RagdollCheckBox.Checked = true; } RagdollTextBox.Text = videoConfig["setting.cl_ragdoll_maxcount"]; if (videoConfig["setting.r_decals"] == "1") { DecalsCheckBox.Checked = true; } if (!(videoConfig["setting.cl_particle_fallback_base"] == "0" && videoConfig["setting.cl_particle_fallback_multiplier"] == "0")) { ParticleCheckBox.Checked = true; } if (videoConfig["setting.mat_antialias_mode"] == "12") { AntialiasCheckBox.Checked = true; } if (videoConfig["setting.dvs_enable"] == "1") { DvsCheckBox.Checked = true; } if (videoConfig["setting.ssao_enabled"] == "1") { SSAOCheckBox.Checked = true; } if (videoConfig["setting.shadow_enable"] == "1") { ShadowCheckBox.Checked = true; } GammaTextBox.Text = videoConfig["setting.gamma"]; #endregion hasStartUp = true; }