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

Commit 8fff192

Browse files
committed
Core files uploaded
0 parents  commit 8fff192

62 files changed

Lines changed: 32182 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/TrueRestrictive.sln

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32929.385
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrueRestrictive", "TrueRestrictive\TrueRestrictive.csproj", "{3F0A866F-2097-4875-8BB8-95ACA1B20689}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4AE61E3C-B86B-49FC-93B2-A68FF6266CBF}"
9+
ProjectSection(SolutionItems) = preProject
10+
.editorconfig = .editorconfig
11+
EndProjectSection
12+
EndProject
13+
Global
14+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
15+
Debug|Any CPU = Debug|Any CPU
16+
Release|Any CPU = Release|Any CPU
17+
EndGlobalSection
18+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
19+
{3F0A866F-2097-4875-8BB8-95ACA1B20689}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{3F0A866F-2097-4875-8BB8-95ACA1B20689}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{3F0A866F-2097-4875-8BB8-95ACA1B20689}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{3F0A866F-2097-4875-8BB8-95ACA1B20689}.Release|Any CPU.Build.0 = Release|Any CPU
23+
EndGlobalSection
24+
GlobalSection(SolutionProperties) = preSolution
25+
HideSolutionNode = FALSE
26+
EndGlobalSection
27+
GlobalSection(ExtensibilityGlobals) = postSolution
28+
SolutionGuid = {8D4681B7-124A-4844-BA2B-6D5743F301DD}
29+
EndGlobalSection
30+
EndGlobal

src/TrueRestrictive/Agesoft_Codering.Designer.cs

Lines changed: 87 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using System;
2+
using System.Drawing;
3+
using System.Text.RegularExpressions;
4+
using System.Windows.Forms;
5+
6+
namespace TrueRestrictive
7+
{
8+
public partial class Agesoft_Codering : Form
9+
{
10+
public Agesoft_Codering()
11+
{
12+
InitializeComponent();
13+
}
14+
15+
public string DocumentText = "";
16+
private void Agesoft_Codering_Load(object sender, EventArgs e)
17+
{
18+
CodeBox.Text = DocumentText;
19+
this.BringToFront();
20+
}
21+
22+
private void CodeBox_TextChanged(object sender, EventArgs e)
23+
{
24+
25+
// getting keywords/functions
26+
string keywords = @"\b(public|private|protected|partial|static|namespace|class|struct|enum|using|void|string|int|bool|float|double|short|byte|char|const)\b";
27+
MatchCollection keywordMatches = Regex.Matches(CodeBox.Text, keywords);
28+
29+
// getting conds
30+
string conds = @"\b(if|else|switch|case|foreach)\b";
31+
MatchCollection condsMatches = Regex.Matches(CodeBox.Text, conds);
32+
33+
// getting types/classes from the text
34+
string types = @"\b(Console|Regex|Agesoft|Font|Application)\b";
35+
MatchCollection typeMatches = Regex.Matches(CodeBox.Text, types);
36+
37+
// getting comments (inline or multiline)
38+
string comments = @"(\/\/.+?$|\/\*.+?\*\/)";
39+
MatchCollection commentMatches = Regex.Matches(CodeBox.Text, comments, RegexOptions.Multiline);
40+
41+
// getting strings
42+
string strings = "\".+?\"";
43+
MatchCollection stringMatches = Regex.Matches(CodeBox.Text, strings);
44+
45+
// saving the original caret position + forecolor
46+
int originalIndex = CodeBox.SelectionStart;
47+
int originalLength = CodeBox.SelectionLength;
48+
Color originalColor = Color.White;
49+
50+
// MANDATORY - focuses a label before highlighting (avoids blinking)
51+
titleLabel.Focus();
52+
53+
// removes any previous highlighting (so modified words won't remain highlighted)
54+
CodeBox.SelectionStart = 0;
55+
CodeBox.SelectionLength = CodeBox.Text.Length;
56+
CodeBox.SelectionColor = originalColor;
57+
58+
// scanning...
59+
foreach (Match m in keywordMatches)
60+
{
61+
CodeBox.SelectionStart = m.Index;
62+
CodeBox.SelectionLength = m.Length;
63+
CodeBox.SelectionColor = Color.FromArgb(86, 156, 214);
64+
}
65+
66+
foreach (Match m in condsMatches)
67+
{
68+
CodeBox.SelectionStart = m.Index;
69+
CodeBox.SelectionLength = m.Length;
70+
CodeBox.SelectionColor = Color.FromArgb(197,134,192);
71+
}
72+
73+
foreach (Match m in typeMatches)
74+
{
75+
CodeBox.SelectionStart = m.Index;
76+
CodeBox.SelectionLength = m.Length;
77+
CodeBox.SelectionColor = Color.FromArgb(78, 201, 176);
78+
}
79+
80+
foreach (Match m in commentMatches)
81+
{
82+
CodeBox.SelectionStart = m.Index;
83+
CodeBox.SelectionLength = m.Length;
84+
CodeBox.SelectionColor = Color.Green;
85+
}
86+
87+
foreach (Match m in stringMatches)
88+
{
89+
CodeBox.SelectionStart = m.Index;
90+
CodeBox.SelectionLength = m.Length;
91+
CodeBox.SelectionColor = Color.FromArgb(206,145,120);
92+
}
93+
94+
// restoring the original colors, for further writing
95+
CodeBox.SelectionStart = originalIndex;
96+
CodeBox.SelectionLength = originalLength;
97+
CodeBox.SelectionColor = originalColor;
98+
99+
// giving back the focus
100+
CodeBox.Focus();
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)