本文整理汇总了C#中System.IntPtr.Decrement方法的典型用法代码示例。如果您正苦于以下问题:C# IntPtr.Decrement方法的具体用法?C# IntPtr.Decrement怎么用?C# IntPtr.Decrement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IntPtr
的用法示例。
在下文中一共展示了IntPtr.Decrement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: readWriteAddressMemoryMenuItem_Click
private void readWriteAddressMemoryMenuItem_Click(object sender, EventArgs e)
{
PromptBox prompt = new PromptBox();
if (prompt.ShowDialog() == DialogResult.OK)
{
IntPtr address = new IntPtr(-1);
IntPtr regionAddress = IntPtr.Zero;
long regionSize = 0;
bool found = false;
try
{
address = ((long)BaseConverter.ToNumberParse(prompt.Value)).ToIntPtr();
}
catch
{
PhUtils.ShowError("You have entered an invalid address.");
return;
}
List<MemoryItem> items = new List<MemoryItem>();
foreach (MemoryItem item in _provider.Dictionary.Values)
items.Add(item);
items.Sort((i1, i2) => i1.Address.CompareTo(i2.Address));
int i = 0;
foreach (MemoryItem item in items)
{
if (item.Address.CompareTo(address) > 0)
{
MemoryItem regionItem = items[i - 1];
listMemory.Items[regionItem.Address.ToString()].Selected = true;
listMemory.Items[regionItem.Address.ToString()].EnsureVisible();
regionAddress = regionItem.Address;
regionSize = regionItem.Size;
found = true;
break;
}
i++;
}
if (!found)
{
PhUtils.ShowError("Unable to find the memory address.");
return;
}
MemoryEditor m_e = MemoryEditor.ReadWriteMemory(_pid, regionAddress, (int)regionSize, false,
new Program.MemoryEditorInvokeAction(delegate(MemoryEditor f) { f.Select(address.Decrement(regionAddress).ToInt64(), 1); }));
}
}
示例2: GetCellId
private MfsCellId GetCellId(IntPtr cellView)
{
IntPtr view;
view = this.GetBlock(cellView);
return new MfsCellId(
_views2[view].BlockId,
(ushort)(cellView.Decrement(view).ToInt32() / _cellSize)
);
}