private void WriteFootprintVia(BinaryWriter writer, PcbVia via)
 {
     WriteBlock(writer, w =>
     {
         WriteFootprintCommon(w, via, via.Location);
         w.Write(via.Diameter.ToInt32());
         w.Write(via.HoleSize.ToInt32());
         w.Write(via.FromLayer.ToByte());
         w.Write(via.ToLayer.ToByte());
         w.Write((byte)0); // TODO: Unknown 0
         w.Write(via.ThermalReliefAirGapWidth.ToInt32());
         w.Write((byte)via.ThermalReliefConductors);
         w.Write((byte)0);                                 // TODO: Unknown 0
         w.Write(via.ThermalReliefConductorsWidth.ToInt32());
         w.Write(Coord.FromMils(20).ToInt32());            // TODO: Unknown - Coord 20mils?
         w.Write(Coord.FromMils(20).ToInt32());            // TODO: Unknown - Coord 20mils?
         w.Write(0);                                       // TODO: Unknown 0
         w.Write(via.SolderMaskExpansion.ToInt32());
         w.Write(Enumerable.Repeat((byte)0, 3).ToArray()); // TODO: Unknown 0s
         w.Write(Enumerable.Repeat((byte)1, 4).ToArray()); // TODO: Unknown 1s
         w.Write((byte)0);                                 // TODO: Unknown 0
         w.Write((byte)(via.SolderMaskExpansionManual ? 2 : 1));
         w.Write((byte)1);                                 // TODO: Unknown 1
         w.Write((short)0);                                // TODO: Unknown 0
         w.Write(0);                                       // TODO: Unknown 0
         w.Write((byte)via.DiameterStackMode);
         foreach (var diameter in via.Diameters)           // 32 items
         {
             w.Write(diameter.ToInt32());
         }
         w.Write((short)15); // TODO: Unknown 15
         w.Write(259);       // TODO: Unknown 259
     });
 }
        private PcbVia ReadFootprintVia(BinaryReader reader)
        {
            return(ReadBlock(reader, recordSize =>
            {
                //CheckValue(nameof(recordSize), recordSize, , );
                var via = new PcbVia();
                ReadFootprintCommon(reader, via);
                via.Location = ReadCoordPoint(reader);
                via.Diameter = Coord.FromInt32(reader.ReadInt32());
                via.HoleSize = Coord.FromInt32(reader.ReadInt32());
                via.FromLayer = reader.ReadByte();
                via.ToLayer = reader.ReadByte();
                reader.ReadByte(); // TODO: Unknown 0
                via.ThermalReliefAirGapWidth = Coord.FromInt32(reader.ReadInt32());
                via.ThermalReliefConductors = reader.ReadByte();
                reader.ReadByte();  // TODO: Unknown 0
                via.ThermalReliefConductorsWidth = Coord.FromInt32(reader.ReadInt32());
                reader.ReadInt32(); // TODO: Unknown - Coord 20mils?
                reader.ReadInt32(); // TODO: Unknown - Coord 20mils?
                reader.ReadInt32(); // TODO: Unknown 0
                via.SolderMaskExpansion = Coord.FromInt32(reader.ReadInt32());
                reader.ReadByte();  // TODO: Unknown 0
                reader.ReadByte();  // TODO: Unknown 0
                reader.ReadByte();  // TODO: Unknown 0
                reader.ReadByte();  // TODO: Unknown 1
                reader.ReadByte();  // TODO: Unknown 1
                reader.ReadByte();  // TODO: Unknown 1
                reader.ReadByte();  // TODO: Unknown 1
                reader.ReadByte();  // TODO: Unknown 0
                via.SolderMaskExpansionManual = reader.ReadByte() == 2;
                reader.ReadByte();  // TODO: Unknown 1
                reader.ReadInt16(); // TODO: Unknown 0
                reader.ReadInt32(); // TODO: Unknown 0
                via.DiameterStackMode = (PcbStackMode)reader.ReadByte();
                for (int i = 0; i < 32; ++i)
                {
                    via.Diameters[i] = Coord.FromInt32(reader.ReadInt32());
                }
                reader.ReadInt16(); // TODO: Unknown 15
                reader.ReadInt32(); // TODO: Unknown 259

                return via;
            }));
        }