Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Core files uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Copy05 committed Jan 20, 2023
0 parents commit 8fff192
Show file tree
Hide file tree
Showing 62 changed files with 32,182 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/TrueRestrictive.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrueRestrictive", "TrueRestrictive\TrueRestrictive.csproj", "{3F0A866F-2097-4875-8BB8-95ACA1B20689}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4AE61E3C-B86B-49FC-93B2-A68FF6266CBF}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3F0A866F-2097-4875-8BB8-95ACA1B20689}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F0A866F-2097-4875-8BB8-95ACA1B20689}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F0A866F-2097-4875-8BB8-95ACA1B20689}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F0A866F-2097-4875-8BB8-95ACA1B20689}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8D4681B7-124A-4844-BA2B-6D5743F301DD}
EndGlobalSection
EndGlobal
87 changes: 87 additions & 0 deletions src/TrueRestrictive/Agesoft_Codering.Designer.cs

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

103 changes: 103 additions & 0 deletions src/TrueRestrictive/Agesoft_Codering.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace TrueRestrictive
{
public partial class Agesoft_Codering : Form
{
public Agesoft_Codering()
{
InitializeComponent();
}

public string DocumentText = "";
private void Agesoft_Codering_Load(object sender, EventArgs e)
{
CodeBox.Text = DocumentText;
this.BringToFront();
}

private void CodeBox_TextChanged(object sender, EventArgs e)
{

// getting keywords/functions
string keywords = @"\b(public|private|protected|partial|static|namespace|class|struct|enum|using|void|string|int|bool|float|double|short|byte|char|const)\b";
MatchCollection keywordMatches = Regex.Matches(CodeBox.Text, keywords);

// getting conds
string conds = @"\b(if|else|switch|case|foreach)\b";
MatchCollection condsMatches = Regex.Matches(CodeBox.Text, conds);

// getting types/classes from the text
string types = @"\b(Console|Regex|Agesoft|Font|Application)\b";
MatchCollection typeMatches = Regex.Matches(CodeBox.Text, types);

// getting comments (inline or multiline)
string comments = @"(\/\/.+?$|\/\*.+?\*\/)";
MatchCollection commentMatches = Regex.Matches(CodeBox.Text, comments, RegexOptions.Multiline);

// getting strings
string strings = "\".+?\"";
MatchCollection stringMatches = Regex.Matches(CodeBox.Text, strings);

// saving the original caret position + forecolor
int originalIndex = CodeBox.SelectionStart;
int originalLength = CodeBox.SelectionLength;
Color originalColor = Color.White;

// MANDATORY - focuses a label before highlighting (avoids blinking)
titleLabel.Focus();

// removes any previous highlighting (so modified words won't remain highlighted)
CodeBox.SelectionStart = 0;
CodeBox.SelectionLength = CodeBox.Text.Length;
CodeBox.SelectionColor = originalColor;

// scanning...
foreach (Match m in keywordMatches)
{
CodeBox.SelectionStart = m.Index;
CodeBox.SelectionLength = m.Length;
CodeBox.SelectionColor = Color.FromArgb(86, 156, 214);
}

foreach (Match m in condsMatches)
{
CodeBox.SelectionStart = m.Index;
CodeBox.SelectionLength = m.Length;
CodeBox.SelectionColor = Color.FromArgb(197,134,192);
}

foreach (Match m in typeMatches)
{
CodeBox.SelectionStart = m.Index;
CodeBox.SelectionLength = m.Length;
CodeBox.SelectionColor = Color.FromArgb(78, 201, 176);
}

foreach (Match m in commentMatches)
{
CodeBox.SelectionStart = m.Index;
CodeBox.SelectionLength = m.Length;
CodeBox.SelectionColor = Color.Green;
}

foreach (Match m in stringMatches)
{
CodeBox.SelectionStart = m.Index;
CodeBox.SelectionLength = m.Length;
CodeBox.SelectionColor = Color.FromArgb(206,145,120);
}

// restoring the original colors, for further writing
CodeBox.SelectionStart = originalIndex;
CodeBox.SelectionLength = originalLength;
CodeBox.SelectionColor = originalColor;

// giving back the focus
CodeBox.Focus();
}
}
}
Loading

0 comments on commit 8fff192

Please sign in to comment.