Example #1
0
        //opens file dialog and loads pedalboard from that file
        private void Import_Click(object sender, EventArgs e)
        {
            pedalBoard.removePanels();
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter = "TXT Files|*.txt";
            openFileDialog1.Title  = "Select a Pedalboard";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                // Read each line of the file into a string array. Each element
                // of the array is one line of the file.
                string[] lines = System.IO.File.ReadAllLines(openFileDialog1.FileName);

                foreach (string line in lines)
                {
                    if (line != "")
                    {
                        pedalBoard.addPanel(line);
                    }
                }
            }
            else
            {
                //TODO create a dialog saying not found
                while (true)
                {
                    ;
                }
            }
        }
Example #2
0
        private void Presets_ValueChanged(object sender, EventArgs e)
        {
            int numPedals = 0;

            currentIndex = 0;
            pedalConfig.removePanels();
            currentConfig[14] = ampSettingsToNum(ampSettings.Text);
            ampSettings.Text  = "";
            for (int i = 0; i < 14; i++)
            {
                savedConfigs[currentPreset, i] = currentConfig[i];
                if (savedConfigs[(int)Presets.Value, i] > 0)
                {
                    numPedals++;
                }
            }
            savedConfigs[currentPreset, 14] = currentConfig[14];
            currentPreset = (int)Presets.Value;

            if (numPedals > 0)
            {
                string text;
                int    amp = savedConfigs[currentPreset, 14];
                alreadyUsed = true;
                for (int i = 0; i < numPedals; i++)
                {
                    pedalConfig.addPanel(pedalBoard.pedalInfos().ElementAt(savedConfigs[currentPreset, i] - 1).ElementAt(1), false, false);
                }
                if (amp == 1)
                {
                    text = "Clean";
                }
                else if (amp == 2)
                {
                    text = "Rhythm";
                }
                else
                {
                    text = "Lead";
                }
                ampSettings.Text = text;
            }
            else
            {
                alreadyUsed = false;
            }
            for (int i = 0; i < 14; i++)
            {
                currentConfig[i] = savedConfigs[currentPreset, i];
            }
        }