private static IntPtr MouseHookProc(int nCode, WindowsMessagesFlags wParam, LowLevelMouseHookStruct lParam) { if (nCode >= 0 && registeredMouseHooks != null) { foreach (var h in registeredMouseHooks) { Union32 union = new Union32(lParam.mouseData); bool isXButton = h.KeyOrButton.MouseButton == MouseAction.XButton1 || h.KeyOrButton.MouseButton == MouseAction.XButton2; bool isMWheel = h.KeyOrButton.MouseButton == MouseAction.MWheelUp || h.KeyOrButton.MouseButton == MouseAction.MWheelDown; if (isXButton && wParam == WindowsMessagesFlags.WM_XBUTTONUP) { if (h.TestModifiers() && (union.High == 0x0001 && h.KeyOrButton.MouseButton == MouseAction.XButton1 || union.High == 0x0002 && h.KeyOrButton.MouseButton == MouseAction.XButton2)) { HotkeyActionCallback(h); } } else if (isMWheel && wParam == WindowsMessagesFlags.WM_MOUSEWHEEL) { short delta = unchecked ((short)union.High); if (h.TestModifiers() && (delta > 0 && h.KeyOrButton.MouseButton == MouseAction.MWheelUp || delta < 0 && h.KeyOrButton.MouseButton == MouseAction.MWheelDown)) { HotkeyActionCallback(h); } } } } return(User32.CallNextHookEx(hMouseHook, nCode, wParam, lParam)); }
public static bool IsValidPNG(byte[] data, int maxWidth, int maxHeight) { if (data.Length < 24 || data.Length > 24 + maxWidth * maxHeight * 4) { return(false); } for (int index = 0; index < 8; ++index) { if ((int)data[index] != (int)ImageProcessing.signature[index]) { return(false); } } Union32 union32_1 = (Union32)null; union32_1.b4 = (__Null)(int)data[16]; union32_1.b3 = (__Null)(int)data[17]; union32_1.b2 = (__Null)(int)data[18]; union32_1.b1 = (__Null)(int)data[19]; if (union32_1.i < 1 || union32_1.i > maxWidth) { return(false); } Union32 union32_2 = (Union32)null; union32_2.b4 = (__Null)(int)data[20]; union32_2.b3 = (__Null)(int)data[21]; union32_2.b2 = (__Null)(int)data[22]; union32_2.b1 = (__Null)(int)data[23]; return(union32_2.i >= 1 && union32_2.i <= maxHeight); }
// Token: 0x06000087 RID: 135 RVA: 0x00003A80 File Offset: 0x00001C80 public override void UInt32(uint val) { Union32 u = default(Union32); u.u = val; this.Write32(u); }
public static Color32 EncodeInt(int i) { Union32 u = new Union32(); u.i = i; return(new Color32(u.b1, u.b2, u.b3, u.b4)); }
public static Color32 EncodeFloat(float f) { Union32 u = new Union32(); u.f = f; return(new Color32(u.b1, u.b2, u.b3, u.b4)); }
public Int32Param(int intdata) { _union = new Union32() { intdata = intdata }; }
// Token: 0x0600008E RID: 142 RVA: 0x00003B6C File Offset: 0x00001D6C public override void Float(float val) { Union32 u = default(Union32); u.f = val; this.Write32(u); }
private IntPtr MouseHookProc(int nCode, WindowsMessagesFlags wParam, LowLevelMouseHookStruct lParam) { if (nCode >= 0) { foreach (IMouseHookHotkey h in this.registeredHotkeys) { var union = new Union32(lParam.mouseData); bool isXButton = h.MouseButton == MouseAction.XButton1 || h.MouseButton == MouseAction.XButton2; bool isMWheel = h.MouseButton == MouseAction.MWheelUp || h.MouseButton == MouseAction.MWheelDown; if (isXButton && wParam == WindowsMessagesFlags.WM_XBUTTONUP) { if (h.AreModifiersPressed() && (union.High == 0x0001 && h.MouseButton == MouseAction.XButton1 || union.High == 0x0002 && h.MouseButton == MouseAction.XButton2)) { this.Visit(h); } } else if (isMWheel && wParam == WindowsMessagesFlags.WM_MOUSEWHEEL) { short delta = unchecked ((short)union.High); if (h.AreModifiersPressed() && (delta > 0 && h.MouseButton == MouseAction.MWheelUp || delta < 0 && h.MouseButton == MouseAction.MWheelDown)) { this.Visit(h); } } } } return(User32.CallNextHookEx(this.hMouseHook, nCode, wParam, lParam)); }
public Float32Param(float floatdata) { _union = new Union32() { floatdata = floatdata }; }
public static byte Float2Byte(float f) { Union32 u = new Union32(); u.f = f; u.b1 = 0; return((byte)(u.f * float2byte + 0.5f)); }
public static short Float2Short(float f) { Union32 u = new Union32(); u.f = f; u.b1 = 0; return((short)(u.f * float2short + 0.5f)); }
public static Color32 EncodeInt(int i) { Union32 union32 = new Union32() { i = i }; return(new Color32(union32.b1, union32.b2, union32.b3, union32.b4)); }
public static Color32 EncodeFloat(float f) { Union32 union32 = new Union32() { f = f }; return(new Color32(union32.b1, union32.b2, union32.b3, union32.b4)); }
public BlobParam(byte[] bytedata, int offset, int length) { _bytedata = bytedata; _offset = offset; _length = new Union32() { intdata = length }; }
private IntPtr MouseHookProc(int nCode, WindowsMessagesFlags wParam, LowLevelMouseHookStruct lParam) { if (nCode >= 0) { if (this.TxtSingleKey.IsFocused) { if (wParam == WindowsMessagesFlags.WM_XBUTTONUP) { Union32 union = new Union32(lParam.mouseData); if (union.High == 0x0001) { this.TxtSingleKey.Text = MouseAction.XButton1.ToString(); if (this.LstHotKeys.SelectedItem is Hotkey hotkey) { hotkey.KeyOrButton = MouseAction.XButton1; } } else if (union.High == 0x0002) { this.TxtSingleKey.Text = MouseAction.XButton2.ToString(); if (this.LstHotKeys.SelectedItem is Hotkey hotkey) { hotkey.KeyOrButton = MouseAction.XButton2; } } } else if (wParam == WindowsMessagesFlags.WM_MOUSEWHEEL) { Union32 union = new Union32(lParam.mouseData); short delta = unchecked ((short)union.High); if (delta > 0) { // MWheelUp this.TxtSingleKey.Text = MouseAction.MWheelUp.ToString(); if (this.LstHotKeys.SelectedItem is Hotkey hotkey) { hotkey.KeyOrButton = MouseAction.MWheelUp; } } else if (delta < 0) { // MWheelDown this.TxtSingleKey.Text = MouseAction.MWheelDown.ToString(); if (this.LstHotKeys.SelectedItem is Hotkey hotkey) { hotkey.KeyOrButton = MouseAction.MWheelDown; } } } } } return(User32.CallNextHookEx(this.hHook, nCode, wParam, lParam)); }
public static byte Float2Byte(float f) { Union32 union32 = new Union32() { f = f, b1 = 0 }; return((byte)(union32.f * 255f + 0.5f)); }
public void Add(uint u) { var v = new Union32(); v.u = u; values.Add(v.b1); values.Add(v.b2); values.Add(v.b3); values.Add(v.b4); }
public void Add(int i) { var v = new Union32(); v.i = i; values.Add(v.b1); values.Add(v.b2); values.Add(v.b3); values.Add(v.b4); }
public void Add(float f) { var v = new Union32(); v.f = f; values.Add(v.b1); values.Add(v.b2); values.Add(v.b3); values.Add(v.b4); }
public static float DecodeFloat(Color32 c) { Union32 u = new Union32(); u.b1 = c.r; u.b2 = c.g; u.b3 = c.b; u.b4 = c.a; return(u.f); }
public static short Float2Short(float f) { Union32 union32 = new Union32() { f = f, b1 = 0 }; return((short)(union32.f * 32766f + 0.5f)); }
private void Write32(Union32 u) { long writeOffset = this.GetWriteOffset((long)4); byte[] writeBuffer = this.GetWriteBuffer(); writeBuffer[checked ((IntPtr)writeOffset)] = u.b1; writeBuffer[checked ((IntPtr)(writeOffset + (long)1))] = u.b2; writeBuffer[checked ((IntPtr)(writeOffset + (long)2))] = u.b3; writeBuffer[checked ((IntPtr)(writeOffset + (long)3))] = u.b4; }
public static int DecodeInt(Color32 c) { Union32 u = new Union32(); u.b1 = c.r; u.b2 = c.g; u.b3 = c.b; u.b4 = c.a; return(u.i); }
public TimeParam(int seconds, int frac) { _seconds = new Union32() { intdata = seconds }; _frac = new Union32() { intdata = frac }; }
private void Check(uint u, int i) { var union = new Union32 { A = i }; if (union.B != u) { throw new NotImplementedException(); } }
public void Add(uint u) { Union32 union32 = new Union32() { u = u }; this.values.Add(union32.b1); this.values.Add(union32.b2); this.values.Add(union32.b3); this.values.Add(union32.b4); }
public static int DecodeInt(Color32 c) { Union32 union32 = new Union32() { b1 = c.r, b2 = c.g, b3 = c.b, b4 = c.a }; return(union32.i); }
public void Add(float f) { Union32 union32 = new Union32() { f = f }; this.values.Add(union32.b1); this.values.Add(union32.b2); this.values.Add(union32.b3); this.values.Add(union32.b4); }
public void Add(int i) { Union32 union32 = new Union32() { i = i }; this.values.Add(union32.b1); this.values.Add(union32.b2); this.values.Add(union32.b3); this.values.Add(union32.b4); }
public static float DecodeFloat(Color32 c) { Union32 union32 = new Union32() { b1 = c.r, b2 = c.g, b3 = c.b, b4 = c.a }; return(union32.f); }
public static byte[] Encode(int type, byte[] data) { var length = 8 + data.Length; var packet = new byte[length]; var uniLength = new Union32() { intdata = length }; var uniType = new Union32() { intdata = type }; uniLength.ToBytes(packet, 0); uniType.ToBytes(packet, 4); Array.Copy(data, 0, packet, 8, data.Length); return packet; }
public void Request(Packet packet) { var type = new Union32(){ intdata = (int) packet.type }; var typeBytes = new byte[4]; type.ToBytes(typeBytes, 0); _stream.Write(typeBytes, 0, typeBytes.Length); _stream.Write(packet.payload, 0, packet.payload.Length); _stream.Flush(); }
public BlobParam(byte[] bytedata, int offset, int length) { _bytedata = bytedata; _offset = offset; _length = new Union32 (){ intdata = length }; }
public Float32Param(float floatdata) { _union = new Union32 (){ floatdata = floatdata }; }
public Int32Param(int intdata) { _union = new Union32 (){ intdata = intdata }; }
public TimeParam(int seconds, int frac) { _seconds = new Union32 (){ intdata = seconds }; _frac = new Union32 (){ intdata = frac }; }