当前位置: 首页>>代码示例>>C#>>正文


C# IntPtr.Decrement方法代码示例

本文整理汇总了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); }));
            }
        }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:59,代码来源:MemoryList.cs

示例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)
                );
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:11,代码来源:MemoryFileSystem.cs


注:本文中的System.IntPtr.Decrement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。