using System.Globalization; namespace OpenNest.IO.Bom; /// Reads a part quantity the operator typed in the import dialog. public static class BomQuantity { /// /// Accepts a whole number of at least 1, with optional surrounding /// spaces. Rejects blanks, signs, decimals, exponents, group /// separators and values above . /// public static bool TryParse(string text, out int quantity) { if ( int.TryParse( text, NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite, CultureInfo.CurrentCulture, out quantity ) && quantity >= 1 ) return true; quantity = 0; return false; } }