private int getPolylineCount(ObjectId[] objectId_0) { int num = 0; if (objectId_0 != null) { using (Transaction transaction = this.database_0.TransactionManager.StartTransaction()) { for (int i = 0; i < objectId_0.Length; i++) { DBObject @object = transaction.GetObject(objectId_0[i], (OpenMode)0); Polyline2d polyline2d = @object as Polyline2d; Polyline polyline = @object as Polyline; Polyline3d polyline3d = @object as Polyline3d; if (polyline2d != null) { if (!polyline2d.Closed) { throw new ArgumentException("At least one boundary polyline is not closed.\n"); } double num2 = 0.0; List <Edge> list = Conversions.ToCeometricEdgeList(polyline2d); for (int j = 0; j < list.Count; j++) { num2 += list[j].Length; } double distanceAtParameter = polyline2d.GetDistanceAtParameter(polyline2d.EndParam); if (!Global.AlmostEquals(num2, distanceAtParameter)) { throw new System.Exception("At least one boundary polyline contains curved segments. Decurve the polyline first.\n"); } num++; } else if (polyline != null) { if (!polyline.Closed) { throw new ArgumentException("At least one boundary polyline is not closed.\n"); } if (!polyline.IsOnlyLines) { throw new System.Exception("At least one boundary polyline contains curved segments. Decurve the polyline first.\n"); } num++; } else { if (!(polyline3d != null)) { throw new ArgumentException("Invalid polyline object: " + @object.Handle.ToString() + "\nObject type: " + @object.GetType().ToString()); } if (!polyline3d.Closed) { throw new ArgumentException("At least one boundary polyline is not closed.\n"); } double num3 = 0.0; List <Edge> list2 = Conversions.ToCeometricEdgeList(polyline3d); for (int k = 0; k < list2.Count; k++) { num3 += list2[k].Length; } double distanceAtParameter2 = polyline3d.GetDistanceAtParameter(polyline3d.EndParam); if (!Global.AlmostEquals(num3, distanceAtParameter2)) { throw new System.Exception("At least one boundary polyline contains curved segments. Decurve the polyline first.\n"); } num++; } } } } return(num); }