private void onHotKeyTriggered(object sender, HotkeyEventArgs e) { _MethodInfo m_miAutoType = host.MainWindow.GetType().GetMethod("ExecuteGlobalAutoType", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, new Type[] { typeof(string) }, null); if (m_miAutoType != null) { m_miAutoType.Invoke(this.host.MainWindow, new object[] { KeeOtp2Config.HotKeySequence }); } }
/// <summary> Draws the parameters of the passed object into the screen </summary> public void drawDebug(object obj, int x, int y) { Type type = obj.GetType(); object classInstance = Activator.CreateInstance(type, null); _MethodInfo methodInfo = type.GetMethod("getAttr"); object[] parametersArray = new object[] { obj }; object result = methodInfo.Invoke(classInstance, parametersArray); Console.SetCursorPosition(x, y); Console.Write(type.Name + (string)result); }
private static void InvalidateOutAndError() { var type = typeof(Console); _FieldInfo output = type.GetField("_out", BindingFlags.Static | BindingFlags.NonPublic); _FieldInfo error = type.GetField("_error", BindingFlags.Static | BindingFlags.NonPublic); _MethodInfo initializeStdOutError = type.GetMethod("InitializeStdOutError", BindingFlags.Static | BindingFlags.NonPublic); Debug.Assert(output != null); Debug.Assert(error != null); Debug.Assert(initializeStdOutError != null); output.SetValue(null, null); error.SetValue(null, null); initializeStdOutError.Invoke(null, new object[] { true }); }