本文整理汇总了C#中GenericReader.PeekChar方法的典型用法代码示例。如果您正苦于以下问题:C# GenericReader.PeekChar方法的具体用法?C# GenericReader.PeekChar怎么用?C# GenericReader.PeekChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericReader
的用法示例。
在下文中一共展示了GenericReader.PeekChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button1_Click
private void button1_Click(object sender, EventArgs e)
{
string ifn = Directory.GetCurrentDirectory() + "\\" + "A9.dump";
if (!File.Exists(ifn))
{
MessageBox.Show("File " + ifn + " not found!");
return;
}
GenericReader gr = new GenericReader(ifn, Encoding.ASCII);
string error_log = "errors.txt";
StreamWriter swe = new StreamWriter(error_log);
string database_log = "data.txt";
StreamWriter data = new StreamWriter(database_log);
string ofn = "A9_out.txt";
StreamWriter sw = new StreamWriter(ofn);
sw.AutoFlush = true;
swe.AutoFlush = true;
data.AutoFlush = true;
// A9 packet structure:
// uint count (4 bytes)
// byte 0 (unk, can be 1, 2 also...) (1 byte)
// for(uint i = 0; i < count; i++)
// {
// byte updatetype (all below for UPDATETYPE_VALUES) (1 byte)
// ulong guid(packed) (2-9 bytes)
// byte count_of_blocks (1 byte)
// uint*count_of_blocks bitmask array (4*count_of_blocks bytes)
// for each non zero bit in bitmask exist block of data (uint/float) (4 bytes)
// }
//MessageBox.Show(br.BaseStream.Position.ToString() + " " + br.BaseStream.Length.ToString());
try
{
while (gr.PeekChar() >= 0)
{
uint result = ParsePacket(gr, sw, swe, data);
if (result == 0 || result == 1)
packet++;
}
}
catch(Exception exc)
{
MessageBox.Show(exc.ToString());
}
sw.Close();
swe.Close();
data.Close();
MessageBox.Show("Done!", "A9 parser", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, false);
//MessageBox.Show(br.BaseStream.Position.ToString() + " " + br.BaseStream.Length.ToString());
gr.Close();
}