public sweetConfig clone() { sweetConfig clone = new sweetConfig(this.filePath); clone.isClone = true; return(clone); }
public void initConfigPreset(String name, gameEntry game, sweetConfig config) { this.name = name; setupINI(); path = Path.Combine(game.folder, Form1.sweetfxFolderName); path = Path.Combine(path, presetFolder); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string basename = "preset"; int i = 0; String filename = Path.Combine(path, basename + i.ToString() + ".ini"); while (File.Exists(filename)) { i++; filename = Path.Combine(path, basename + i.ToString() + ".ini"); } path = filename; updateFromConfig(config); }
public bool checkActive() { String installed = this.getPathFor(check_for_active_file); String settingsfile = getPathFor(setting_config); String injectfile = getPathFor(setting_injector); if (File.Exists(installed)) { if (!isActivated) { if (File.Exists(settingsfile)) { this.Config = new sweetConfig(settingsfile); } if (File.Exists(injectfile)) { injectordata = new injector(injectfile); } } isActivated = true; } else { isActivated = false; injectordata = null; Config = null; } return(isActivated); }
private void button7_Click_1(object sender, EventArgs e) { if (activeGame != null) { sweetConfig defaultConfig = new sweetConfig(System.IO.Path.Combine(sweetfx_folder, "SweetFX_settings.txt")); new showDiff(activeGame.Config, defaultConfig).Show(); } }
public void updateFromConfig(sweetConfig conf) { foreach (sweetConfig.FXSetting s in conf.FXSettings) { parsedData["setting"].AddKey(s.name); parsedData["setting"][s.name] = s.value; } savePreset(); }
public void importPreset(String filename) { sweetConfig newp = new sweetConfig(filename); String presetname = Path.GetFileNameWithoutExtension(filename); configPreset npreset = new configPreset(presetname, game, newp); npreset.savePreset(); game.presets.Add(npreset); refreshUI(); }
private void exportButton_Click(object sender, EventArgs e) { saveFileDialog1.FileName = "SweetFX_Settings_" + game.shortName + "_" + activePreset.name; if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { sweetConfig clone = game.Config.clone(); clone.loadPreset(this.activePreset); clone.writeToFile(saveFileDialog1.FileName); } }
public FXSetting[] diffConfig(sweetConfig otherConfig) { List<FXSetting> bla = new List<FXSetting>(); foreach (FXSetting s in otherConfig.FXSettings) { if (!byName.ContainsKey(s.name) || byName[s.name].value != s.value) { if (byName[s.name].parent == null || byName[s.name].parent.value == "1") { bla.Add(byName[s.name]); } } } return bla.ToArray(); }
public FXSetting(Match match, FXSetting parent, sweetConfig controller) { name = match.Groups[1].Value; value = match.Groups[2].Value; origValue = match.Groups[2].Value; limit = match.Groups[3].Value; comment = match.Groups[4].Value; this.parent = parent; this.controller = controller; controller.byName.Add(name, this); if (parent != null) { parent.addChild(this); } }
public static String[] formatChanges(sweetConfig.FXSetting[] s, bool showCompact) { List<String> changes = new List<string>(); foreach (WindowsFormsApplication1.sweetConfig.FXSetting entry in s) { if (showCompact) { String temp = entry.name + " = " + entry.value; if (entry.parent != null) temp = temp.PadRight(34) + "// " + entry.parent.name; changes.Add(temp); } else changes.Add(entry.formatLine()); } return changes.ToArray(); }
public FXSetting[] diffConfig(sweetConfig otherConfig) { List <FXSetting> bla = new List <FXSetting>(); foreach (FXSetting s in otherConfig.FXSettings) { if (!byName.ContainsKey(s.name) || byName[s.name].value != s.value) { if (byName[s.name].parent == null || byName[s.name].parent.value == "1") { bla.Add(byName[s.name]); } } } return(bla.ToArray()); }
private void refreshUI() { presetList.DataSource = null; presetList.DataSource = game.presets; if (presetList.SelectedIndex != -1) { configPreset preset = game.presets.ElementAt(presetList.SelectedIndex); sweetConfig clone = game.Config.clone(); clone.loadPreset(preset); textBox2.Lines = showDiff.formatChanges(clone.diffConfig(game.Config), true); activePreset = preset; } else { activePreset = null; } button5.Visible = true; }
public bool checkActive() { String installed = this.getPathFor(check_for_active_file); String settingsfile = getPathFor(setting_config); String injectfile = getPathFor(setting_injector); if (File.Exists(installed)) { if (!isActivated) { if (File.Exists(settingsfile)) this.Config = new sweetConfig(settingsfile); if (File.Exists(injectfile)) injectordata = new injector(injectfile); } isActivated = true; } else { isActivated = false; injectordata = null; Config = null; } return isActivated; }
public void initConfigPreset(String name, gameEntry game, sweetConfig config) { this.name = name; setupINI(); path = Path.Combine(game.folder, Form1.sweetfxFolderName); path = Path.Combine(path, presetFolder); if (!Directory.Exists(path)) Directory.CreateDirectory(path); string basename = "preset"; int i = 0; String filename = Path.Combine(path, basename + i.ToString() + ".ini"); while (File.Exists(filename)) { i++; filename = Path.Combine(path, basename + i.ToString() + ".ini"); } path = filename; updateFromConfig(config); }
public configPreset(String name, gameEntry game, sweetConfig config) { initConfigPreset(name, game, config); }
public sweetConfig clone() { sweetConfig clone = new sweetConfig(this.filePath); clone.isClone = true; return clone; }
public FXSetting(Match match, FXSetting parent, sweetConfig controller) { name = match.Groups[1].Value; value = match.Groups[2].Value; origValue = match.Groups[2].Value; limit = match.Groups[3].Value; comment = match.Groups[4].Value; this.parent = parent; this.controller = controller; controller.byName.Add(name, this); if (parent != null) parent.addChild(this); }
public showDiff(sweetConfig conf1, sweetConfig orig) { InitializeComponent(); this.conf1 = conf1; this.orig = orig; }