public static void KillCurrent() { var current = LowLevel.GetForegroundWindow(); UInt32 WM_CLOSE = 0x0010; IntPtr _zero = IntPtr.Zero; IntPtr success = LowLevel.SendMessage(current, WM_CLOSE, _zero, _zero); }
public static void PopThis(System.Windows.Window window) { var handle = new System.Windows.Interop.WindowInteropHelper(window).Handle; LowLevel.ShowWindow(handle, 9); LowLevel.SetForegroundWindow(handle); }
public byte[] ReadCompressedRangeAndReboot() { byte[] val = LowLevel.Comm( Adress, 0x41); return(val); }
public byte[] ReadСompressedRange() { byte[] val = LowLevel.Comm( Adress, 0x42); return(val); }
public byte[] Seventh() { byte[] val = LowLevel.Comm( Adress, 0x7); return(val); }
/// <summary> /// send a mouse event on the current cursor position /// </summary> /// <param name="flags">the event flags</param> static void SendMouseEvent(LowLevel.MouseEventFlags flags) { // get cursor position for event LowLevel.GetCursorPos(out LowLevel.MousePoint pos); // send event LowLevel.SendMouseEvent((int)flags, pos.X, pos.Y, 0, 0); }
/// <summary> /// Force the foreground window to repaint /// </summary> public static void ForceRepaintForegroundWindow() { // get foreground process pointer IntPtr hWndForeground = LowLevel.GetForegroundWindow(); // force the repaint LowLevel.SendMessage(hWndForeground, LowLevel.WmPaint, 0, 0); }
/// <summary> /// Register a low level keyboard hook /// </summary> /// <param name="callback">the callback function to register for the hook</param> /// <returns>the handle of the registered hook</returns> IntPtr RegisterHook(LowLevel.LowLevelKeyboardProc callback) { using (Process proc = Process.GetCurrentProcess()) using (ProcessModule procModule = proc.MainModule) { IntPtr modHandle = LowLevel.GetModuleHandle(procModule.ModuleName); return(LowLevel.SetWindowsHookEx(LowLevel.Constantss.WH_KEYBOARD_LL, callback, modHandle, 0)); } }
public byte[] Third(ushort s1, ushort s2) { byte[] val = LowLevel.Comm( Adress, 0x3, s1, s2); return(val); }
public ColladaBoneMatrix(string name, LowLevel.Math.real_point3d translation, LowLevel.Math.real_quaternion rotation, float scale) { Name = name; translationVector = new SlimDX.Vector3(translation.X, translation.Y, translation.Z); rotationQuaternion = new SlimDX.Quaternion(rotation.Vector.I, rotation.Vector.J, rotation.Vector.K, rotation.W); scaleAmount = scale; }
/// <summary> /// Saves the workbook with the defined name asynchronous. /// </summary> /// <param name="fileName">filename of the saved workbook</param> /// <returns>Task object (void)</returns> /// <exception cref="IOException">May throw an IOException in case of an error. The asynchronous operation may hide the exception.</exception> /// <exception cref="RangeException">May throw a RangeException if the start or end address of a handled cell range was out of range. The asynchronous operation may hide the exception.</exception> /// <exception cref="FormatException">May throw a FormatException if a handled date cannot be translated to (Excel internal) OADate. The asynchronous operation may hide the exception.</exception> /// <exception cref="StyleException">May throw a StyleException if one of the styles of the workbook cannot be referenced or is null. The asynchronous operation may hide the exception.</exception> public async Task SaveAsAsync(string fileName) { string backup = fileName; filename = fileName; LowLevel l = new LowLevel(this); await l.SaveAsync(); filename = backup; }
public PhysFSStream OpenWrite(string file) { var handle = LowLevel.OpenWrite(file, this); if (handle == IntPtr.Zero) { throw new PhysFSException(this); } return(new PhysFSStream(this, handle, false)); }
public byte[] Sixth(ushort s1, ushort s2) { byte[] val = LowLevel.Comm( Adress, 0x6, s1, s2); return(val); }
/// <summary> /// Saves the workbook with the defined name /// </summary> /// <param name="filename">filename of the saved workbook</param> /// <exception cref="IOException">Throws IOException in case of an error</exception> /// <exception cref="RangeException">Throws an RangeException if the start or end address of a handled cell range was out of range</exception> /// <exception cref="FormatException">Throws a FormatException if a handled date cannot be translated to (Excel internal) OADate</exception> /// <exception cref="StyleException">Throws an StyleException if one of the styles of the workbook cannot be referenced or is null</exception> public void SaveAs(string filename) { string backup = filename; this.filename = filename; LowLevel l = new LowLevel(this); l.Save(); this.filename = backup; }
public byte[] Second(ushort s1, ushort s2) { byte[] val = LowLevel.Comm( Adress, 0x2, s1, s2); return(val); }
public byte[] Eighth(ushort s2, byte b3, byte b4) { byte[] val = LowLevel.Comm( Adress, 0x8, s2, b3, b4); return(val); }
/// <summary> /// get the process that is the current foreground window /// </summary> /// <returns>the process of the foreground window</returns> public static Process GetForegroundProcess() { // get foreground process pointer IntPtr hWndForeground = LowLevel.GetForegroundWindow(); // get PID for that pointer LowLevel.GetWindowThreadProcessId(hWndForeground, out uint fgPid); // get process by pid return(Process.GetProcessById((int)fgPid)); }
public byte[] Eightteenth(byte b2, ushort s2, ushort s4) { byte[] val = LowLevel.Comm( Adress, 0x12, b2, s2, s4); return(val); }
public static string GetResultString(LowLevel.HResult r) { switch (r) { case LowLevel.HResult.Success: return "No Error"; case LowLevel.HResult.Abort: return "Invalid Module Data"; case LowLevel.HResult.Fail: return "Invalid Input(s)"; default: return "Unexpected Error: " + r.ToString(); } }
public byte[] Nineth(byte b2, ushort s2, ushort s4, ushort s6) { byte[] val = LowLevel.Comm( Adress, 0x9, b2, s2, s4, s6); return(val); }
public byte[] Sixteenth(byte b2, ushort s2, ushort s4, ushort s6, ushort s8) { byte[] val = LowLevel.Comm( Adress, 0x10, b2, s2, s4, s6, s8); return(val); }
internal TResponse DoRequest <TRequest, TResponse>(TRequest p, IRequestParameters parameters, Action <IRequestConfiguration> forceConfiguration = null) where TRequest : class, IRequest where TResponse : class, IElasticsearchResponse, new() { if (forceConfiguration != null) { ForceConfiguration(p, forceConfiguration); } var url = p.GetUrl(ConnectionSettings); var b = (p.HttpMethod == HttpMethod.GET || p.HttpMethod == HttpMethod.HEAD) ? null : new SerializableData <TRequest>(p); return(LowLevel.DoRequest <TResponse>(p.HttpMethod, url, b, parameters)); }
public byte[] Nineteenth(byte b2, ushort s2, ushort s4, byte b5, byte b6, byte b7, byte b8) { byte[] val = LowLevel.Comm( Adress, 0x13, b2, s2, s4, b5, b6, b7, b8); return(val); }
public byte[] Tenth(byte b2, ushort s2, ushort s4, ushort s6, byte b7, byte b8, byte b9, byte b10, byte b11, byte b12) { byte[] val = LowLevel.Comm( Adress, 0xA, b2, s2, s4, s6, b7, b8, b9, b10, b11, b12); return(val); }
/// <summary> /// Send a simulated key globally /// </summary> /// <param name="key">the keys to simulate. supports bitwise- or-ing for Keys.SHIFT, ALT, and CTRL</param> /// <param name="keySleep">how long the key press is simulated (how long the key press lasts) (ms)</param> public void SendKey(Keys key, int keySleep = 0) { if (key.HasFlag(Keys.Control)) { LowLevel.keybd_event((byte)Keys.LControlKey, 0, 0, 0); } if (key.HasFlag(Keys.Alt)) { //LowLevel.keybd_event((byte)Keys.KeyCode, 0, 0, 0); } if (key.HasFlag(Keys.Shift)) { LowLevel.keybd_event((byte)Keys.LShiftKey, 0, 0, 0); } if (keySleep > 0) { Thread.Sleep(keySleep); } LowLevel.keybd_event((byte)key, 0, 0, 0); if (keySleep > 0) { Thread.Sleep(keySleep); } LowLevel.keybd_event((byte)key, 0, LowLevel.Constants.KEYEVENTF_KEYUP, 0); if (key.HasFlag(Keys.Shift)) { LowLevel.keybd_event((byte)Keys.LShiftKey, 0, LowLevel.Constants.KEYEVENTF_KEYUP, 0); } if (key.HasFlag(Keys.Alt)) { //LowLevel.keybd_event((byte)Keys.KeyCode, 0, LowLevel.Constants.KEYEVENTF_KEYUP, 0); } if (key.HasFlag(Keys.Control)) { LowLevel.keybd_event((byte)Keys.LControlKey, 0, LowLevel.Constants.KEYEVENTF_KEYUP, 0); } }
/// <summary> /// Convert a character into a virtual key code /// </summary> /// <param name="ch">the char to convert</param> /// <returns>the virtual keycode. may have Keys.SHIFT, ALT, and CTRL set</returns> Keys CharToVKey(char ch) { short vkey = LowLevel.VkKeyScan(ch); Keys retval = (Keys)(vkey & 0xff); int modifiers = vkey >> 8; if ((modifiers & 1) != 0) { retval |= Keys.Shift; } if ((modifiers & 2) != 0) { retval |= Keys.Control; } if ((modifiers & 4) != 0) { retval |= Keys.Alt; } return(retval); }
/// <summary> /// Low- Level Keyboard hook Callback /// </summary> IntPtr LLKeyboardCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)LowLevel.Constantss.WM_KEYDOWN) { int vkCode = Marshal.ReadInt32(lParam); //process keypress Keys vKey = (Keys)vkCode; char vChar = GetCharFromKey(vKey); //invoke event bool?cancelPress = KeyPressed?.Invoke(vKey, vChar); if (cancelPress.HasValue && cancelPress.Value) { //cancel keypress return((IntPtr)1); } } return(LowLevel.CallNextHookEx(hookPtr, nCode, wParam, lParam)); }
/// <summary> /// Get a unicode char from a key, according to current keyboard mappings /// See https://stackoverflow.com/questions/5825820/how-to-capture-the-character-on-different-locale-keyboards-in-wpf-c /// </summary> /// <param name="key">the key to convert</param> /// <returns>the converted char</returns> char GetCharFromKey(Keys key) { char ch = ' '; int virtualKey = (int)key; byte[] keyboardState = new byte[256]; LowLevel.GetKeyboardState(keyboardState); uint scanCode = LowLevel.MapVirtualKey((uint)virtualKey, LowLevel.MapType.MAPVK_VK_TO_VSC); StringBuilder stringBuilder = new StringBuilder(2); int result = LowLevel.ToUnicode((uint)virtualKey, scanCode, keyboardState, stringBuilder, stringBuilder.Capacity, 0); if (stringBuilder.Length > 0) { switch (result) { case -1: break; case 0: break; case 1: { ch = stringBuilder[0]; break; } default: { ch = stringBuilder[0]; break; } } } return(ch); }
public static string ToString(LowLevel.Math.real_quaternion values) { return string.Format("[Byte4N {0}\t{1}\t{2}\t{3}]", values.Vector.I.ToString(), values.Vector.J.ToString(), values.Vector.K.ToString(), values.W.ToString()); }
public static string ToString(LowLevel.Math.real_quaternion values) { return string.Format("[UbyteN3 {0}\t{1}\t{2}\t0]", values.Vector.I.ToString(), values.Vector.J.ToString(), values.Vector.K.ToString()/*, values.W.ToString()*/); }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Xna.Math.ConvertByte4N(values, out Value); }
public void WriteVertex(LowLevel.Math.real_quaternion v){ WriteVertex(v.Vector.I, v.Vector.J, v.Vector.K); }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = LowLevel.Xna.Math.ConvertUShort4N(X, Y, Z, W); }
/// <summary> /// <see cref="LowLevel.Math.real_vector3d.I"/> = R, /// <see cref="LowLevel.Math.real_vector3d.J"/> = G, /// <see cref="LowLevel.Math.real_vector3d.K"/> = B, /// <see cref="LowLevel.Math.real_quaternion.W"/> = A /// </summary> /// <param name="values"></param> public void Denormalize(out LowLevel.Math.real_quaternion values) { LowLevel.Math.real_quaternion temp = LowLevel.Xna.Math.ConvertColor(Value); // I\X = B // J\Y = G // K\Z = R // W\W = A values = new LowLevel.Math.real_quaternion(); values.Vector.I = temp.Vector.K; // R values.Vector.J = temp.Vector.J; // G values.Vector.K = temp.Vector.I; // B values.W = temp.W; // A }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = new LowLevel.Math.real_quaternion(); values.Vector.I = X; }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = LowLevel.Xna.Math.ConvertDec3N(Value); //values = new LowLevel.Math.real_quaternion(); }
public void Normalize(LowLevel.Math.real_quaternion values) { X = (byte)values.Vector.I; Y = (byte)values.Vector.J; Z = (byte)values.Vector.K; }
public static string ToString(LowLevel.Math.real_quaternion values) { return string.Format("[UShort2N {0}\t{1}]", values.Vector.I.ToString(), values.Vector.J.ToString()); }
public void GetStreamedElement(int element_index, ref LowLevel.Math.real_quaternion value) { value = streamedElements[element_index]; }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = LowLevel.Xna.Math.ConvertByte4N(Value); }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Xna.Math.ConvertUShort4N(values, out X, out Y, out Z, out W); }
public static string ToString(LowLevel.Math.real_quaternion values) { return string.Format("[Skip]"); }
private void updateSBWMenu() { if (!MainForm.IsSBWAvailable) { return; } try { bool bWasConnected = LowLevel.SBWGetConnectionStatus(); if (!bWasConnected) { LowLevel.SBWConnect(); } oSBWMenu.DropDownItems.Clear(); oAnalyzers = new Hashtable(); var oBroker = new Module("BROKER"); Service oService = oBroker.getService("BROKER"); Method oMethod = oService.getMethod("{}[] findServices(string,boolean)"); ArrayList[] oList = oMethod.Call("/Analysis", true).get1DListArray(); var oModules = new SortedList(CaseInsensitiveComparer.Default); foreach (ArrayList list in oList) { try { var uniqueName = (string)list[2]; if (oModules.Contains(uniqueName)) { uniqueName += String.Format(" ({0})", list[0]); } oModules.Add(uniqueName, list); } catch (Exception) { } } foreach (DictionaryEntry entry in oModules) { var sKey = (string)entry.Key; var list = (ArrayList)entry.Value; if ("AutoCSharp" != (string)list[0]) { var uniqueName = (string)list[2]; if (oAnalyzers.Contains(uniqueName)) { uniqueName += String.Format(" ({0})", list[0]); } var oItem = new ToolStripMenuItem(uniqueName); oAnalyzers.Add(uniqueName, new SBWAnalyzer((string)list[0], (string)list[1])); oItem.Click += oItem_Click; oSBWMenu.DropDownItems.Add(oItem); } } if (!bWasConnected) { LowLevel.SBWDisconnect(); } } catch (Exception) { } }
string IDeclType.ToString(LowLevel.Math.real_quaternion values) { return ToString(values); }
/// <summary> /// move the cursor /// </summary> /// <param name="p">the point on screen to move to</param> public static void MoveTo(Point p) { bool ok = LowLevel.SetCursorPos(p.X, p.Y); Log($"MOVE {p.X} / {p.Y} OK: {ok}"); }
public void WriteNormal(LowLevel.Math.real_quaternion v){ WriteNormal(v.Vector.I, v.Vector.J, v.Vector.K); }
/// <summary> /// Saves the workbook /// </summary> /// <exception cref="IOException">Throws IOException in case of an error</exception> /// <exception cref="RangeException">Throws an RangeException if the start or end address of a handled cell range was out of range</exception> /// <exception cref="FormatException">Throws a FormatException if a handled date cannot be translated to (Excel internal) OADate</exception> /// <exception cref="StyleException">Throws an StyleException if one of the styles of the workbook cannot be referenced or is null</exception> public void Save() { LowLevel l = new LowLevel(this); l.Save(); }
/// <summary> /// Saves the workbook with the defined name /// </summary> /// <param name="filename">filename of the saved workbook</param> /// <exception cref="IOException">Throws IOException in case of an error</exception> /// <exception cref="OutOfRangeException">Throws an OutOfRangeException if the start or end address of a handled cell range was out of range</exception> /// <exception cref="FormatException">Throws a FormatException if a handled date cannot be translated to (Excel internal) OADate</exception> /// <exception cref="UndefinedStyleException">Throws an UndefinedStyleException if one of the styles of the workbook cannot be referenced or is null</exception> public void SaveAs(string filename) { string backup = this.filename; this.filename = filename; LowLevel l = new LowLevel(this); l.Save(); this.filename = backup; }
/// <summary> /// Save the workbook to a writable stream /// </summary> /// <param name="stream">Writable stream</param> /// <exception cref="IOException">Throws IOException in case of an error</exception> /// <exception cref="RangeException">Throws an RangeException if the start or end address of a handled cell range was out of range</exception> /// <exception cref="FormatException">Throws a FormatException if a handled date cannot be translated to (Excel internal) OADate</exception> /// <exception cref="StyleException">Throws an StyleException if one of the styles of the workbook cannot be referenced or is null</exception> public void SaveAsStream(Stream stream) { LowLevel l = new LowLevel(this); l.SaveAsStream(stream); }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Xna.Math.ConvertFloat16Four(values, out X, out Y, out Z, out W); }
public void WriteUv(LowLevel.Math.real_quaternion v) { WriteUv(v.Vector.I, v.Vector.J); }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = new LowLevel.Math.real_quaternion(); values.Vector.I = (float)X; values.Vector.J = (float)Y; values.Vector.K = (float)Z; }
/// <summary> /// Saves the workbook /// </summary> /// <exception cref="IOException">Throws IOException in case of an error</exception> /// <exception cref="OutOfRangeException">Throws an OutOfRangeException if the start or end address of a handled cell range was out of range</exception> /// <exception cref="FormatException">Throws a FormatException if a handled date cannot be translated to (Excel internal) OADate</exception> /// <exception cref="UndefinedStyleException">Throws an UndefinedStyleException if one of the styles of the workbook cannot be referenced or is null</exception> public void Save() { LowLevel l = new LowLevel(this); l.Save(); }
public void Normalize(LowLevel.Math.real_quaternion values) { }
public void Normalize(LowLevel.Math.real_quaternion values) { LowLevel.Math.real_quaternion temp = new LowLevel.Math.real_quaternion(); temp.W = values.W; // A temp.Vector.I = values.Vector.K; // B temp.Vector.J = values.Vector.J; // G temp.Vector.K = values.Vector.I; // R LowLevel.Xna.Math.ConvertColor(temp, out Value); }
public void Denormalize(out LowLevel.Math.real_quaternion values) { values = LowLevel.Xna.Math.ConvertFloat16Four(X, Y, Z, W); }
// TODO: Have each engine's VBI's Definition have a bit-vector which maps with a // string list with all possible Element names on that engine. Could enable faster // and more complex Element querying later on /// <summary> /// Get an element streamed from a buffer by its element name (ie, /// <see cref="kTypePosition"/>) /// </summary> /// <param name="element_type_name"></param> /// <param name="value"></param> /// <returns></returns> public bool FindStreamedElement(string element_type_name, ref LowLevel.Math.real_quaternion value) { int se_index = Array.FindIndex(elements, e => e.GetTypeBase().Name == element_type_name); if(se_index != -1) value = streamedElements[se_index]; return se_index != -1; }
public void Normalize(LowLevel.Math.real_quaternion values) { Value = (byte)values.Vector.I; }
public void Normalize(LowLevel.Math.real_quaternion values) { X = values.Vector.I; Y = values.Vector.J; Z = values.Vector.K; W = values.W; }
public static string ToString(LowLevel.Math.real_quaternion values) { return string.Format("[Float1 {0}]", values.Vector.I.ToString()); }