예제 #1
0
        public sweetConfig clone()
        {
            sweetConfig clone = new sweetConfig(this.filePath);

            clone.isClone = true;
            return(clone);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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();
     }
 }
예제 #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();
 }
예제 #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();
 }
예제 #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);
     }
 }
예제 #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();
        }
예제 #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();
 }
예제 #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);
     }
 }
예제 #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();
 }
예제 #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());
        }
예제 #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;
        }
예제 #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;
 }
예제 #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);
        }
예제 #16
0
 public configPreset(String name, gameEntry game, sweetConfig config)
 {
     initConfigPreset(name, game, config);
 }
예제 #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();
 }
예제 #18
0
 public sweetConfig clone()
 {
     sweetConfig clone = new sweetConfig(this.filePath);
     clone.isClone = true;
     return clone;
 }
예제 #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);
 }
예제 #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();
     }
 }
예제 #21
0
 public configPreset(String name, gameEntry game, sweetConfig config)
 {
     initConfigPreset(name, game, config);
 }
예제 #22
0
 public showDiff(sweetConfig conf1, sweetConfig orig)
 {
     InitializeComponent();
     this.conf1 = conf1;
     this.orig  = orig;
 }
예제 #23
0
 public showDiff(sweetConfig conf1, sweetConfig orig)
 {
     InitializeComponent();
     this.conf1 = conf1;
     this.orig = orig;
 }