public override float Utility(HT a) { if (sPoint != null) { if ((a.pos - sPoint.pos).magnitude < a.targetProximity) { // We're close enough, so lose this sPoint sPoint = null; } } if (sPoint == null) { // Choose a random SpawnPoint of the item type sPoint = a.RandomSP(); } // Return the maximum wander utility uRec.dest = sPoint.pos; uRec.u = 1; // The last line of ALL of these needs to be return base.Utility(a) // because base.Utility(a) applies both the curve and the utilMinMax limits return(base.Utility(a)); }
private HT _HitTestNca(Rect windowPosition, Point mousePosition) { int num = 1; int num2 = 1; bool flag = false; if (mousePosition.Y >= windowPosition.Top && mousePosition.Y < windowPosition.Top + this._chromeInfo.ResizeBorderThickness.Top + this._chromeInfo.CaptionHeight) { flag = (mousePosition.Y < windowPosition.Top + this._chromeInfo.ResizeBorderThickness.Top); num = 0; } else if (mousePosition.Y < windowPosition.Bottom && mousePosition.Y >= windowPosition.Bottom - (double)((int)this._chromeInfo.ResizeBorderThickness.Bottom)) { num = 2; } if (mousePosition.X >= windowPosition.Left && mousePosition.X < windowPosition.Left + (double)((int)this._chromeInfo.ResizeBorderThickness.Left)) { num2 = 0; } else if (mousePosition.X < windowPosition.Right && mousePosition.X >= windowPosition.Right - this._chromeInfo.ResizeBorderThickness.Right) { num2 = 2; } if (num == 0 && num2 != 1 && !flag) { num = 1; } HT ht = WindowChromeWorker._HitTestBorders[num, num2]; if (ht == HT.TOP && !flag) { ht = HT.CAPTION; } return(ht); }
private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) { IntPtr zero = IntPtr.Zero; handled = false; if (Utility.IsOSVistaOrNewer) { if (this._chromeInfo.GlassFrameThickness != new Thickness() && this._isGlassEnabled) { handled = Standard.NativeMethods.DwmDefWindowProc(this._hwnd, uMsg, wParam, lParam, out zero); } } if (IntPtr.Zero == zero) { Point point = new Point((double)Utility.GET_X_LPARAM(lParam), (double)Utility.GET_Y_LPARAM(lParam)); Rect rect = this._GetWindowRect(); HT hT = this._HitTestNca(DpiHelper.DeviceRectToLogical(rect), DpiHelper.DevicePixelsToLogical(point)); if (hT != HT.CLIENT) { Point logical = point; logical.Offset(-rect.X, -rect.Y); logical = DpiHelper.DevicePixelsToLogical(logical); IInputElement inputElement = this._window.InputHitTest(logical); if (inputElement != null && WindowChrome.GetIsHitTestVisibleInChrome(inputElement)) { hT = HT.CLIENT; } } handled = true; zero = new IntPtr((int)hT); } return(zero); }
public virtual IntPtr WinMain(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { switch ((WM)msg) { case WM.MOUSEACTIVATE: { handled = true; return(new IntPtr(3)); // MA_NOACTIVATE } case WM.NCHITTEST: { if (canResize()) { Point ptScreen = NativeMethods.LPARAMTOPOINT(lParam); Point ptClient = PointFromScreen(ptScreen); Cursor = GetCursor(ptClient); } break; } case WM.LBUTTONDOWN: { POINT ptScreenWin32; NativeMethods.GetCursorPos(out ptScreenWin32); Point ptScreen = new Point(ptScreenWin32.x, ptScreenWin32.y); Point ptClient = PointFromScreen(ptScreen); HT result = GetHT(ptClient); IntPtr ownerHwnd = new WindowInteropHelper(Owner).Handle; NativeMethods.SendNotifyMessage(ownerHwnd, (int)WM.NCLBUTTONDOWN, (IntPtr)result, IntPtr.Zero); break; } } return(IntPtr.Zero); }
private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) { IntPtr intPtr = IntPtr.Zero; handled = false; if (Utility.IsOSVistaOrNewer && this._chromeInfo.GlassFrameThickness != default(Thickness) && this._isGlassEnabled) { handled = NativeMethods.DwmDefWindowProc(this._hwnd, uMsg, wParam, lParam, out intPtr); } if (IntPtr.Zero == intPtr) { Point point = new Point((double)Utility.GET_X_LPARAM(lParam), (double)Utility.GET_Y_LPARAM(lParam)); Rect deviceRectangle = this._GetWindowRect(); HT ht = this._HitTestNca(DpiHelper.DeviceRectToLogical(deviceRectangle), DpiHelper.DevicePixelsToLogical(point)); if (ht != HT.CLIENT) { Point point2 = point; point2.Offset(-deviceRectangle.X, -deviceRectangle.Y); point2 = DpiHelper.DevicePixelsToLogical(point2); IInputElement inputElement = this._window.InputHitTest(point2); if (inputElement != null && WindowChrome.GetIsHitTestVisibleInChrome(inputElement)) { ht = HT.CLIENT; } } handled = true; intPtr = new IntPtr((int)ht); } return(intPtr); }
private static void TestClearAndSet(ref HT val, HT test, HT clearMask) { if (test == (test & val)) { val &= ~clearMask; val |= test; } }
private static void Test(int distance, HT exactResult, HT fuzzyResult, ref HT hitTest) { hitTest |= distance < 0 ? 0 : distance < 5 ? exactResult : distance < 10 ? fuzzyResult : 0; }
// ハンバーガータイプ取得 public HM[] GetHumburgerInfo(HT _type) { HM[] temp; if (!m_HUM_type_info.TryGetValue(_type, out temp)) { temp = null; } return(temp); }
public static void Run() { while (true) { try { //BTC.Do(); BCH.Do(); ETH.Do(); ETC.Do(); LTC.Do(); EOS.Do(); XRP.Do(); OMG.Do(); DASH.Do(); ZEC.Do(); Thread.Sleep(1000 * 5); // 创新 ITC.Do(); NAS.Do(); RUFF.Do(); ZIL.Do(); DTA.Do(); Thread.Sleep(1000 * 5); LET.Do(); HT.Do(); THETA.Do(); HSR.Do(); QTUM.Do(); Thread.Sleep(1000 * 5); SNT.Do(); IOST.Do(); NEO.Do(); STORJ.Do(); GNT.Do(); Thread.Sleep(1000 * 5); CVC.Do(); SMT.Do(); VEN.Do(); ELF.Do(); XEM.Do(); Thread.Sleep(1000 * 5); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
// 表示するハンバーガーのタイプ public void SetAppearHumberger(HT _type, Vector2 _pos, CallFunc _first, CallFunc _func) { int number = (int)_type; int score = GameNumRetention.Instance.GetHumbergerScore(_type); transform.position = _pos; m_appear_hum_obj.sprite = m_appear_hum[(int)_type]; m_apper_score.SetScore(score); StartCoroutine(AppearScore(_first, _func)); }
private static void RemoveConflicts(ref HT hitTest) { TestClearAndSet(ref hitTest, HT.Right, HT.Mask_Horizontal); TestClearAndSet(ref hitTest, HT.Left, HT.Mask_Horizontal); TestClearAndSet(ref hitTest, HT.AlmostRight, HT.Mask_Horizontal); TestClearAndSet(ref hitTest, HT.AlmostLeft, HT.Mask_Horizontal); TestClearAndSet(ref hitTest, HT.Bottom, HT.Mask_Vertical); TestClearAndSet(ref hitTest, HT.Top, HT.Mask_Vertical); TestClearAndSet(ref hitTest, HT.AlmostBottom, HT.Mask_Vertical); TestClearAndSet(ref hitTest, HT.AlmostTop, HT.Mask_Vertical); }
public virtual float Utility(HT a) { if (!uRec.enabled) { return(0); } // If it is enabled, then curve the value uRec.u = uRec.curveFunc(uRec.u); // Also apply the min and max values to the curved u uRec.u = uRec.utilMinMax.x + (uRec.u * (uRec.utilMinMax.y - uRec.utilMinMax.x)); return(uRec.u); }
protected override IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { var message = (WM)msg; foreach (var wm in _messageDictionary.Keys) { if (wm == message) { _ht = (HT)_messageDictionary[wm](hWnd, message, wParam, lParam, out handled); } } return(NativeMethods.DefWindowProc(hWnd, message, wParam, lParam)); }
// Note: this type is marked as 'beforefieldinit'. static WindowChromeWorker() { HT[,] array = new HT[3, 3]; array[0, 0] = HT.TOPLEFT; array[0, 1] = HT.TOP; array[0, 2] = HT.TOPRIGHT; array[1, 0] = HT.LEFT; array[1, 1] = HT.CLIENT; array[1, 2] = HT.RIGHT; array[2, 0] = HT.BOTTOMLEFT; array[2, 1] = HT.BOTTOM; array[2, 2] = HT.BOTTOMRIGHT; WindowChromeWorker._HitTestBorders = array; }
/// <summary>Overrides the message processor for the window so that we can respond to windows events to render and manipulate the tabs properly.</summary> /// <param name="m">Message received by the pump.</param> protected override void WndProc(ref Message m) { bool callDwp = true; switch ((WM)m.Msg) { // When the window is activated, set the size of the non-client area appropriately case WM.WM_ACTIVATE: if ((m.WParam.ToInt64() & 0x0000FFFF) != 0) { SetFrameSize(); ResizeTabContents(); m.Result = IntPtr.Zero; } break; case WM.WM_NCHITTEST: // Call the base message handler to see where the user clicked in the window base.WndProc(ref m); HT hitResult = (HT)m.Result.ToInt32(); // If they were over the minimize/maximize/close buttons or the system menu, let the message pass if (!(hitResult == HT.HTCLOSE || hitResult == HT.HTMINBUTTON || hitResult == HT.HTMAXBUTTON || hitResult == HT.HTMENU || hitResult == HT.HTSYSMENU)) { m.Result = new IntPtr((int)HitTest(m)); } callDwp = false; break; // Catch the case where the user is clicking the minimize button and use this opportunity to update the AeroPeek thumbnail for the current tab case WM.WM_NCLBUTTONDOWN: if (((HT)m.WParam.ToInt32()) == HT.HTMINBUTTON && AeroPeekEnabled && SelectedTab != null) { UpdateTabThumbnail(SelectedTab); } break; } if (callDwp) { base.WndProc(ref m); } }
static WindowChromeWorker() { WindowChromeWorker.WindowChromeWorkerProperty = DependencyProperty.RegisterAttached("WindowChromeWorker", typeof(WindowChromeWorker), typeof(WindowChromeWorker), new PropertyMetadata(null, new PropertyChangedCallback(WindowChromeWorker._OnChromeWorkerChanged))); HT[,] hTArray = new HT[3, 3]; hTArray[0, 0] = HT.TOPLEFT; hTArray[0, 1] = HT.TOP; hTArray[0, 2] = HT.TOPRIGHT; hTArray[1, 0] = HT.LEFT; hTArray[1, 1] = HT.CLIENT; hTArray[1, 2] = HT.RIGHT; hTArray[2, 0] = HT.BOTTOMLEFT; hTArray[2, 1] = HT.BOTTOM; hTArray[2, 2] = HT.BOTTOMRIGHT; WindowChromeWorker._HitTestBorders = hTArray; }
static WindowChromeWorker() { // Note: this type is marked as 'beforefieldinit'. HT[,] array = new HT[3, 3]; array[0, 0] = HT.TOPLEFT; array[0, 1] = HT.TOP; array[0, 2] = HT.TOPRIGHT; array[1, 0] = HT.LEFT; array[1, 1] = HT.CLIENT; array[1, 2] = HT.RIGHT; array[2, 0] = HT.BOTTOMLEFT; array[2, 1] = HT.BOTTOM; array[2, 2] = HT.BOTTOMRIGHT; WindowChromeWorker._HitTestBorders = array; }
private void HealthySettingDialog_Load(object sender, EventArgs e) { List <MachineControl.Parameter> lists = ManageParameters.getAllParameters(PAR_CATEGORY.STATUS); MachineControl.Parameter par = lists.Find(x => (x.Order == Order)); if (par != null) { txtHF.Mask = txtHT.Mask = txtU.Mask = txtS.Mask = par.Format; } else { MessageBox.Show(this, "Unknown parameter selected.", "Parameter not found", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.Cancel; Close(); } lblDesc.Text = itemDescription; //MessageBox.Show(HF+Environment.NewLine+HT+Environment.NewLine+U+Environment.NewLine+S); txtHF.Text = HF.Trim(); txtHT.Text = HT.Trim(); txtS.Text = S.Trim(); txtU.Text = U.Trim(); if (UC > 0) { radUNH1.Checked = true; } if (UC < 0) { radUNH2.Checked = true; } if (UC == 0) { radUNH3.Checked = true; } if (SC > 0) { radS1.Checked = true; } if (SC < 0) { radS2.Checked = true; } if (SC == 0) { radS3.Checked = true; } }
public virtual IntPtr WinMain(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { switch ((WM)msg) { case WM.MOUSEACTIVATE: { handled = true; return(new IntPtr(3)); // MA_NOACTIVATE } case WM.NCHITTEST: { if (canResize()) { Point ptScreen = NativeMethods.LPARAMTOPOINT(lParam); Point ptClient = PointFromScreen(ptScreen); Cursor = GetCursor(ptClient); } break; } case WM.LBUTTONDOWN: { POINT ptScreenWin32; NativeMethods.GetCursorPos(out ptScreenWin32); Point ptScreen = new Point(ptScreenWin32.x, ptScreenWin32.y); Point ptClient = PointFromScreen(ptScreen); HT result = GetHT(ptClient); IntPtr ownerHwnd = new WindowInteropHelper(Owner).Handle; NativeMethods.SendNotifyMessage(ownerHwnd, (int)WM.NCLBUTTONDOWN, (IntPtr)result, IntPtr.Zero); break; } case WM.GETMINMAXINFO: { MINMAXINFO info = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO)); info.ptMaxSize = info.ptMaxTrakSize = new POINT { x = int.MaxValue, y = int.MaxValue }; Marshal.StructureToPtr(info, lParam, true); } break; } return(IntPtr.Zero); }
public EyeXWinForm(EyeTrackingEngine eyeTrackingEngine, HT.Wimu wimuDevice) { PseudoTimeStampMiliSecImu = 0; InitializeComponent(); this.eyeTrackingEngine = eyeTrackingEngine; eyeTrackingEngine.GazePoint += this.GazePoint; eyeTrackingEngine.OnGetCalibrationCompletedEvent += this.OnGetCalibrationCompleted; eyeTrackingEngine.Initialize(); _llkhk = new LowLevelKeyboardHook("Low-level Keyboard Hook"); _llkhk.OnKeyPress += new EventHandler<KeyPressEventArgs>(OnKeyboardHookPress); clickDwell = new Dwell(); this.wimuDevice = wimuDevice; this.head2deltaCursor = new Head2deltaCursor(wimuDevice); }
private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) { IntPtr lRet = IntPtr.Zero; handled = false; // Give DWM a chance at this first. if (_OnVista && UseGlassFrame) { // If we're on Vista, give the DWM a chance to handle the message first. handled = NativeMethods.DwmDefWindowProc(_hwnd, uMsg, wParam, lParam, out lRet); } // Handle letting the system know if we consider the mouse to be in our effective non-client area. // If DWM already handled this by way of DwmDefWindowProc, then respect their call. if (IntPtr.Zero == lRet) { var mousePosScreen = new Point(Utility.GET_X_LPARAM(lParam), Utility.GET_Y_LPARAM(lParam)); Rect windowPosition = _GetWindowRect(); HT ht = _HitTestNca( DpiHelper.DeviceRectToLogical(windowPosition), DpiHelper.DevicePixelsToLogical(mousePosScreen)); // Don't blindly respect HTCAPTION. // We want UIElements in the caption area to be actionable so run through a hittest first. if (ht == HT.CAPTION) { Point mousePosWindow = mousePosScreen; mousePosWindow.Offset(-windowPosition.X, -windowPosition.Y); mousePosWindow = DpiHelper.DevicePixelsToLogical(mousePosWindow); if (_HitTestUIElements(mousePosWindow)) { ht = HT.NOWHERE; } } handled = HT.NOWHERE != ht; lRet = new IntPtr((int)ht); } return(lRet); }
static void Main(string[] args) { float HE, HS, HT, VP, DEMAIS; Console.Write("Insira a hora de entrada:"); HE = float.Parse(Console.ReadLine()); Console.Write("Insira a hora de saida:"); HS = float.Parse(Console.ReadLine()); HT = HS - HE; if (HT > 2) { VP = (5 * HT); DEMAIS = (VP + 8); Console.WriteLine("Pemanencia de "); Console.WriteLine(HT.ToString("horas")); Console.WriteLine("O valor a ser pago sera R$:"); Console.WriteLine(DEMAIS.ToString()); Console.ReadLine(); } else if (HT == 2) { VP = 9; Console.WriteLine("Pemanencia de" + HT + "horas"); Console.Write(VP.ToString("O valor a ser pago sera R$:")); Console.WriteLine(VP.ToString()); Console.ReadLine(); } else { VP = 8; Console.WriteLine("Pemanencia de" + HT + "hora"); Console.Write("O valor a ser pago sera R$:"); Console.WriteLine(VP.ToString()); Console.ReadLine(); } }
public override float Utility(HT a) { // By declaring these classes INSIDE of JBAgent_Utility, they gain access to JBAgent_Utility.MEM if (MEM[PickUp.eType.none].Count == 0) { // Everything has been discovered!!! // If all SpawnPoints are known, set dest to the origin and return minimum utility uRec.dest = Vector3.zero; uRec.u = 0; return(uRec.u); } // Looks like we still have some exploring to do! // Return the closest unknown SpawnPoint and try to explore it. uRec.dest = a.ClosestSPFromList(MEM[PickUp.eType.none]).pos; uRec.u = 1; // The last line of ALL of these needs to be return base.Utility(a) // because base.Utility(a) applies both the curve and the utilMinMax limits return(base.Utility(a)); }
private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled) { DpiScale dpi = this._window.GetDpi(); Point point = new Point((double)Utility.GET_X_LPARAM(lParam), (double)Utility.GET_Y_LPARAM(lParam)); Rect deviceRectangle = this._GetWindowRect(); Point point2 = point; point2.Offset(-deviceRectangle.X, -deviceRectangle.Y); point2 = DpiHelper.DevicePixelsToLogical(point2, dpi.DpiScaleX, dpi.DpiScaleY); IInputElement inputElement = this._window.InputHitTest(point2); if (inputElement != null) { if (WindowChrome.GetIsHitTestVisibleInChrome(inputElement)) { handled = true; return(new IntPtr(1)); } ResizeGripDirection resizeGripDirection = WindowChrome.GetResizeGripDirection(inputElement); if (resizeGripDirection != ResizeGripDirection.None) { handled = true; return(new IntPtr((int)this._GetHTFromResizeGripDirection(resizeGripDirection))); } } if (this._chromeInfo.UseAeroCaptionButtons && Utility.IsOSVistaOrNewer && this._chromeInfo.GlassFrameThickness != default(Thickness) && this._isGlassEnabled) { IntPtr intPtr; handled = NativeMethods.DwmDefWindowProc(this._hwnd, uMsg, wParam, lParam, out intPtr); if (IntPtr.Zero != intPtr) { return(intPtr); } } HT value = this._HitTestNca(DpiHelper.DeviceRectToLogical(deviceRectangle, dpi.DpiScaleX, dpi.DpiScaleY), DpiHelper.DevicePixelsToLogical(point, dpi.DpiScaleX, dpi.DpiScaleY)); handled = true; return(new IntPtr((int)value)); }
private HT _HitTestNca(Rect windowPosition, Point mousePosition) { int num = 1; int num1 = 1; bool top = false; if (mousePosition.Y >= windowPosition.Top && mousePosition.Y < windowPosition.Top + this._chromeInfo.ResizeBorderThickness.Top + this._chromeInfo.CaptionHeight) { double y = mousePosition.Y; double top1 = windowPosition.Top; Thickness resizeBorderThickness = this._chromeInfo.ResizeBorderThickness; top = y < top1 + resizeBorderThickness.Top; num = 0; } else if (mousePosition.Y < windowPosition.Bottom && mousePosition.Y >= windowPosition.Bottom - (double)((int)this._chromeInfo.ResizeBorderThickness.Bottom)) { num = 2; } if (mousePosition.X >= windowPosition.Left && mousePosition.X < windowPosition.Left + (double)((int)this._chromeInfo.ResizeBorderThickness.Left)) { num1 = 0; } else if (mousePosition.X < windowPosition.Right && mousePosition.X >= windowPosition.Right - this._chromeInfo.ResizeBorderThickness.Right) { num1 = 2; } if (num == 0 && num1 != 1 && !top) { num = 1; } HT hT = WindowChromeWorker._HitTestBorders[num, num1]; if (hT == HT.TOP && !top) { hT = HT.CAPTION; } return(hT); }
private HT _HitTestNca(Rect windowPosition, Point mousePosition) { // Determine if hit test is for resizing, default middle (1,1). int uRow = 1; int uCol = 1; bool onResizeBorder = false; // Determine if the point is at the top or bottom of the window. if (mousePosition.Y >= windowPosition.Top && mousePosition.Y < windowPosition.Top + ResizeBorder.Top + CaptionHeight) { onResizeBorder = (mousePosition.Y < (windowPosition.Top + ResizeBorder.Top)); uRow = 0; // top (caption or resize border) } else if (mousePosition.Y < windowPosition.Bottom && mousePosition.Y >= windowPosition.Bottom - (int)ResizeBorder.Bottom) { uRow = 2; // bottom } // Determine if the point is at the left or right of the window. if (mousePosition.X >= windowPosition.Left && mousePosition.X < windowPosition.Left + (int)ResizeBorder.Left) { uCol = 0; // left side } else if (mousePosition.X < windowPosition.Right && mousePosition.X >= windowPosition.Right - ResizeBorder.Right) { uCol = 2; // right side } HT ht = _HitTestBorders[uRow, uCol]; if (ht == HT.TOP && !onResizeBorder) { ht = HT.CAPTION; } return(ht); }
static void Main(string[] args) { StreamReader read = new StreamReader("input.txt"); StreamWriter writer = new StreamWriter("output.txt"); int n = int.Parse(read.ReadLine()); HT mm = new HT(); for (int i = 0; i < n; ++i) { args = read.ReadLine().Split(' '); switch (args[0]) { case "put": mm.Add(args[1], args[2]); break; case "get": writer.WriteLine(mm.Search(args[1])); break; case "prev": writer.WriteLine(mm.Prev(args[1])); break; case "next": writer.WriteLine(mm.Next(args[1])); break; case "delete": mm.Delete(args[1]); break; } } read.Close(); writer.Close(); }
public bool SetupLibCheck(IServiceProvider services, string fpath, byte[] bytes) { var listener = services.RequireService<DecompilerEventListener>(); var rdr = new LeImageReader(bytes); ushort w, len; int i; //readProtoFile(); /* Read the parameters */ if (!rdr.TryReadLeUInt32(out uint fileSig) || fileSig != 0x73636364) // "dccs" { listener.Warn(string.Format("{0} is not a DCC signature file.", fpath)); return false; } numKeys = rdr.ReadLeUInt16(); numVert = rdr.ReadLeUInt16(); PatLen = rdr.ReadLeUInt16(); SymLen = rdr.ReadLeUInt16(); if ((PatLen != PATLEN) || (SymLen != SYMLEN)) { listener.Warn(string.Format("Can't use signature file with sym and pattern lengths of {0} and {1}.", SymLen, PatLen)); return false; } // Initialise the perfhlib stuff. Also allocates T1, T2, g, etc // Set the parameters for the hash table g_pattern_hasher.setHashParams( numKeys, // The number of symbols PatLen, // The length of the pattern to be hashed 256, // The character set of the pattern (0-FF) (char)0, // Minimum pattern character value numVert); // Specifies c, the sparseness of the graph. See Czech, Havas and Majewski for details T1base = g_pattern_hasher.readT1(); T2base = g_pattern_hasher.readT2(); g = g_pattern_hasher.readG(); /* Read T1 and T2 tables */ ushort ww; if (!rdr.TryReadLeUInt16(out ww) || ww != 0x3154) // "T1" { Debug.Print("Expected 'T1'"); listener.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } len = (ushort) (PatLen * 256u * 2); // 2 = sizeof ushort w = rdr.ReadLeUInt16(); if (w != len) { Debug.Print("Problem with size of T1: file {0}, calc {1}", w, len); listener.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } readFileSection(T1base, len, rdr); if (!rdr.TryReadLeUInt16(out ww) || ww != 0x3254) // "T2" { Debug.Print("Expected 'T2'"); return false; } w = rdr.ReadLeUInt16(); if (w != len) { Debug.Print("Problem with size of T2: file %d, calc %d\n", w, len); listener.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } readFileSection(T2base, len, rdr); /* Now read the function g[] */ if (!rdr.TryReadLeUInt16(out ww) || ww != 0x6767) // "gg" { Debug.Print("Expected 'gg'"); listener.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } len = (ushort) (numVert * 2); // sizeof(uint16_t)); w = rdr.ReadLeUInt16(); if (w != len) { Debug.Print("Problem with size of g[]: file {0}, calc {1}", w, len); listener.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } readFileSection(g, len, rdr); /* This is now the hash table */ /* First allocate space for the table */ ht = new HT[numKeys]; if (!rdr.TryReadLeUInt16(out ww) || ww != 0x7468) // "ht" { Debug.Print("Expected 'ht'"); listener.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } w = rdr.ReadLeUInt16(); if (w != numKeys * (SymLen + PatLen + 2)) // sizeof(uint16_t))) { Debug.Print("Problem with size of hash table: file {0}, calc {1}", w, len); listener.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } ht = new HT[numKeys]; for (i = 0; i < numKeys; i++) { var aSym = rdr.ReadBytes(SymLen) .TakeWhile(b => b != 0).ToArray(); ht[i] = new HT { htSym = Encoding.ASCII.GetString(aSym), htPat = rdr.ReadBytes(PatLen) }; } return true; }
public void NotifyResize( HT ht ) { NativeMethods.SendNotifyMessage( new WindowInteropHelper( Owner ).Handle, (int)WM.NCLBUTTONDOWN, (IntPtr)ht, IntPtr.Zero ); }
public bool SetupLibCheck(IServiceProvider services, string fpath, byte[] bytes) { var diag = services.RequireService<IDiagnosticsService>(); var rdr = new LeImageReader(bytes); ushort w, len; int i; //readProtoFile(); /* Read the parameters */ uint fileSig; if (!rdr.TryReadLeUInt32(out fileSig) || fileSig != 0x73636364) // "dccs" { diag.Warn(string.Format("{0} is not a DCC signature file.", fpath)); return false; } numKeys = rdr.ReadLeUInt16(); numVert = rdr.ReadLeUInt16(); PatLen = rdr.ReadLeUInt16(); SymLen = rdr.ReadLeUInt16(); if ((PatLen != PATLEN) || (SymLen != SYMLEN)) { diag.Warn(string.Format("Can't use signature file with sym and pattern lengths of {0} and {1}.", SymLen, PatLen)); return false; } // Initialise the perfhlib stuff. Also allocates T1, T2, g, etc // Set the parameters for the hash table g_pattern_hasher.setHashParams( numKeys, // The number of symbols PatLen, // The length of the pattern to be hashed 256, // The character set of the pattern (0-FF) (char)0, // Minimum pattern character value numVert); // Specifies c, the sparseness of the graph. See Czech, Havas and Majewski for details T1base = g_pattern_hasher.readT1(); T2base = g_pattern_hasher.readT2(); g = g_pattern_hasher.readG(); /* Read T1 and T2 tables */ ushort ww; if (!rdr.TryReadLeUInt16(out ww) || ww != 0x3154) // "T1" { Debug.Print("Expected 'T1'"); diag.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } len = (ushort) (PatLen * 256u * 2); // 2 = sizeof ushort w = rdr.ReadLeUInt16(); if (w != len) { Debug.Print("Problem with size of T1: file {0}, calc {1}", w, len); diag.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } readFileSection(T1base, len, rdr); if (!rdr.TryReadLeUInt16(out ww) || ww != 0x3254) // "T2" { Debug.Print("Expected 'T2'"); return false; } w = rdr.ReadLeUInt16(); if (w != len) { Debug.Print("Problem with size of T2: file %d, calc %d\n", w, len); diag.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } readFileSection(T2base, len, rdr); /* Now read the function g[] */ if (!rdr.TryReadLeUInt16(out ww) || ww != 0x6767) // "gg" { Debug.Print("Expected 'gg'"); diag.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } len = (ushort) (numVert * 2); // sizeof(uint16_t)); w = rdr.ReadLeUInt16(); if (w != len) { Debug.Print("Problem with size of g[]: file {0}, calc {1}", w, len); diag.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } readFileSection(g, len, rdr); /* This is now the hash table */ /* First allocate space for the table */ ht = new HT[numKeys]; if (!rdr.TryReadLeUInt16(out ww) || ww != 0x7468) // "ht" { Debug.Print("Expected 'ht'"); diag.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } w = rdr.ReadLeUInt16(); if (w != numKeys * (SymLen + PatLen + 2)) // sizeof(uint16_t))) { Debug.Print("Problem with size of hash table: file {0}, calc {1}", w, len); diag.Warn(string.Format("{0} is not a valid DCCS file.", fpath)); return false; } ht = new HT[numKeys]; for (i = 0; i < numKeys; i++) { var aSym = rdr.ReadBytes(SymLen) .TakeWhile(b => b != 0).ToArray(); ht[i] = new HT { htSym = Encoding.ASCII.GetString(aSym), htPat = rdr.ReadBytes(PatLen) }; } return true; }
public virtual AnchorStyles HitTest(Rectangle sizeRect, Point point) { sizeRect.Inflate(1, 1); if (!sizeRect.Contains(point)) { return(AnchorStyles.None); } HT hitTest = HT.None; Test(sizeRect.Right - point.X, HT.Right, HT.AlmostRight, ref hitTest); Test(sizeRect.Bottom - point.Y, HT.Bottom, HT.AlmostBottom, ref hitTest); Test(point.X - sizeRect.Left, HT.Left, HT.AlmostLeft, ref hitTest); Test(point.Y - sizeRect.Top, HT.Top, HT.AlmostTop, ref hitTest); RemoveConflicts(ref hitTest); switch (hitTest) { case HT.Left: return(AnchorStyles.Left); case HT.Top: return(AnchorStyles.Top); case HT.Right: return(AnchorStyles.Right); case HT.Bottom: return(AnchorStyles.Bottom); case HT.Left | HT.Top: case HT.Left | HT.AlmostTop: case HT.Top | HT.AlmostLeft: return(AnchorStyles.Top | AnchorStyles.Left); case HT.Right | HT.Top: case HT.Right | HT.AlmostTop: case HT.Top | HT.AlmostRight: return(AnchorStyles.Top | AnchorStyles.Right); case HT.Right | HT.Bottom: case HT.Right | HT.AlmostBottom: case HT.Bottom | HT.AlmostRight: return(AnchorStyles.Bottom | AnchorStyles.Right); case HT.Left | HT.Bottom: case HT.Left | HT.AlmostBottom: case HT.Bottom | HT.AlmostLeft: return(AnchorStyles.Bottom | AnchorStyles.Left); default: return(ANCHOR_ALL); } }
public void NotifyResize(HT ht) { NativeMethods.SendNotifyMessage(new WindowInteropHelper(Owner).Handle, (int)WM.NCLBUTTONDOWN, (IntPtr)ht, IntPtr.Zero); }
public ToonStats() { ht = new HT(); mf = new MF(); nego = new Nego(); traya = new Traya(); en = new EN(); padme = new Padme(); jkr = new JKR(); grievous = new Grievous(); bsf = new BSF(); bossk = new Bossk(); gba = new GBA(); mal = new Malevolence(); dr = new DR(); dm = new DM(); }