Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CjangCjengh committed Aug 26, 2022
1 parent 7a58805 commit b840bb6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions MoeGoe_GUI/AdvancedWin.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace MoeGoe_GUI
Expand All @@ -10,12 +11,22 @@ public AdvancedWin(TextBox box, CommandLine cmd)
InitializeComponent();
parentBox = box;
this.cmd = cmd;
textBox.Text = box.Text;
Regex regexLength = new Regex(@"\[LENGTH=.+?\]");
Regex regexCleaned = new Regex(@"\[CLEANED\]");
Match match = regexLength.Match(box.Text);
if (match.Success)
{
lengthScale = match.Value;
textBox.Text = regexCleaned.Replace(regexLength.Replace(box.Text, ""), "");
}
else
textBox.Text = regexCleaned.Replace(box.Text, "");
cmd.OutputHandler += Cmd_OutputHandler;
}

private readonly TextBox parentBox;
private readonly CommandLine cmd;
private readonly string lengthScale;

private void Cmd_OutputHandler(CommandLine sender, string e)
{
Expand All @@ -24,7 +35,10 @@ private void Cmd_OutputHandler(CommandLine sender, string e)

private void ConfirmButton_Click(object sender, EventArgs e)
{
parentBox.Text = "[CLEANED]" + cleanedBox.Text;
if (lengthScale == null)
parentBox.Text = "[CLEANED]" + cleanedBox.Text;
else
parentBox.Text = lengthScale + "[CLEANED]" + cleanedBox.Text;
Close();
}

Expand Down

0 comments on commit b840bb6

Please sign in to comment.