コード例 #1
0
        public void RemoveAutoKey(AutoKey autoKey)
        {
            AutoKeyHandler handler = AutoKeyHandlers.First(x => x.AutoKey == autoKey);

            handler.Stop();
            AutoKeyHandlers.Remove(handler);
        }
コード例 #2
0
ファイル: EntityKey.cs プロジェクト: tomtangrx/wilsonormapper
        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);
        }
コード例 #3
0
        private void RemoveAutoKey(AutoKey autoKey)
        {
            AutoKeyConfiguration.AutoKeys = AutoKeyConfiguration.AutoKeys.Except(new AutoKey[] { autoKey });
            Save();

            MainWindow.RemoveAutoKey(autoKey);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: naomisame/ExpectoPatrones
        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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
ファイル: AutoHandle.cs プロジェクト: JoshDiDuca/AutoClicker
 public AutoHandle()
 {
     Actions    = new List <AutoAction>();
     tmpActions = new BindingList <AutoAction>();
     Clicker    = new AutoClicker();
     Key        = new AutoKey();
     rnd        = new Random();
 }
コード例 #7
0
ファイル: AutoKeyHandler.cs プロジェクト: NoctusRex/AutoKey74
 public AutoKeyHandler(AutoKey autoKey)
 {
     AutoKey = autoKey;
     Timer   = new Timer(autoKey.Intervall)
     {
         AutoReset = true,
         Enabled   = false
     };
     Timer.Elapsed += Elapsed;
     Simulator      = new InputSimulator();
 }
コード例 #8
0
        public void AddAutoKey(AutoKey autoKey)
        {
            AutoKeyHandler handler = new AutoKeyHandler(autoKey);

            AutoKeyHandlers.Add(handler);

            if (AutoKeysEnabled)
            {
                handler.Start();
            }
        }
コード例 #9
0
 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;
 }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        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());
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        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;
        }
コード例 #15
0
        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);
        }
コード例 #16
0
ファイル: EntityKey.cs プロジェクト: cnporras/wilsonormapper
		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;
		}
コード例 #17
0
 private void EditAutoKey(AutoKey autoKey)
 {
     AutoKeyEditModule.Edit(autoKey);
     Save();
 }
コード例 #18
0
 private void ToggleAutoKey(AutoKey autoKey)
 {
     Save();
 }