|
@@ -21,11 +21,65 @@ namespace Encrypter
|
|
|
public partial class MainWindow : Window
|
|
|
{
|
|
|
Encoding ascii = Encoding.ASCII;
|
|
|
+ Encoding unicode = Encoding.Unicode;
|
|
|
+
|
|
|
+
|
|
|
public MainWindow()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
}
|
|
|
+ private void sposob1_encrypt(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+ Dictionary<char, int> dictionarys = sposob1_input.Text.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
|
|
|
+ int uniqueSymbCount = dictionarys.Count();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ char[] symb = dictionarys.Select(q => q.Key).ToArray();
|
|
|
+
|
|
|
+ char[] newSymb = new char[uniqueSymbCount];
|
|
|
+
|
|
|
+ //foreach (KeyValuePair<char, int> keyValuePair in dictionarys)
|
|
|
+ //{
|
|
|
+ // //keyValuePair.Value;
|
|
|
+ // MessageBox.Show($"{keyValuePair.Key} : {keyValuePair.Value}");
|
|
|
+ //}
|
|
|
+ byte startSymb = 100;
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < newSymb.Length; i++)
|
|
|
+ {
|
|
|
+ newSymb[i] = Encoding.Unicode.GetChars(startSymb);
|
|
|
+ startSymb++;
|
|
|
+ MessageBox.Show(newSymb[i].ToString());
|
|
|
+ }
|
|
|
|
|
|
+ //foreach (char c in sposob1_input.Text)
|
|
|
+ //{
|
|
|
+ // for(int i = 0;i<)
|
|
|
+ //}
|
|
|
+
|
|
|
+ //foreach (char c in symb)
|
|
|
+ // MessageBox.Show(c.ToString());
|
|
|
+ }
|
|
|
+ private void sposob1_decrypt(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ private void sposob2_encrypt(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ private void sposob2_decrypt(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
private void sposob3_encrypt(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
string input = sposob3_input.Text, output = "";
|
|
@@ -39,16 +93,14 @@ namespace Encrypter
|
|
|
string input = sposob3_input2.Text;
|
|
|
int count = input.Count(c => c == '%');
|
|
|
string output = "";
|
|
|
- while(input.IndexOf($"%{count}^?") != -1)
|
|
|
+ while (input.IndexOf($"%{count}^?") != -1)
|
|
|
{
|
|
|
byte temp = Convert.ToByte(Convert.ToInt32(input.Substring(0, input.IndexOf($"%{count}^?"))) - count);
|
|
|
output += Convert.ToChar(temp);
|
|
|
- MessageBox.Show("output = " + output);
|
|
|
- input = input.Remove(0, output.Length+4);
|
|
|
- MessageBox.Show("input = " + input);
|
|
|
- }
|
|
|
+ input = input.Remove(0, input.IndexOf($"%{count}^?") + 3 + count.ToString().Length);
|
|
|
+ }
|
|
|
sposob3_output2.Text = output;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|