using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VINCheckLibrary { public class Regions { public string Region { get; private set; } public string Country { get; private set; } public string Key { get; private set; } private static Dictionary)> Codes = new Dictionary)> { { 'A', ("Africa", new Dictionary { { "ABCDEFGH", "South Africa" }, { "JKLMN", "Ivory Coast" } }) }, { 'B', ("Africa", new Dictionary { { "ABCDE", "Angola" }, { "FGHJK", "Kenya" }, { "LMNPR", "Tanzania" } }) }, { 'C', ("Africa", new Dictionary { { "ABCDE", "Benin" }, { "FGHJK", "Madagascar" }, { "LMNPR", "Tunisia" } }) }, { 'D', ("Africa", new Dictionary { { "ABCDE", "Egypt" }, { "FGHJK", "Morocco" }, { "LMNPR", "Zambia" } }) }, { 'E', ("Africa", new Dictionary { { "ABCDE", "Ethiopia" }, { "FGHJK", "Mozambique" } }) }, { 'F', ("Africa", new Dictionary { { "ABCDE", "Ghana" }, { "FGHJK", "Nigeria" } }) }, //~// { 'J', ("Asia", new Dictionary { { "ABCDEFGHJKLMNPRST", "Japan" } }) }, { 'K', ("Asia", new Dictionary { { "ABCDE", "Sri Lanka" }, { "FGHJK", "Israel" }, { "LMNPR", "South Korea" }, { "STUVWXYZ1234567890", "Kazakhstan" } }) }, { 'L', ("Asia", new Dictionary { { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "China" } }) }, { 'M', ("Asia", new Dictionary { { "ABCDE", "India" }, { "FGHJK", "Indonesia" }, { "LMNPR", "Thailand" } }) }, { 'N', ("Asia", new Dictionary { { "FGHJK", "Pakistan" }, { "LMNPR", "Turkey" } }) }, { 'P', ("Asia", new Dictionary { { "ABCDE", "Philippines" }, { "FGHJK", "Singapore" }, { "LMNPR", "Malaysia" } }) }, { 'R', ("Asia", new Dictionary { { "ABCDE", "UAE" }, { "FGHJK", "Taiwan" }, { "LMNPR", "Vietnam" }, { "STUVWXYZ1234567890", "Saudi Arabia" } }) }, //~// { 'S', ("Europe", new Dictionary { { "ABCDEFGHJKLM", "Great Britain" }, { "NPRST", "Germany" }, { "UVWXYZ", "Poland" }, { "1234", "Latvia" } }) }, { 'T', ("Europe", new Dictionary { { "ABCDEFGH", "Switzerland" }, { "JKLMNP", "Czech" }, { "RSTUV", "Hungary" }, { "WXYZ1", "Portugal" } }) }, { 'U', ("Europe", new Dictionary { { "HJKLM", "Denmark" }, { "NPRST", "Ireland" }, { "UVWXYZ", "Romania" }, { "567", "Slovakia" } }) }, { 'V', ("Europe", new Dictionary { { "ABCDE", "Austria" }, { "FGHJKLMNPR", "France" }, { "STUVW", "Spain" }, { "XYZ12", "Serbia" }, { "345", "Croatia" }, { "67890", "Estonia" } }) }, { 'W', ("Europe", new Dictionary { { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "Germany" } }) }, { 'X', ("Europe", new Dictionary { { "ABCDE", "Bulgaria" }, { "FGHJK", "Greece" }, { "LMNPR", "Netherlands" }, { "STUVW", "USSR/CIS" }, { "XYZ12", "Luxembourg" }, { "34567890", "Russia" } }) }, { 'Y', ("Europe", new Dictionary { { "ABCDE", "Belgium" }, { "FGHJK", "Finland" }, { "LMNPR", "Malta" }, { "STUVW", "Sweden" }, { "XYZ12", "Norway" }, { "345", "Belarus" }, { "67890", "Ukraine" } }) }, { 'Z', ("Europe", new Dictionary { { "ABCDEFGHJKLMNPR", "Italy" }, { "XYZ12", "Slovenia" }, { "345", "Lithuania" }, { "67890", "Russia" } }) }, //~// { '1', ("North America", new Dictionary { { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "USA" } }) }, { '2', ("North America", new Dictionary { { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "Canada" } }) }, { '3', ("North America", new Dictionary { { "ABCDEFGHJKLMNPRSTUVW", "Mexico" }, { "XYZ1234567", "Costa Rica" }, { "890", "Cayman islands" } }) }, { '4', ("North America", new Dictionary { { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "USA" } }) }, { '5', ("North America", new Dictionary { { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "USA" } }) }, //~// { '6', ("Ocenia", new Dictionary { { "ABCDEFGHJKLMNPRSTUVW", "Australia" } }) }, { '7', ("Ocenia", new Dictionary { { "ABCDE", "New Zealand" } }) }, //~// { '8', ("South America", new Dictionary { { "ABCDE", "Argentina" }, { "FGHJK", "Chile" }, { "LMNPR", "Ecuador" }, { "STUVW", "Peru" }, { "XYZ12", "Venezuela" }, }) }, { '9', ("South America", new Dictionary { { "ABCDE", "Brazil" }, { "FGHJK", "Colombia" }, { "LMNPR", "Paraguay" }, { "STUVW", "Uruguay" }, { "XYZ12", "Trinidad and Tobago" }, { "3456789", "Brazil" } }) }, }; public Regions(string code) { if (Codes.TryGetValue(code[0], out var value)) { Region = value.Item1; foreach (var pair in value.Item2) { if (pair.Key.Contains(code[1])) { Country = pair.Value; break; } } } } } }