Exemplo n.º 1
0
        private static void AddDirectory(string dir, List <ISwatch> swatches)
        {
            foreach (string swatchFile in Directory.EnumerateFiles(dir, "*"))
            {
                string ext = Path.GetExtension(swatchFile);

                ISwatch swatch = null;

                if (ext.ToLower() == ".swtch")
                {
                    swatch = new MCSwatch(swatchFile);
                }
                else if (ext.ToLower() == ".gpl" || ext.ToLower() == ".gimp")
                {
                    swatch = new GIMPSwatch(swatchFile);
                }
                else if (ext.ToLower() == ".act")
                {
                    swatch = new ACTSwatch(swatchFile);
                }
                else if (ext.ToLower() == ".aco")
                {
                    swatch = new ACOSwatch(swatchFile);
                }

                if (swatch != null)
                {
                    swatches.Add(swatch);
                    swatch.Load();
                }
            }
        }
Exemplo n.º 2
0
        private static void AddDirectory(string dir, List<ISwatch> swatches)
        {
            foreach (string swatchFile in Directory.GetFiles(dir, "*"))
            {
                string ext = Path.GetExtension(swatchFile);

                ISwatch swatch = null;

                if (ext.ToLower() == ".swtch")
                    swatch = new MCSwatch(swatchFile);
                else if (ext.ToLower() == ".gpl" || ext.ToLower() == ".gimp")
                    swatch = new GIMPSwatch(swatchFile);
                else if (ext.ToLower() == ".act")
                    swatch = new ACTSwatch(swatchFile);
                else if (ext.ToLower() == ".aco")
                    swatch = new ACOSwatch(swatchFile);

                if (swatch != null)
                {
                    swatches.Add(swatch);
                    swatch.Load();
                }
            }
        }
Exemplo n.º 3
0
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                if (!_creatingSwatch)
                    SwatchDisplayer.Swatch.Name = textBox1.Text;
                else
                {
                    var newSwatch = new MCSwatch(GlobalSettings.GetDataURI("Swatches\\" + textBox1.Text + ".swtch"));
                    newSwatch.Save();

                    comboBox1.Items.Add(newSwatch);
                    comboBox1.SelectedItem = newSwatch;
                }

                e.Handled = true;
                textBox1.Visible = false;

                comboBox1.Refresh();
            }
        }