- Messages
- 7
- Country
Hi,
I'm trying to read BGL files in .NET, following the documentation at https://www.fsdeveloper.com/wiki/in...GL file is made,dependent on the section type.
Using P3Dv5 as a test, and for consistency I am reading the same(?) BGL file as used in the example on the wiki article. For the header, below is my 56 bytes
The second line, is my DWORD (Int32) generated from the first 4 bytes, 0x00 to 0x03.
Is this correct, because from what I am reading, the Magic number is not 0x01, 0x02, 0x19, or 0x92?
I'm trying to read BGL files in .NET, following the documentation at https://www.fsdeveloper.com/wiki/in...GL file is made,dependent on the section type.
Using P3Dv5 as a test, and for consistency I am reading the same(?) BGL file as used in the example on the wiki article. For the header, below is my 56 bytes
C:\Games\Prepar3D\Scenery\0301\scenery\cvx2815.bgl
65 0 0 0 1 0 0 0 86 8 0 0 63 91 60 2 60 88 0 0 6 0 0 0 0 FA 81 0 0 0 0 0 44 3 0 0 F4 4 0 0 26 8 0 0 6F 3E 1 0 1B 1C 0 0 86 7D B0 CE
65
The second line, is my DWORD (Int32) generated from the first 4 bytes, 0x00 to 0x03.
Is this correct, because from what I am reading, the Magic number is not 0x01, 0x02, 0x19, or 0x92?
private void ScanBGL(string thisFile)
{
Console.WriteLine(thisFile);
byte[] thisHeader = new byte[56];
using (System.IO.BinaryReader thisStream = new System.IO.BinaryReader(new System.IO.FileStream(thisFile, System.IO.FileMode.Open)))
{
thisStream.BaseStream.Seek(0x38, 0);
thisStream.Read(thisHeader, 0, 56);
}
Console.WriteLine(ByteArrayToHex(ref thisHeader));
Console.WriteLine(Hex(BitConverter.ToInt32(thisHeader, 0)));
}
private string ByteArrayToHex(ref byte[] ByteArray)
{
long l;
string strRet = "";
for (l = Information.LBound(ByteArray); l <= Information.UBound(ByteArray); l++)
strRet = strRet + Hex(ByteArray[System.Convert.ToInt32(l)]) + " ";
ByteArrayToHex = Left(strRet, Strings.Len(strRet) - 1);
}