C# IO library for BARS and other AAL file formats.
Supports BARS v101 and AMTA v4.
using AalSharp.Bars;
byte[] data = File.ReadAllBytes("path/to/file.bars");
var bars = BarsFile.FromBinary(data, out var endianness);using AalSharp.Bars;
// Write to a stream
using FileStream fs = File.Create("path/to/output.bars");
bars.Write(fs, Endianness.Little);
// Write to a byte[]
byte[] data = bars.ToBinary(Endianness.Little, endianness: Entish.Endianness.Little);Note
Writing to a pointer or Span<byte> can be done via the AalSharp.Bars.IO.BarsSerializer class
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated |
|---|---|---|---|---|---|---|---|
| Read | 4.245 ms | 0.1167 ms | 0.3329 ms | 1003.9063 | 941.4063 | 78.1250 | 18.34 MB |
| Write | 8.929 ms | 0.1780 ms | 0.4161 ms | 234.3750 | 156.2500 | 156.2500 | 19.38 MB |
| ToBinary | 6.638 ms | 0.1308 ms | 0.2358 ms | 359.3750 | 273.4375 | 273.4375 | 19.38 MB |
| SerializeNoAlloc | 8.648 ms | 0.1714 ms | 0.3001 ms | 78.1250 | - | - | 1.35 MB |
Install-Package AalSharp
Install-Package AalSharp.Barsgit clone https://github.com/EPD-Libraries/AalSharp.git
dotnet build AalSharp
dotnet build AalSharp.BarsSpecial thanks to Yannik Marchand (kinnay) for the research on the AAL file formats.