我似乎得到了OutOfRangeException
以下说明:“索引超出表格限制”(不准确的翻译,我的 VS 是法语),这是相关代码:
pntrs = new int[Pntrnum];
for (int i = 0; i < Pntrnum; i++)
{
stream.Position = Pntrstrt + i * 0x20;
stream.Read(data, 0, data.Length);
pntrs[i] = BitConverter.ToInt32(data, 0);
}
Strs = new string[Pntrnum];
for (int i = 0; i < Pntrnum; i++)
{
byte[] sttrings = new byte[pntrs[i + 1] - pntrs[i]];//the exception occures here !
stream.Position = pntrs[i];
stream.Read(sttrings, 0, sttrings.Length);
Strs[i] = Encoding.GetEncoding("SHIFT-JIS").GetString(sttrings).Split('\0')[0].Replace("[FF00]", "/et").Replace("[FF41]", "t1/").Replace("[FF42]", "t2/").Replace("[FF43]", "t3/").Replace("[FF44]", "t4/").Replace("[FF45]", "t5/").Replace("[FF46]", "t6/").Replace("[FF47]", "t7/").Replace("[0a]", "\n");
ListViewItem item = new ListViewItem(new string[]
{
i.ToString(),
pntrs[i].ToString("X"),
Strs[i],
Strs[i],
});
listView1.Items.AddRange(new ListViewItem[] {item});
}
难道我做错了什么 ?