public void RemoveAutoKey(AutoKey autoKey) { AutoKeyHandler handler = AutoKeyHandlers.First(x => x.AutoKey == autoKey); handler.Stop(); AutoKeyHandlers.Remove(handler); }
private static object GetAutoKey(object keyValue, string typeName) { if (keyValue is Guid) { return(Guid.NewGuid()); } AutoKey keyAssigner = EntityKey.keys[typeName] as AutoKey; if (keyAssigner == null) { lock (EntityKey.keys) { keyAssigner = EntityKey.keys[typeName] as AutoKey; if (keyAssigner == null) { // could be type specific here... keyAssigner = new AutoKey(); EntityKey.keys[typeName] = keyAssigner; } } } object nextKey = keyAssigner.Next(); // locked during the Next call only... // Includes Additional Auto Types by Gerrod Thomas (http://www.Gerrod.com) if (!(keyValue is int)) { nextKey = QueryHelper.ChangeType(nextKey, keyValue.GetType()); } return(nextKey); }
private void RemoveAutoKey(AutoKey autoKey) { AutoKeyConfiguration.AutoKeys = AutoKeyConfiguration.AutoKeys.Except(new AutoKey[] { autoKey }); Save(); MainWindow.RemoveAutoKey(autoKey); }
static void Main(string[] args) { ROT13 concreteImplementation = new ROT13(); AutoKey autokey = new AutoKey("CIFRADO"); ADFGX asdfghjkl = new ADFGX("CARGO"); autokey.SetEncryptor(concreteImplementation); asdfghjkl.SetEncryptor(autokey); string ciphertext = asdfghjkl.Cifrar("Hola"); Console.WriteLine(ciphertext); string decryptedText = asdfghjkl.Descifrar(ciphertext); Console.WriteLine(decryptedText); Console.Read(); //AutoKey autokey = new AutoKey("CIFRADO"); //string ciphertext = autokey.Cifrar("hola"); //Console.Write(ciphertext); //string decryptedText = autokey.Descifrar(ciphertext); //Console.WriteLine(decryptedText); //Console.Read(); //ADFGX asdfghjkl = new ADFGX("CARGO"); //Console.WriteLine("Cifrandon Mensaje"); //var cifrado = asdfghjkl.Cifrar("attack at once"); //Console.WriteLine(cifrado); //Console.WriteLine("Descifrando Mensaje"); //var descifrado = asdfghjkl.Descifrar(cifrado); //Console.WriteLine(descifrado); //Console.ReadLine(); }
public void Edit(AutoKey autoKey) { LabelTitle.Content = "Edit"; Initialize(); MainWindow.ChangeTo <AutoKeyEditControl>(); ApplicationTimer.Start(); ContextMenuModul.Expanded = false; ContextMenuModul.IsEnabled = false; IsOpen = true; AutoKey = autoKey; TextBoxApplication.Text = AutoKey?.Application; TextBoxDuration.Text = AutoKey?.Duration.ToString(); TextBoxIntervall.Text = AutoKey?.Intervall.ToString(); CheckBoxEnabled.IsChecked = AutoKey?.Enabled; ComboBoxKeyMode.SelectedItem = AutoKey?.KeyMode; ComboBoxKeys.SelectedItem = VirtualKeyCode.NONAME; foreach (VirtualKeyCode key in AutoKey.Keys) { AddKeyButton(key); } while (IsOpen) { DoEvents(); } ContextMenuModul.IsEnabled = true; MainWindow.ChangeTo <AutoKeysControl>(); ResetForm(); }
public AutoHandle() { Actions = new List <AutoAction>(); tmpActions = new BindingList <AutoAction>(); Clicker = new AutoClicker(); Key = new AutoKey(); rnd = new Random(); }
public AutoKeyHandler(AutoKey autoKey) { AutoKey = autoKey; Timer = new Timer(autoKey.Intervall) { AutoReset = true, Enabled = false }; Timer.Elapsed += Elapsed; Simulator = new InputSimulator(); }
public void AddAutoKey(AutoKey autoKey) { AutoKeyHandler handler = new AutoKeyHandler(autoKey); AutoKeyHandlers.Add(handler); if (AutoKeysEnabled) { handler.Start(); } }
public AutoKeyDisplayControl(AutoKey autoKey, Action <AutoKey> editAutoKey, Action <AutoKey> removeAutoKey, Action <AutoKey> toggleAutoKey) { InitializeComponent(); EditAutoKey = editAutoKey; RemoveAutoKey = removeAutoKey; ToggleAutoKey = toggleAutoKey; AutoKey = autoKey; LabelInfo.Content = AutoKey.ToString(); ButtonEdit.IsEnabled = !AutoKey.Enabled; ButtonDelete.IsEnabled = !AutoKey.Enabled; CheckBoxEnabled.IsChecked = AutoKey.Enabled; }
public void AutoKey_EncryptTest() { //Arrange IEncryptionAlgorithm target = new AutoKey("deceptive"); string plain = "wearediscoveredsaveyourself"; string cypher = "zicvtwqngkzeiigasxstslvvwla"; //Act string actual = target.Encrypt(plain); //Assert Assert.Equal(cypher, actual); }
public void AutoKey_DecryptTest() { //Arrange SecurityAlgorithm target = new AutoKey("deceptivewearediscoveredsav"); string plain = "wearediscoveredsaveyourself"; string cypher = "zicvtwqngkzeiigasxstslvvwla"; //Act string actual = target.Decrypt(cypher); //Assert Assert.AreEqual(plain, actual); }
public IActionResult Index() { NhanVien nhanVien = new NhanVien() { NhanVienId = AutoKey.InCreasedByOne("nv00009"), HoNhanVien = "Lê", TenNhanVien = "Tèo", PhongBanId = "pb00001", ChucVuId = "chucvu1", AccountId = "nv00000" }; ViewBag.error = _nhanVien.Add(nhanVien); return(View()); }
private void AddAutoKey() { AutoKey autoKey = AutoKeyEditModule.Add(); if (autoKey is null) { return; } if (AutoKeyConfiguration.AutoKeys is null) { AutoKeyConfiguration.AutoKeys = new AutoKey[] { } } ; AutoKeyConfiguration.AutoKeys = AutoKeyConfiguration.AutoKeys.Append(autoKey); Save(); MainWindow.AddAutoKey(autoKey); }
private void ButtonSave_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TextBoxIntervall.Text)) { return; } if (StackPanelKey.Children.Count <= 0) { return; } List <VirtualKeyCode> keys = new List <VirtualKeyCode>(); if (AutoKey is null) { AutoKey = new AutoKey() { Application = TextBoxApplication.Text, Duration = string.IsNullOrEmpty(TextBoxDuration.Text) ? 0 : int.Parse(TextBoxDuration.Text), Intervall = int.Parse(TextBoxIntervall.Text), Enabled = (bool)CheckBoxEnabled.IsChecked, KeyMode = (KeyModes)ComboBoxKeyMode.SelectedItem, }; } else { AutoKey.Application = TextBoxApplication.Text; AutoKey.Duration = string.IsNullOrEmpty(TextBoxDuration.Text) ? 0 : int.Parse(TextBoxDuration.Text); AutoKey.Intervall = int.Parse(TextBoxIntervall.Text); AutoKey.Enabled = (bool)CheckBoxEnabled.IsChecked; AutoKey.KeyMode = (KeyModes)ComboBoxKeyMode.SelectedItem; } foreach (Button button in StackPanelKey.Children) { keys.Add((VirtualKeyCode)Enum.Parse(typeof(VirtualKeyCode), button.Content.ToString())); } AutoKey.Keys = keys; IsOpen = false; }
public AutoKey Add() { AutoKey = null; LabelTitle.Content = "Add"; Initialize(); MainWindow.ChangeTo <AutoKeyEditControl>(); ApplicationTimer.Start(); ContextMenuModul.Expanded = false; ContextMenuModul.IsEnabled = false; IsOpen = true; while (IsOpen) { DoEvents(); } ContextMenuModul.IsEnabled = true; MainWindow.ChangeTo <AutoKeysControl>(); ResetForm(); return(AutoKey); }
private static object GetAutoKey(object keyValue, string typeName) { if (keyValue is Guid) { return Guid.NewGuid(); } AutoKey keyAssigner = EntityKey.keys[typeName] as AutoKey; if (keyAssigner == null) { lock(EntityKey.keys) { keyAssigner = EntityKey.keys[typeName] as AutoKey; if (keyAssigner == null) { // could be type specific here... keyAssigner = new AutoKey(); EntityKey.keys[typeName] = keyAssigner; } } } object nextKey = keyAssigner.Next(); // locked during the Next call only... // Includes Additional Auto Types by Gerrod Thomas (http://www.Gerrod.com) if (!(keyValue is int)) { nextKey = QueryHelper.ChangeType(nextKey, keyValue.GetType()); } return nextKey; }
private void EditAutoKey(AutoKey autoKey) { AutoKeyEditModule.Edit(autoKey); Save(); }
private void ToggleAutoKey(AutoKey autoKey) { Save(); }