private void update_ui(int page, long line) { hexBox.LineInfoOffset = (uint)((ulong)section.Start + (ulong)(page_size * page)); int mem_size = page_size; if (section.Length - page_size * page < mem_size) { mem_size = section.Length - page_size * page; } if (CheatList.IS_DEV && this.hexBox.ByteProvider != null) { } else { byte[] dst = memoryHelper.ReadMemory(section.Start + (ulong)page * page_size, (int)mem_size); MemoryViewByteProvider dataProvider = new MemoryViewByteProvider(dst); //hexBox.ByteProvider = new MemoryViewByteProvider(dst); hexBox.ByteProvider = dataProvider; } if (line != 0) { hexBox.SelectionStart = line * hexBox.BytesPerLine + column; hexBox.SelectionLength = 4; hexBox.ScrollByteIntoView((line + hexBox.Height / (int)hexBox.CharSize.Height - 1) * hexBox.BytesPerLine + column); } }
private void commit_btn_Click(object sender, EventArgs e) { MemoryViewByteProvider mvbp = (MemoryViewByteProvider)this.hexBox.ByteProvider; if (mvbp.HasChanges()) { byte[] buffer = mvbp.Bytes.ToArray(); List <int> change_list = mvbp.change_list; for (int i = 0; i < change_list.Count; ++i) { byte[] b = { buffer[change_list[i]] }; memoryHelper.WriteMemory(section.Start + (ulong)(page * page_size + change_list[i]), b); } mvbp.change_list.Clear(); } }