Exemplo n.º 1
0
        public sweetConfig clone()
        {
            sweetConfig clone = new sweetConfig(this.filePath);

            clone.isClone = true;
            return(clone);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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();
     }
 }
Exemplo n.º 5
0
 public void updateFromConfig(sweetConfig conf)
 {
     foreach (sweetConfig.FXSetting s in conf.FXSettings)
     {
         parsedData["setting"].AddKey(s.name);
         parsedData["setting"][s.name] = s.value;
     }
     savePreset();
 }
Exemplo n.º 6
0
 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();
 }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
        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();
        }
Exemplo n.º 9
0
 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();
 }
Exemplo n.º 10
0
 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);
     }
 }
Exemplo n.º 11
0
 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();
 }
Exemplo n.º 12
0
        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());
        }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 14
0
 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;
 }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
 public configPreset(String name, gameEntry game, sweetConfig config)
 {
     initConfigPreset(name, game, config);
 }
Exemplo n.º 17
0
 public void updateFromConfig(sweetConfig conf)
 {
     foreach (sweetConfig.FXSetting s in conf.FXSettings)
     {
         parsedData["setting"].AddKey(s.name);
         parsedData["setting"][s.name] = s.value;
     }
     savePreset();
 }
Exemplo n.º 18
0
 public sweetConfig clone()
 {
     sweetConfig clone = new sweetConfig(this.filePath);
     clone.isClone = true;
     return clone;
 }
Exemplo n.º 19
0
 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);
 }
Exemplo n.º 20
0
 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();
     }
 }
Exemplo n.º 21
0
 public configPreset(String name, gameEntry game, sweetConfig config)
 {
     initConfigPreset(name, game, config);
 }
Exemplo n.º 22
0
 public showDiff(sweetConfig conf1, sweetConfig orig)
 {
     InitializeComponent();
     this.conf1 = conf1;
     this.orig  = orig;
 }
Exemplo n.º 23
0
 public showDiff(sweetConfig conf1, sweetConfig orig)
 {
     InitializeComponent();
     this.conf1 = conf1;
     this.orig = orig;
 }