Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDaniel committed Sep 19, 2020
1 parent 5733dce commit c00ce9d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 43 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Reddit AutoModerator config generator
---
## https://discord.gg/JhNeVSq
### Discord support server

---
![commits](https://img.shields.io/github/commit-activity/m/MiranDaniel/automod-generator?style=flat-square)
![issues](https://img.shields.io/github/issues-raw/MiranDaniel/automod-generator?style=flat-square)
![pr](https://img.shields.io/github/issues-pr-raw/MiranDaniel/automod-generator?style=flat-square)

---
# Supported functions:

## Checks
Expand Down Expand Up @@ -71,4 +79,4 @@ set_locked

```
moderators_exempt
```
```
68 changes: 30 additions & 38 deletions automod-generator/automod-generator/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;
using System.IO;

namespace automod_generator
{
Expand Down Expand Up @@ -66,7 +58,7 @@ private void Form1_Load(object sender, EventArgs e)
listType.CheckOnClick = true;
checkList.CheckOnClick = true;




}
Expand All @@ -85,9 +77,9 @@ public void compile()
{

string types = "";
foreach(string te in listType.CheckedItems)
foreach (string te in listType.CheckedItems)
{
if(types == "")
if (types == "")
{
types = te;
}
Expand All @@ -96,7 +88,7 @@ public void compile()
types = types + "+" + te;
}
}
if(types != "")
if (types != "")
{
vars.typeData.Add("type: " + types);
}
Expand All @@ -117,9 +109,9 @@ void addPosCondition()
addData = addData + "+" + item;
}
}
if (checkRegex.Checked || checkCase.Checked)
{

if (checkRegex.Checked || checkCase.Checked)
{
addModifiers = "(";
if (checkRegex.Checked && checkCase.Checked)
{
Expand All @@ -139,44 +131,44 @@ void addPosCondition()
addModifiers = addModifiers + ")";
}
addData = addData + addModifiers;

if (checkList.CheckedItems.Count > 0)
{
addData = addData + ":";
}
addData = addData +" " + boxFind.Text;
if(addData != "")
addData = addData + " " + boxFind.Text;
if (addData != "")
{
vars.conditionData.Add(vars.prefix + addData);
}
foreach (string standard in standardList.CheckedItems)
{
if(standardData == "")
if (standardData == "")
{
standardData = standard;
}
}
if(standardList.CheckedItems.Count > 0)
if (standardList.CheckedItems.Count > 0)
{
vars.conditionData.Add("standard: " + standardData);
}
foreach(string useris in userisList.CheckedItems)
foreach (string useris in userisList.CheckedItems)
{
if(userisData == "")
if (userisData == "")
{
vars.conditionData.Add("author:");
}
userisData = useris;
if(vars.prefix == "")
if (vars.prefix == "")
{
vars.conditionData.Add(" " + useris + ": false");
}
else
{
vars.conditionData.Add(" " + useris + ": true");
}
}

}
}
void addNegCondition()
{
Expand All @@ -186,13 +178,13 @@ void addNegCondition()
void addAction()
{
string actionData = "";
foreach(string action in actionList.CheckedItems)
foreach (string action in actionList.CheckedItems)
{
actionData = "action: " + action;
vars.actionData.Add(actionData);
if (checkReason.Checked)
{
if(action != "report")
if (action != "report")
{
vars.actionData.Add("action_reason: " + boxReason.Text);
}
Expand All @@ -202,16 +194,16 @@ void addAction()
}
}
}
foreach(string action in moreactionList.CheckedItems)
foreach (string action in moreactionList.CheckedItems)
{
vars.actionData.Add(action+": true");
vars.actionData.Add(action + ": true");
}
}
void addModifier()
{
foreach(string modifier in addList.CheckedItems)
foreach (string modifier in addList.CheckedItems)
{
if(modifier == "moderators_exempt")
if (modifier == "moderators_exempt")
{
vars.modifierData.Add(modifier + ": false");
}
Expand Down Expand Up @@ -240,11 +232,11 @@ void addModifier()
string m = string.Join("\n", vars.modifierData);
output.Text = output.Text + "\n" + m;
string a = string.Join("\n", vars.actionData);
output.Text = output.Text +"\n"+ a;
output.Text = output.Text + "\n" + a;
resetMemory();
foreach(string item in settings.CheckedItems)
foreach (string item in settings.CheckedItems)
{
if(item == "Clear selection after adding.")
if (item == "Clear selection after adding.")
{
clearSelection();
}
Expand Down Expand Up @@ -272,7 +264,7 @@ private void ifButton_Click(object sender, EventArgs e)
{
vars.type = "addPosCondition";
compile();

}

private void ifNotButton_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -305,7 +297,7 @@ private void resetButton_Click(object sender, EventArgs e)

public void debug(string data)
{
if(richTextBox2.Text == "")
if (richTextBox2.Text == "")
{
richTextBox2.Text = data;
}
Expand Down Expand Up @@ -344,7 +336,7 @@ private void clrselButton_Click(object sender, EventArgs e)

private void debugButton_Click(object sender, EventArgs e)
{
if(vars.debug == false)
if (vars.debug == false)
{
vars.debug = true;
debug("enabled debug");
Expand All @@ -362,7 +354,7 @@ private void debugButton_Click(object sender, EventArgs e)
richTextBox2.Visible = false;
resetButton.Visible = false;
}

}
}
}
Expand Down
3 changes: 0 additions & 3 deletions automod-generator/automod-generator/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace automod_generator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
Binary file not shown.

0 comments on commit c00ce9d

Please sign in to comment.