using (BinaryReader br = new BinaryReader(File.Open(file, FileMode.Open, FileAccess.Read)))
{
long streamLength = br.BaseStream.Length;
byte[] bytes = new byte[streamLength];
try
{
for (int i = 0; i < streamLength; i++)
{
bytes[i] = br.ReadByte();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
ushort num;
ushort file;
char f;
num = BitConverter.ToUInt16(bytes, 0);
file = BitConverter.ToUInt16(bytes, 2);
f = BitConverter.ToChar(bytes, 53);
Console.WriteLine(num);
Console.WriteLine(file);
Console.WriteLine(f);
}
}
|