public void Save(OgseGraphics cfg) { try { #region numeric SetDoubleToHeader("SS_VOL_MAX_INTENSITY", cfg.vol_max_int * 0.01); SetDoubleToHeader("VOL_LIGHT_MAX_INTENSITY", cfg.vol_light_max_int * 0.001); SetDoubleToHeader("SSDO_BLEND_FACTOR", cfg.ssdo_int * 0.02); SetDoubleToHeader("HBAO_BLEND_FACTOR", cfg.hbao_int * 0.01); SetDoubleToHeader("DDOF_VIGNOUT", (100 - cfg.vignette_int) * 0.01); SetDoubleToHeader("DDOF_GAIN", cfg.ddof_gain); SetDoubleToHeader("ZDOF_INTENSITY", cfg.zdof_int * 0.01); SetDoubleToHeader("RDOF_INTENSITY", cfg.rdof_int * 0.01); SetDoubleToHeader("PUDDLES_GROW_SPEED", cfg.puddles_grow * 0.01); #endregion #region params check SetBoolToHeader("SS_DUST", cfg.ss_dust); SetBoolToHeader("USE_VOLUMETRIC_DUST", cfg.ss_volume_dust); SetBoolToHeader("USE_MOON_ROAD", cfg.moonroad); SetBoolToHeader("FL_USE_LONG_FLARE", cfg.long_flare); SetBoolToHeader("SSDO_USE_INDIRECT_BOUNCES", cfg.indirect_bounce); SetBoolToHeader("DDOF_VIGNETTING", cfg.vignette); SetBoolToHeader("DDOF_CHROMATIC_ABERRATION", cfg.chrom_aberr); #endregion Write(); } catch (Exception) { //MessageBox.Show("Error 446\n" + e.Message); } }
public void Load(string _path, OgseGraphics cfg) { path = _path; raw_file = Utils.ReadData(path); try { #region numeric cfg.vol_max_int = GetDoubleFromHeader("SS_VOL_MAX_INTENSITY") * 100; cfg.vol_light_max_int = GetDoubleFromHeader("VOL_LIGHT_MAX_INTENSITY") * 1000; cfg.ssdo_int = GetDoubleFromHeader("SSDO_BLEND_FACTOR") * 50; cfg.hbao_int = GetDoubleFromHeader("HBAO_BLEND_FACTOR") * 100; cfg.vignette_int = (1 - GetDoubleFromHeader("DDOF_VIGNOUT")) * 100; cfg.ddof_gain = GetDoubleFromHeader("DDOF_GAIN"); cfg.zdof_int = GetDoubleFromHeader("ZDOF_INTENSITY") * 100; cfg.rdof_int = GetDoubleFromHeader("RDOF_INTENSITY") * 100; cfg.puddles_grow = GetDoubleFromHeader("PUDDLES_GROW_SPEED") * 100; #endregion #region params check cfg.ss_dust = GetBoolFromHeader("SS_DUST"); cfg.ss_volume_dust = GetBoolFromHeader("USE_VOLUMETRIC_DUST"); cfg.moonroad = GetBoolFromHeader("USE_MOON_ROAD"); cfg.long_flare = GetBoolFromHeader("FL_USE_LONG_FLARE"); cfg.indirect_bounce = GetBoolFromHeader("SSDO_USE_INDIRECT_BOUNCES"); cfg.vignette = GetBoolFromHeader("DDOF_VIGNETTING"); cfg.chrom_aberr = GetBoolFromHeader("DDOF_CHROMATIC_ABERRATION"); #endregion } catch (Exception) { //MessageBox.Show("Error 446\n" + e.Message); } }
private void FormConstruct() { try { read_fsgame(); load_other(); set_image(); load_list_saves(); // load_leng(); var cfg = new OgseConfig(); OgseConfigSerializer.Instance.Load(cfg); this.propertyGrid1.SelectedObject = cfg; this.propertyGrid1.HelpVisible = true; var cfg2 = new OgseGraphics(); OgseGraphicsSerializer.Instance.Load(Data.ShaderConfigPath, cfg2); this.propertyGrid2.SelectedObject = cfg2; string tmp = new string('\r', 29); Utils.INI.GetPrivateProfileString("mod_ver", "mod_ver", "", tmp, 30, Data.VersionPath); // test string test_for_morons = new string('\r', 29); //if (Utils.INI.GetPrivateProfileString("mod_ver", "mod_ver", "", test_for_morons, 30, Data.RootAppPath) != 0) // File.Copy(Environment.CurrentDirectory + "\\ogse_config.ltx", Environment.CurrentDirectory + "\\gamedata\\config\\tuning\\ogse_config.ltx", true); // test end // защита от удаления/отсутствия локализации if (!File.Exists(Environment.CurrentDirectory + "\\gamedata.db_xlocale") && File.Exists(Environment.CurrentDirectory + "\\localization\\" + lang + "\\gamedata.db_xlocale")) { File.Copy(Environment.CurrentDirectory + "\\localization\\" + lang + "\\gamedata.db_xlocale", Environment.CurrentDirectory + "\\gamedata.db_xlocale", true); } ApplyButton.Enabled = false; if (Directory.Exists(Data.SavesDir)) { File.Delete(Data.SavesDir + "\\wreset"); this.button4.Enabled = true; } else { this.button4.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); this.Close(); } }
private void FormConstruct() { try { read_fsgame(); load_other(); set_image(); load_list_saves(); // load_leng(); #region About try { about_mod.LoadFile("localization//" + lang + "//ogse_about_mod.rtf", RichTextBoxStreamType.RichText); } catch { about_mod.Text = res.GetString("CANT_FIND_FILE") + " ogse_about_mod.rtf"; } try { team.LoadFile("localization//" + lang + "//ogse_about.rtf", RichTextBoxStreamType.RichText); } catch { team.Text = res.GetString("CANT_FIND_FILE") + " ogse_about.rtf"; } try { features.LoadFile("localization//" + lang + "//ogse_features.rtf", RichTextBoxStreamType.RichText); } catch { features.Text = res.GetString("CANT_FIND_FILE") + " ogse_features.rtf"; } #endregion var cfg = new OgseConfig(); OgseConfigSerializer.Instance.Load(cfg); this.propertyGrid1.SelectedObject = cfg; this.propertyGrid1.HelpVisible = true; var cfg2 = new OgseGraphics(); OgseGraphicsSerializer.Instance.Load(Data.ShaderConfigPath, cfg2); this.propertyGrid2.SelectedObject = cfg2; string tmp = new string('\r', 29); Utils.INI.GetPrivateProfileString("mod_ver", "mod_ver", "", tmp, 30, Data.VersionPath); // test string test_for_morons = new string('\r', 29); if (Utils.INI.GetPrivateProfileString("mod_ver", "mod_ver", "", test_for_morons, 30, Data.RootAppPath) != 0) { File.Copy(Environment.CurrentDirectory + "\\ogse_config.ltx", Environment.CurrentDirectory + "\\gamedata\\config\\tuning\\ogse_config.ltx", true); } // test end // защита от удаления/отсутствия локализации if (!File.Exists(Environment.CurrentDirectory + "\\gamedata.db_xlocale")) { File.Copy(Environment.CurrentDirectory + "\\localization\\" + lang + "\\gamedata.db_xlocale", Environment.CurrentDirectory + "\\gamedata.db_xlocale", true); } // specific code for first launch after patch 2.07/8 if (File.Exists(Environment.CurrentDirectory + "\\patch_2_08_cleanup")) { OgseConfigSerializer.Instance.Save(this.propertyGrid1.SelectedObject as OgseConfig); var cfg_new = new OgseConfig(); OgseConfigSerializer.Instance.Load(cfg_new); this.propertyGrid1.SelectedObject = cfg_new; File.Copy(Environment.CurrentDirectory + "\\localization\\" + lang + "\\gamedata.db_xlocale", Environment.CurrentDirectory + "\\gamedata.db_xlocale", true); if (Directory.Exists(Data.LogsPath) && Directory.Exists(Data.ShaderCache)) { Directory.Delete(Data.ShaderCache, true); } // specific code for 2.10 revised //gamedata/config/tuning if (Directory.Exists(Environment.CurrentDirectory + "\\gamedata\\config\\tuning\\") && File.Exists(Environment.CurrentDirectory + "\\gamedata\\config\\tuning\\ogse_config.ltx")) { File.Copy(Environment.CurrentDirectory + "\\gamedata\\config\\tuning\\ogse_config.ltx", Environment.CurrentDirectory + "\\gamedata_new\\config\\tuning\\ogse_config.ltx", true); } // gamedata/shaders if (Directory.Exists(Environment.CurrentDirectory + "\\gamedata\\shaders\\r2\\") && File.Exists(Environment.CurrentDirectory + "\\gamedata\\shaders\\r2\\configurator_defines.h")) { File.Copy(Environment.CurrentDirectory + "\\gamedata\\shaders\\r2\\configurator_defines.h", Environment.CurrentDirectory + "\\gamedata_new\\shaders\\r2\\configurator_defines.h", true); } Directory.Delete(Environment.CurrentDirectory + "\\gamedata\\", true); Directory.Move(Environment.CurrentDirectory + "\\gamedata_new\\", Environment.CurrentDirectory + "\\gamedata\\"); if (!File.Exists(Environment.CurrentDirectory + "\\gamedata\\config\\tuning\\ogse_config.ltx")) { File.Copy(Environment.CurrentDirectory + "\\ogse_config.ltx", Environment.CurrentDirectory + "\\gamedata\\config\\tuning\\ogse_config.ltx", true); } if (!File.Exists(Environment.CurrentDirectory + "\\gamedata\\shaders\\r2\\configurator_defines.h")) { File.Copy(Environment.CurrentDirectory + "\\configurator_defines.h", Environment.CurrentDirectory + "\\gamedata\\shaders\\r2\\configurator_defines.h", true); } File.Delete(Environment.CurrentDirectory + "\\patch_2_08_cleanup"); } ApplyButton.Enabled = false; this.button2.Enabled = false; this.button3.Enabled = false; if (Directory.Exists(Data.SavesDir)) { File.Delete(Data.SavesDir + "\\wreset"); this.button4.Enabled = true; } else { this.button4.Enabled = false; } this.label6.Text = tmp; this.label7.Text = ""; this.label8.Text = ""; this.label9.Visible = false; this.progressBar2.Visible = false; this.richTextBox1.Enabled = false; // find_upd(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); this.Close(); } }