Ejemplo n.º 1
0
 private void BtnTryAll_Click(object sender, EventArgs e)
 {
     TxtOutput.Clear();
     for (int a = 0; a < 26; a++)
     {
         TxtOutput.AppendText(a.ToString() + " " + Decipher(TxtInput.Text, a) + System.Environment.NewLine);
     }
     TxtOutput.ScrollToCaret();
 }
Ejemplo n.º 2
0
        private void BtnToChar_Click(object sender, EventArgs e)
        {
            TxtOutput.Clear();
            TxtCount.Clear();

            Tuple <Dictionary <char, uint>, Dictionary <char, uint> > tp = Functions.MakeOldCodeDict(TxtInput.Text.ToCharArray());

            DictOldCode  = tp.Item1;
            DictCountDup = tp.Item2;

            ShowLastDict(DictOldCode);
        }
Ejemplo n.º 3
0
        private void BtnReplace_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TxtInput.Text) || string.IsNullOrWhiteSpace(TxtInput.Text))
            {
                return;
            }

            BtnPaste.Enabled   = false;
            BtnReplace.Enabled = false;
            BtnCancel.Enabled  = true;

            DgvData.EndEdit();
            TxtOutput.Clear();

            var output = new StringBuilder();

            foreach (DataGridViewRow r in DgvData.Rows)
            {
                var inputText = TxtInput.Text;

                foreach (DataGridViewCell c in r.Cells)
                {
                    if (c.Value == null)
                    {
                        continue;
                    }

                    inputText = inputText.Replace(c.OwningColumn.HeaderText, c.Value.ToString());
                }

                if (inputText != TxtInput.Text)
                {
                    output.Append(inputText + Environment.NewLine);
                }

                if (_cancel)
                {
                    CancelOperation();
                    return;
                }

                Application.DoEvents();
            }

            TxtOutput.Text = output.ToString();

            BtnPaste.Enabled  = true;
            BtnCancel.Enabled = false;
            MessageBox.Show("Operation complete");
            BtnReplace.Enabled = true;
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////

        // Is called when the open file dialog is closed with a legal file being selected
        private void dlgOpenFile_FileOk(object sender, CancelEventArgs e)
        {
            // Set up GUI for conversion
            BtnOpenFile.Visibility  = Visibility.Collapsed;
            BtnCancel.Visibility    = Visibility.Visible;
            WpOffsetInput.IsEnabled = false;
            LblProgress.Content     = "Progress: 0%";
            TxtOutput.Clear();
            TxtOutput.Visibility = Visibility.Visible;

            // Record the offset before starting the conversion
            _offsetMs = getOffsetTime();

            // Run the BackgroundWorker asynchronously to convert the selected files
            _backgroundWorker.RunWorkerAsync();
        }
Ejemplo n.º 5
0
        private void BtnLoadSelectedFiles_Click(object sender, EventArgs e)
        {
            TxtInput.Clear();
            List <string> FilesToLoad = new List <string>();

            foreach (var file in LstFiles.SelectedItems)
            {
                FilesToLoad.Add(file.ToString());
            }
            TxtInput.Text = Functions.LoadFiles(FilesToLoad);

            TxtOutput.Clear();
            TxtCount.Clear();

            Tuple <Dictionary <char, uint>, Dictionary <char, uint> > tp = Functions.MakeOldCodeDict(TxtInput.Text.ToCharArray());

            DictOldCode  = tp.Item1;
            DictCountDup = tp.Item2;

            ShowLastDict(DictOldCode);
        }
Ejemplo n.º 6
0
        private void CmdStart_Click(object sender, EventArgs e)
        {
            TxtOutput.Clear();
            int loop = 0;

            /*int value = Convert.ToInt32(TxtInput.Text);
             *
             * while (value > 0)
             * {
             *  value /= 2;
             *  TxtOutput.Text += value + "\r\n";
             *  loop++;
             * }*/

            int    value = 0;
            string data  = "";
            Random r     = new Random();
            int    input = Convert.ToInt32(TxtInput.Text);

            if (input >= 0 && input <= 1000)
            {
                do
                {
                    value = r.Next(0, 10000);
                    data += value + ", ";
                    loop++;
                } while (value != input);

                TxtOutput.Text     = data;
                LblNumRepeats.Text = loop.ToString();
            }
            else
            {
                MessageBox.Show("Zahl muss zwischen 0 und 1000 leigen :)");
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Clear output console
 /// </summary>
 private void BtnClearConsole_Click(object sender, EventArgs e)
 {
     TxtOutput.Clear();
 }