chore: added basic app layout + logic outlines

This commit is contained in:
citizen-VM 2020-08-21 03:35:56 +02:00
parent cedc73ed00
commit 4d9260c7f0
Signed by: wanderer
GPG Key ID: 6391444A736EEE7E
3 changed files with 102 additions and 10 deletions

View File

@ -46,16 +46,16 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<Compile Include="main_form.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="main_form.Designer.cs">
<DependentUpon>main_form.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<EmbeddedResource Include="main_form.resx">
<DependentUpon>main_form.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>

12
main_form.Designer.cs generated
View File

@ -60,7 +60,7 @@
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(313, 20);
this.textBox2.TabIndex = 1;
this.textBox2.TabIndex = 100;
//
// label1
//
@ -104,14 +104,14 @@
this.textBox3.Name = "textBox3";
this.textBox3.ReadOnly = true;
this.textBox3.Size = new System.Drawing.Size(313, 20);
this.textBox3.TabIndex = 5;
this.textBox3.TabIndex = 500;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(12, 281);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(313, 20);
this.textBox4.TabIndex = 7;
this.textBox4.TabIndex = 2;
//
// label4
//
@ -178,18 +178,20 @@
this.button1.Location = new System.Drawing.Point(12, 307);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 15;
this.button1.TabIndex = 3;
this.button1.Text = "encrypt";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(12, 210);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 16;
this.button2.TabIndex = 1;
this.button2.Text = "check key";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// main_form
//

View File

@ -5,6 +5,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -16,5 +17,94 @@ namespace KRY_0x01_ng
{
InitializeComponent();
}
char[,] arrayTable = new char[5, 5];
char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVXYZ".ToCharArray(); // no W
char[] nualphabet = new char[25];
public string prune_input(TextBox tb)
{
string str = tb.Text.ToUpper();
string alpha_str = Regex.Replace(str, " ", "MEZERABRO");
alpha_str = alpha_str.Replace("[^A-Z]+", "");
return alpha_str.Replace("W", "V");
}
public string restore_order(string str)
{
string alpha_str = Regex.Replace(str, "MEZERABRO", " ");
return alpha_str;
}
public string pad(string str)
{
string padded_str = "";
if (str.Length > 0)
{
int i = 0;
while (i < str.Length)
{
char first_char = str[i];
i++;
char second_char;
if ((i == str.Length || str[i] == first_char) && (first_char != 'X'))
{
second_char = 'X';
}
else if ((i == str.Length || str[i] == first_char) && (first_char != 'Q'))
{
second_char = 'Q';
}
else if ((i == str.Length || str[i] == first_char) && (first_char != 'W'))
{
second_char = 'W';
}
else
{
second_char = str[i];
i++;
}
padded_str += first_char;
padded_str += second_char;
}
}
return padded_str;
}
void check_key()
{
return;
}
void check_message(TextBox tb_m)
{
string msg = pad(tb_m.Text);
return;
}
void encrypt()
{
string cryptmessage = "";
string m_text = prune_input(textBox4);
return;
}
private void button1_Click(object sender, EventArgs e)
{
/* encrypt button */
check_message(textBox4);
encrypt();
}
private void button2_Click(object sender, EventArgs e)
{
/* check key button */
check_key();
}
}
}