本文整理汇总了C#中GenericReader.Close方法的典型用法代码示例。如果您正苦于以下问题:C# GenericReader.Close方法的具体用法?C# GenericReader.Close怎么用?C# GenericReader.Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericReader
的用法示例。
在下文中一共展示了GenericReader.Close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
void Init()
{
if (!File.Exists(WOW_EXE_NAME))
{
Console.WriteLine("{0} not found!", WOW_EXE_NAME);
Console.ReadKey();
return;
}
STREAM = new StreamReader(WOW_EXE_NAME, Encoding.ASCII).ReadToEnd();
gr = new GenericReader(WOW_EXE_NAME, Encoding.ASCII);
Console.WriteLine("{0} kb readed to filestream", gr.BaseStream.Length / 1024);
if (!GetWoWVersion())
return;
if (!GetFieldsNamesStartPos())
return;
if (!GetFieldsInfoStartPos())
return;
GetStringsOffset();
FillList();
gr.Close();
DumpToFile();
Console.WriteLine("Done!");
Console.ReadKey();
}
示例2: Init
void Init()
{
if (!File.Exists(WOW_EXE_NAME))
{
Console.WriteLine("{0} not found!", WOW_EXE_NAME);
Console.ReadKey();
return;
}
STREAM = new StreamReader(WOW_EXE_NAME, Encoding.ASCII).ReadToEnd();
gr = new GenericReader(WOW_EXE_NAME, Encoding.ASCII);
Console.WriteLine("{0} kb readed to filestream", gr.BaseStream.Length / 1024);
gr.BaseStream.Position = GO_DATA_INFO_START;
for (int i = 0; i < 128; ++i)
{
GameObjectDataNameInfo info = gr.ReadStruct<GameObjectDataNameInfo>();
m_GoDataNames.Add(info);
}
gr.BaseStream.Position = GO_TYPE_INFO_START;
for (int i = 0; i < 36; ++i)
{
GameObjectTypeInfo info = gr.ReadStruct<GameObjectTypeInfo>();
m_GoTypes.Add(info);
m_GoData.Add(new List<int>());
if (info.DataCount > 0)
{
long pos = gr.BaseStream.Position;
gr.BaseStream.Position = info.DataListOffset - OFFSET2;
for (int j = 0; j < info.DataCount; ++j)
{
int dataid = gr.ReadInt32();
m_GoData[i].Add(dataid);
}
gr.BaseStream.Position = pos;
}
}
DumpToFile();
gr.Close();
Console.WriteLine("Done!");
Console.ReadKey();
}
示例3: 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();
}