Exemplo n.º 1
0
        void ReloadPresets(string defaultPresetName)
        {
            presetComboBox.Items.Clear();
            presetComboBox.Items.Add(blankPreset);

            Preset defaultPreset = blankPreset;

            defaultPresetName = defaultPresetName.ToLower();
            string[] presetFiles = PresetManager.GetPresetFiles();
            foreach (string presetFile in presetFiles)
            {
                try
                {
                    Preset preset = PresetReader.LoadPreset(presetFile);
                    presetComboBox.Items.Add(preset);

                    if (preset.Name.ToLower() == defaultPresetName)
                    {
                        defaultPreset = preset;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("{0} is not a valid preset file:\n{1}", presetFile, ex.Message), null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            presetComboBox.SelectedItem = defaultPreset;
        }
Exemplo n.º 2
0
 static Preset GetPreset(IDictionary <string, string> options)
 {
     try
     {
         string presetName = "Default.xml";
         if (options.ContainsKey("preset"))
         {
             presetName = options["preset"];
             if (string.IsNullOrEmpty(Path.GetExtension(presetName)))
             {
                 presetName = string.Format("{0}.xml", presetName);
             }
         }
         return(PresetReader.LoadPreset(presetName));
     }
     catch (Exception ex)
     {
         throw new LetsTagException("Could not load preset", ex);
     }
 }