123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- 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<char, (string, Dictionary<string, string>)> Codes = new Dictionary<char, (string, Dictionary<string, string>)>
- {
- { 'A', ("Africa", new Dictionary<string, string> {
- { "ABCDEFGH", "South Africa" },
- { "JKLMN", "Ivory Coast" }
- })
- },
- { 'B', ("Africa", new Dictionary<string, string> {
- { "ABCDE", "Angola" },
- { "FGHJK", "Kenya" },
- { "LMNPR", "Tanzania" }
- })
- },
- { 'C', ("Africa", new Dictionary<string, string> {
- { "ABCDE", "Benin" },
- { "FGHJK", "Madagascar" },
- { "LMNPR", "Tunisia" }
- })
- },
- { 'D', ("Africa", new Dictionary<string, string> {
- { "ABCDE", "Egypt" },
- { "FGHJK", "Morocco" },
- { "LMNPR", "Zambia" }
- })
- },
- { 'E', ("Africa", new Dictionary<string, string> {
- { "ABCDE", "Ethiopia" },
- { "FGHJK", "Mozambique" }
- })
- },
- { 'F', ("Africa", new Dictionary<string, string> {
- { "ABCDE", "Ghana" },
- { "FGHJK", "Nigeria" }
- })
- },
- //~//
- { 'J', ("Asia", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRST", "Japan" }
- })
- },
- { 'K', ("Asia", new Dictionary<string, string> {
- { "ABCDE", "Sri Lanka" },
- { "FGHJK", "Israel" },
- { "LMNPR", "South Korea" },
- { "STUVWXYZ1234567890", "Kazakhstan" }
- })
- },
- { 'L', ("Asia", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "China" }
- })
- },
- { 'M', ("Asia", new Dictionary<string, string> {
- { "ABCDE", "India" },
- { "FGHJK", "Indonesia" },
- { "LMNPR", "Thailand" }
- })
- },
- { 'N', ("Asia", new Dictionary<string, string> {
- { "FGHJK", "Pakistan" },
- { "LMNPR", "Turkey" }
- })
- },
- { 'P', ("Asia", new Dictionary<string, string> {
- { "ABCDE", "Philippines" },
- { "FGHJK", "Singapore" },
- { "LMNPR", "Malaysia" }
- })
- },
- { 'R', ("Asia", new Dictionary<string, string> {
- { "ABCDE", "UAE" },
- { "FGHJK", "Taiwan" },
- { "LMNPR", "Vietnam" },
- { "STUVWXYZ1234567890", "Saudi Arabia" }
- })
- },
- //~//
- { 'S', ("Europe", new Dictionary<string, string> {
- { "ABCDEFGHJKLM", "Great Britain" },
- { "NPRST", "Germany" },
- { "UVWXYZ", "Poland" },
- { "1234", "Latvia" }
- })
- },
- { 'T', ("Europe", new Dictionary<string, string> {
- { "ABCDEFGH", "Switzerland" },
- { "JKLMNP", "Czech" },
- { "RSTUV", "Hungary" },
- { "WXYZ1", "Portugal" }
- })
- },
- { 'U', ("Europe", new Dictionary<string, string> {
- { "HJKLM", "Denmark" },
- { "NPRST", "Ireland" },
- { "UVWXYZ", "Romania" },
- { "567", "Slovakia" }
- })
- },
- { 'V', ("Europe", new Dictionary<string, string> {
- { "ABCDE", "Austria" },
- { "FGHJKLMNPR", "France" },
- { "STUVW", "Spain" },
- { "XYZ12", "Serbia" },
- { "345", "Croatia" },
- { "67890", "Estonia" }
- })
- },
- { 'W', ("Europe", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "Germany" }
- })
- },
- { 'X', ("Europe", new Dictionary<string, string> {
- { "ABCDE", "Bulgaria" },
- { "FGHJK", "Greece" },
- { "LMNPR", "Netherlands" },
- { "STUVW", "USSR/CIS" },
- { "XYZ12", "Luxembourg" },
- { "34567890", "Russia" }
- })
- },
- { 'Y', ("Europe", new Dictionary<string, string> {
- { "ABCDE", "Belgium" },
- { "FGHJK", "Finland" },
- { "LMNPR", "Malta" },
- { "STUVW", "Sweden" },
- { "XYZ12", "Norway" },
- { "345", "Belarus" },
- { "67890", "Ukraine" }
- })
- },
- { 'Z', ("Europe", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPR", "Italy" },
- { "XYZ12", "Slovenia" },
- { "345", "Lithuania" },
- { "67890", "Russia" }
- })
- },
- //~//
- { '1', ("North America", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "USA" }
- })
- },
- { '2', ("North America", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "Canada" }
- })
- },
- { '3', ("North America", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRSTUVW", "Mexico" },
- { "XYZ1234567", "Costa Rica" },
- { "890", "Cayman islands" }
- })
- },
- { '4', ("North America", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "USA" }
- })
- },
- { '5', ("North America", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRSTUVWXYZ1234567890", "USA" }
- })
- },
- //~//
- { '6', ("Ocenia", new Dictionary<string, string> {
- { "ABCDEFGHJKLMNPRSTUVW", "Australia" }
- })
- },
- { '7', ("Ocenia", new Dictionary<string, string> {
- { "ABCDE", "New Zealand" }
- })
- },
- //~//
- { '8', ("South America", new Dictionary<string, string> {
- { "ABCDE", "Argentina" },
- { "FGHJK", "Chile" },
- { "LMNPR", "Ecuador" },
- { "STUVW", "Peru" },
- { "XYZ12", "Venezuela" },
- })
- },
- { '9', ("South America", new Dictionary<string, string> {
- { "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;
- }
- }
- }
- }
- }
- }
|