Skip to content

Commit

Permalink
Merge pull request #87 from FilteredStudio/main
Browse files Browse the repository at this point in the history
Added custom flag editor (#83)
  • Loading branch information
MaximumADHD committed Apr 2, 2021
2 parents 024484a + 0fd77cf commit 5a1c27d
Show file tree
Hide file tree
Showing 8 changed files with 1,465 additions and 1,120 deletions.
170 changes: 170 additions & 0 deletions ProjectSrc/Forms/FlagCreator.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions ProjectSrc/Forms/FlagCreator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace RobloxStudioModManager
{
public partial class FlagCreator : Form
{
public CustomFlag Result { get; private set; }
private static readonly string[] classes = new string[3] { "F", "DF", "SF" };

public FlagCreator()
{
InitializeComponent();
flagType.SelectedIndex = 0;
flagClass.SelectedIndex = 0;
}

private void createButton_Click(object sender, EventArgs e)
{
string classType = classes[flagClass.SelectedIndex];
string type = classType + flagType.SelectedItem.ToString();
string name = Regex.Replace(flagName.Text, "[^A-z0-9_]", "");

if (flagName.Text != name)
flagName.Text = name;

if (string.IsNullOrEmpty(name))
{
MessageBox.Show
(
$"Please enter a name for the {type}!",
"Invalid submission!",

MessageBoxButtons.OK,
MessageBoxIcon.Error
);

return;
}

Result = new CustomFlag(type, name);
DialogResult = DialogResult.OK;

Close();
}

private void cancelButton_Click(object sender, EventArgs e)
{
Close();
}
}
}
Loading

0 comments on commit 5a1c27d

Please sign in to comment.