|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace CESAR1
{
public partial class Opcionet1 : Form
{
public Opcionet1()
{
InitializeComponent();
}
Enkripto_Dekripto objEnkDek = new Enkripto_Dekripto();
public void btnZhvendos_Click()
{
if (txtAlfabeti.Text.Length != 0)
{
txtAlfCesari.Clear();
int Total = txtAlfabeti.Text.Length;
char[] c;
int p;
int Celesi = Convert.ToInt16(txtCelesiOpcionet.Text);
c = txtAlfabeti.Text.ToCharArray(0, Total);
for (int i = 0; i < Total; i++)
{
if (c[i] > 64 && c[i] < 91)
{
objEnkDek.k = objEnkDek.k + 1;
p = (char)c[i];
p = p - 65;
if ((Celesi >= 0) && (Celesi <= 26))
{
objEnkDek.CelesiMemorik = Celesi;
p = p + Celesi;
p = p % 26;
p = p + 65;
c[i] = (char)p;
}
else
{
MessageBox.Show("Celesi duhet te jete numer pozitiv mbrenda 0-26");
txtCelesiOpcionet.Text = "0";
Celesi = 0;
}
}
else if (c[i] > 96 && c[i] < 123)
{
objEnkDek.k = objEnkDek.k + 1;
p = (char)c[i];
p = p - 97;
if ((Celesi >= 0) && (Celesi <= 26))
{
p = p + Celesi;
p = p % 26;
p = p + 97;
c[i] = (char)p;
}
else
{
MessageBox.Show("Celesi duhet te jete numer pozitiv mbrenda 0-26");
txtCelesiOpcionet.Text = "0";
Celesi = 0;
}
}
txtAlfCesari.AppendText(c[i].ToString());
}
}
else
{
MessageBox.Show("Ju lutem Mbushni Text per te Enkriptuar");
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.