本文整理汇总了C#中System.Text.ASCIIEncoding.LastIndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# ASCIIEncoding.LastIndexOf方法的具体用法?C# ASCIIEncoding.LastIndexOf怎么用?C# ASCIIEncoding.LastIndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Text.ASCIIEncoding
的用法示例。
在下文中一共展示了ASCIIEncoding.LastIndexOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setButtons_labels
private void setButtons_labels()
{
byte x = 0;
byte mbc = rom[0x0147];
for(int i=0x0134; i<=0x014C; i++)
{
x = (byte)(x-rom[i]-1);
}
if(x == rom[0x014D])
{
DumpROM_b.Enabled = true;
if(mbc == 0x03 || mbc == 0x06 || mbc == 0x09 || mbc == 0x0D || mbc == 0x0F || mbc == 0x10 || mbc == 0x13 || mbc == 0x17 || mbc == 0x1B || mbc == 0x1E || mbc == 0xFF)
{
DumpRAM_b.Enabled = true;
WriteRAM_b.Enabled = true;
}
switch(rom[0x0148])
{
case 0: { banks = 2; break; }
case 1: { banks = 4; break; }
case 2: { banks = 8; break; }
case 3: { banks = 16; break; }
case 4: { banks = 32; break; }
case 5: { if(mbc <= 3) banks = 63; else banks = 64; break; }
case 6: { if(rom[0x147] <= 3) banks = 125; else banks = 128; break; }
case 7: { banks = 255; break; }
default: break;
}
Banks_l.Text = "Banks: " + banks.ToString();
byte[] Title = new byte[16];
for (int i = 0; i < 16; i++)
Title[i] = rom[0x0134 + i];
//System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
//System.Text.UTF8Encoding
ROM_Title = new System.Text.ASCIIEncoding().GetString(Title);
if(ROM_Title.LastIndexOf('?') != -1)
ROM_Title.Remove(ROM_Title.LastIndexOf('?') - 4);
System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();
Title_l.Text = "Title: " + enc.GetString(Title);
rom_size = rom[0x0148];
byte ram_size = rom[0x0149];
switch (rom[0x0148])
{
case 0x00: {Size_l.Text = "Size: 32 KBytes"; rom = new byte[32768]; break;}
case 0x01: {Size_l.Text = "Size: 64 KBytes"; rom = new byte[65536]; break;}
case 0x02: {Size_l.Text = "Size: 128 KBytes"; rom = new byte[131072]; break;}
case 0x03: {Size_l.Text = "Size: 256 KBytes"; rom = new byte[262144]; break;}
case 0x04: {Size_l.Text = "Size: 512 KBytes"; rom = new byte[524288]; break;}
case 0x05: {Size_l.Text = "Size: 1 MBytes"; rom = new byte[1048576]; break;}
case 0x06: {Size_l.Text = "Size: 2 MBytes"; rom = new byte[2097152]; break;}
case 0x07: {Size_l.Text = "Size: 4 MBytes"; rom = new byte[4194304]; break;}
case 0x52: {Size_l.Text = "Size: 1.1 MBytes"; rom = new byte[32768]; break;}
case 0x53: {Size_l.Text = "Size: 1.2 MBytes"; rom = new byte[32768]; break;}
case 0x54: { Size_l.Text = "Size: 1.5 MBytes"; rom = new byte[1572864]; break; }
}
switch (ram_size)
{
case 0x00: {RAM_l.Text = "RAM Size: None"; break;}
case 0x01: {RAM_l.Text = "RAM Size: 2 KBytes"; RAM = new byte[2048]; break;}
case 0x02: {RAM_l.Text = "RAM Size: 8 KBytes"; RAM = new byte[8192]; break;}
case 0x03: { RAM_l.Text = "RAM Size: 32 KBytes"; RAM = new byte[32768]; break; }
}
MBC_l.Text = "MBC: None";
if (mbc <= 0x03 && mbc > 0x00)
MBC_l.Text = "MBC: MBC1";
if(mbc <= 0x06 && mbc > 0x03)
MBC_l.Text = "MBC: MBC2";
if(mbc <= 0x13 && mbc > 0x0D)
MBC_l.Text = "MBC: MBC3";
if(mbc <= 0x17 && mbc > 0x13)
MBC_l.Text = "MBC: MBC4";
if(mbc <= 0x0D && mbc > 0x09)
MBC_l.Text = "MBC: MMM01";
if(mbc <= 0x1E && mbc > 0x17)
MBC_l.Text = "MBC: MBC5";
if(mbc == 0xFD)
MBC_l.Text = "MBC: BANDAI TAMA5";
if(mbc == 0xFE)
MBC_l.Text = "MBC: HuC3";
if(mbc == 0xFF)
MBC_l.Text = "MBC: HuC1";
if(mbc == 0xFC)
MBC_l.Text = "MBC: POCKET CAMERA";
}
}