void Core_FindNextLZ77Address(PointerBox pointerBox, bool strict) { for (Pointer address = (pointerBox.Value + 4) + (pointerBox.Value % 4); address < Core.CurrentROMSize; address += 4) { if (Core.ReadByte(address) == 0x10) { if (strict) { uint header = Util.BytesToUInt32(Core.ReadData(address, 4), true); header >>= 8; if ((header % 0x20 == 0) && (header <= 0x8000) && (header > 0)) { pointerBox.Value = address; return; } } else { pointerBox.Value = address; return; } } } }
void Core_FindPrevLZ77Address(PointerBox pointerBox, bool strict) { for (Pointer address = (pointerBox.Value - 4) - (pointerBox.Value % 4); address >= 0; address -= 4) { if (Core.ReadByte(address) == 0x10) { if (strict) { uint header = Util.BytesToUInt32(Core.ReadData(address, 4), true); header >>= 8; if ((header % 0x20 == 0) && (header <= 0x8000) && (header > 0)) { pointerBox.Value = address; return; } } else { pointerBox.Value = address; return; } } } }
public FormRepoint(string caption, string message, Tuple <string, Pointer, int>[] pointers, int forceWidth = 0) { InitializeComponent(); this.Text = caption; TextLabel.Text = message; this.Height = 170 + pointers.Length * 30; BoxLayout.Height = Math.Min(this.Height - 170, pointers.Length * 28); BoxLayout.RowCount = pointers.Length; Lengths = new uint[pointers.Length]; Boxes = new PointerBox[pointers.Length]; Label label; for (int i = 0; i < pointers.Length; i++) { Lengths[i] = (uint)pointers[i].Item3; label = new Label(); label.Anchor = AnchorStyles.Left | AnchorStyles.Right; label.Text = pointers[i].Item1; label.TextAlign = ContentAlignment.MiddleRight; BoxLayout.Controls.Add(label, 0, i); Boxes[i] = new PointerBox(); Boxes[i].Value = pointers[i].Item2; BoxLayout.Controls.Add(Boxes[i], 1, i); label = new Label(); label.Anchor = AnchorStyles.Left | AnchorStyles.Right; label.Text = "0x" + Util.UInt32ToHex(Lengths[i]) + " /"; label.TextAlign = ContentAlignment.MiddleRight; BoxLayout.Controls.Add(label, 2, i); label = new Label(); label.Anchor = AnchorStyles.Left | AnchorStyles.Right; label.Text = Lengths[i] + " bytes"; label.TextAlign = ContentAlignment.MiddleLeft; BoxLayout.Controls.Add(label, 3, i); } if (forceWidth > 0) { AutoSequence.Visible = false; this.MaximumSize = new Size(forceWidth, this.MaximumSize.Height); this.MinimumSize = new Size(forceWidth, this.MinimumSize.Height); this.Width = forceWidth; BoxLayout.Location = new Point(BoxLayout.Location.X, BoxLayout.Location.Y + 30); BoxLayout.ColumnStyles[0].SizeType = SizeType.Percent; BoxLayout.ColumnStyles[1].SizeType = SizeType.Percent; BoxLayout.ColumnStyles[2].SizeType = SizeType.Percent; BoxLayout.ColumnStyles[3].SizeType = SizeType.Percent; BoxLayout.ColumnStyles[0].Width = 50; BoxLayout.ColumnStyles[1].Width = 25; BoxLayout.ColumnStyles[2].Width = 25; BoxLayout.ColumnStyles[3].Width = 0; } Confirm.DialogResult = DialogResult.OK; Cancel.DialogResult = DialogResult.Cancel; }
private void UpdateAsteroids(List <Obstacle> obstacles) { if (obstacles.Count > 0) { foreach (Obstacle o in obstacles) { if (o.Update()) { o.Destroy(); this.Controls.Remove(o.obj); PointerBox.Hide(); Close(); } //if (!this.ClientRectangle.IntersectsWith(o.obj.Bounds)) //{ // if ( == -1) // o.obj.Left = this.ClientRectangle.Width; // else // o.obj.Left = -o.obj.Width; //} //foreach (Obstacle o2 in obstacles) //{ // if (o2 != o) // { // if (o.isHit(o2)) // { // o.Bounce(o2); // } // } //} } } }
public MainWindow() { InitializeComponent(); FuncBox.SetPlaceholder("Введите вашу функцию здесь..."); A_Box.SetPlaceholder("0"); A_Box.AllowOnlyDouble(); B_Box.SetPlaceholder("10"); B_Box.AllowOnlyDouble(); PointerBox.SetPlaceholder("0.25"); PointerBox.AllowOnlyDouble(); }
/// <summary> /// Returns the control associated with this module property /// </summary> public Control GetControl() { Control control; long max = (long)Math.Pow(2, Length); switch (ControlType) { case PropertyType.BOOL: control = new CheckBox() { Size = new Size(20, 20), }; break; case PropertyType.TEXT: control = new TextBox() { Size = new Size(100, 20), MaxLength = Length >> 3, }; break; case PropertyType.HEXT: control = new HexBox() { Size = new Size(200, 50), VScrollBarVisible = true }; break; case PropertyType.HEXU: control = new NumericUpDown() { Size = new Size(32 + Length, 20), Minimum = 0, Maximum = max, Hexadecimal = true, }; break; case PropertyType.NUMU: control = new NumericUpDown() { Size = new Size(40 + Length, 20), Minimum = 0, Maximum = max, Hexadecimal = false, }; break; case PropertyType.NUMS: control = new NumericUpDown() { Size = new Size(40 + Length, 20), Minimum = (max / 2) * -1, Maximum = (max / 2), Hexadecimal = false, }; break; case PropertyType.LIST: if (FileName == null) { control = new ByteBox() { } } ; else { control = new ByteArrayBox() { AutoSize = true }; ((ByteArrayBox)control).Load(FileName); } break; case PropertyType.POIN: if (FileName == null) { control = new PointerBox() { } } ; else { control = new PointerArrayBox() { AutoSize = true }; ((PointerArrayBox)control).Load(FileName); } break; default: return(null); } control.Anchor = AnchorStyles.Left; return(control); }