Example #1
0
 static byte[] GetRawWoplBytes(WoplFile wopl)
 {
     using var ms = new MemoryStream();
     using var bw = new BinaryWriter(ms);
     WoplFile.Serdes(wopl, new GenericBinaryWriter(bw, Encoding.ASCII.GetBytes, ApiUtil.Assert));
     return(ms.ToArray());
 }
Example #2
0
 static void WriteWopl(WoplFile wopl, string filename)
 {
     using var ms = new MemoryStream();
     using var bw = new BinaryWriter(ms);
     WoplFile.Serdes(wopl, new GenericBinaryWriter(bw, Encoding.ASCII.GetBytes, Console.WriteLine));
     byte[] bytes = ms.ToArray();
     File.WriteAllBytes(filename, bytes);
 }
Example #3
0
 static WoplFile ReadWopl(string filename)
 {
     using var stream2 = File.OpenRead(filename);
     using var br      = new BinaryReader(stream2);
     return(WoplFile.Serdes(null, new GenericBinaryReader(br, br.BaseStream.Length, Encoding.ASCII.GetString, Console.WriteLine)));
 }