public override bool ProcessLine(byte[] record) { Layers Layer; Int16 Component; bool InComponent; base.ProcessLine(); using (MemoryStream ms = new MemoryStream(record)) { // Use the memory stream in a binary reader. using (BinaryReader br = new BinaryReader(ms)) { try { ms.Seek(0, SeekOrigin.Begin); Layer = (Layers)br.ReadByte(); ms.Seek(1, SeekOrigin.Begin); short Flags = (short)br.ReadInt16(); ms.Seek(3, SeekOrigin.Begin); int net = (int)br.ReadInt16() + 1; ms.Seek(7, SeekOrigin.Begin); Component = br.ReadInt16(); InComponent = Component != -1; ms.Seek(0x12, SeekOrigin.Begin); int strlen = br.ReadInt32(); ms.Seek(0x16, SeekOrigin.Begin); byte[] bytes = br.ReadBytes(strlen); string str = ConvertToString(bytes); ms.Seek(0x16 + strlen, SeekOrigin.Begin); Int32 DataLen = br.ReadInt32(); string l = Brd.GetLayer((Layers)Layer); Region r = new Region(l, net, Flags, str); if (r.SubPolyIndex > 0) { // Rejected region return(true); } while (DataLen-- > 0) { double X = Math.Round(ToMM(br.ReadDouble()) - originX, Precision); double Y = Math.Round(ToMM(br.ReadDouble()) - originY, Precision); r.AddPoint(X, Y); } if (!InComponent) { RegionsL.Add(r); } else { if (!r.Keepout && !r.PolygonCutout) { ModulesL[Component].Regions.Add(r); } else { // until keepouts are allowed in components // just add as a board region RegionsL.Add(r); } } } catch (Exception Ex) { CheckThreadAbort(Ex); } } } return(true); }