示例#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;
 }