public class ESRI_RecordHeader
{
public int recnum;
public int contlength;
public ESRI_RecordHeader()
{
this.recnum = 0;
this.contlength = 0;
}
public byte[] toShapeBytes()
{
return this.toBigBytes();
}
public byte[] toBigBytes()
{
return BitConverter.GetBytes(this.recnum).Reverse().Concat(BitConverter.GetBytes(this.contlength).Reverse()).ToArray();
}
}
public bool WriteShape()
{
FileStream fshx = new FileStream("b.shx", FileMode.OpenOrCreate, FileAccess.Write);
BinaryWriter bwshx = new BinaryWriter(fshx);
bwshx.Flush();
bwshx.Write(this.shx.shxheader.toShapeBytes());
foreach (Esri_ShxRecord record in this.shx.shxrecord)
{
bwshx.Write(record.toShapeBytes());
}
bwshx.Close();
}