using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace VINCheckLibrary { public class VINParser { static void Main(string[] args) { } public static string Parse(string VIN) { Regex regex = new Regex("^[A-HJ-NPR-Z0-9]{17}$"); bool isLargeManufacturer = VIN[2] == '9'; Regions parsedRegion = new Regions(VIN.Substring(0, 2)); Years parsedYear = new Years(VIN[9]); Weight weight = new Weight(); if (weight.CheckWeight(VIN) && regex.IsMatch(VIN)) { return ("VIN: " + VIN + "\n" + "WMI: " + VIN.Substring(0, 3)) + "\n" + "VDS: " + VIN.Substring(3, 6) + "\n" + "VIS: " + VIN.Substring(9) + "\n" + "Region: " + parsedRegion.Region + "\n" + "Country: " + parsedRegion.Country + "\n" + "Year: " + parsedYear.Year + "\n" + (isLargeManufacturer ? "less" : "more") + " than 500 vehicles per year"; } else return "Incorrect VIN!"; } } }