First try
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.vs/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
*.user
|
||||
25
ConsoleApp1/ConsoleApp1.sln
Normal file
25
ConsoleApp1/ConsoleApp1.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.13.35919.96 d17.13
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{F7BBFFB9-4067-4AE0-9E6D-88C23E7B6A78}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F7BBFFB9-4067-4AE0-9E6D-88C23E7B6A78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F7BBFFB9-4067-4AE0-9E6D-88C23E7B6A78}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F7BBFFB9-4067-4AE0-9E6D-88C23E7B6A78}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F7BBFFB9-4067-4AE0-9E6D-88C23E7B6A78}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8F1FCDD4-4F57-428F-AC1D-917430EFC911}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
6
ConsoleApp1/ConsoleApp1/App.config
Normal file
6
ConsoleApp1/ConsoleApp1/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
||||
57
ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj
Normal file
57
ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F7BBFFB9-4067-4AE0-9E6D-88C23E7B6A78}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>ConsoleApp1</RootNamespace>
|
||||
<AssemblyName>ConsoleApp1</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="VIN-LIB, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\VIN-LIB\VIN-LIB\bin\Debug\VIN-LIB.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
82
ConsoleApp1/ConsoleApp1/Program.cs
Normal file
82
ConsoleApp1/ConsoleApp1/Program.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VIN_LIB;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string[] testVins = new string[]
|
||||
{
|
||||
// РОССИЯ (XTA - АвтоВАЗ, X7L - Renault)
|
||||
"XTA210700L1234567", "XTA211400M1234567", "X7LHSR450J1234567", "XTA11183091234567", "XTA210900V1234567",
|
||||
|
||||
// ГЕРМАНИЯ (WBA - BMW, WVG - VW, WDC - Mercedes)
|
||||
"WBA316000K1234567", "WVWZZZ1JZ1W123456", "WDC1690311J123456", "WBA530D00L1234567", "WVGZZZ5NZCW123456",
|
||||
|
||||
// США (1FA - Ford, 1GC - Chevrolet)
|
||||
"1FA6P8CF0E1234567", "1G6AF57V041234567", "1FMEU34E071234567", "1GCGK23G0B1234567", "1FM5K8GT0H1234567",
|
||||
|
||||
// ЯПОНИЯ (JTD - Toyota, JHM - Honda)
|
||||
"JTD12345678123456", "JHMRE485081234567", "JTDKB22U001234567", "JHMCV1650C1234567", "JTDGX31P0E1234567",
|
||||
|
||||
// ЮЖНАЯ КОРЕЯ (KNA - Kia, KMH - Hyundai)
|
||||
"KNAJP241261234567", "KMHCT41M0A1234567", "KNAKU4120D1234567", "KMHSH51J0B1234567", "KNAJX5240L1234567",
|
||||
|
||||
// МАЛЫЕ ПРОИЗВОДИТЕЛИ (3-й символ '9')
|
||||
// Здесь страна определяется по 12-14 символам (в примерах это X39 - Россия)
|
||||
"X3912345678X39456", "W0912345678W09123", "Y9912345678Y99123", "Z9912345678Z99123", "99912345678999123",
|
||||
|
||||
// ФРАНЦИЯ И ИТАЛИЯ (VF3 - Peugeot, ZFA - Fiat)
|
||||
"VF3CC8HZB81234567", "ZFA18200001234567", "VF7LC5FW091234567", "ZAR93900001234567", "VF32CKFVC21234567",
|
||||
|
||||
// РАЗНЫЕ РЕГИОНЫ (Китай, Великобритания, Швеция)
|
||||
"LSV12345678123456", "SAL12345678123456", "YS312345678123456", "LNV12345678123456", "SAB12345678123456",
|
||||
|
||||
// ДОПОЛНИТЕЛЬНЫЕ (Казахстан, Узбекистан, Чехия)
|
||||
"KS112345678123456", "XWB12345678123456", "TMB12345678123456", "KZC12345678123456", "XW812345678123456",
|
||||
"3HG12345678123456", "8AW12345678123456", "6AB12345678123456", "VSS12345678123456", "Y3B12345678123456"
|
||||
};
|
||||
/*
|
||||
string vin = "Z9111070060057018";
|
||||
string Euvin = "XW8AG4NH7KK108004";
|
||||
if (VIN_LIB.VIN.CheckVIN(Euvin))
|
||||
Console.WriteLine("Вин годен");
|
||||
else
|
||||
Console.WriteLine("Вин не годен");
|
||||
|
||||
Console.WriteLine(VIN_LIB.VIN.GetVINCountry(vin));
|
||||
|
||||
Console.WriteLine(VIN_LIB.VIN.GetTransportYear(vin));
|
||||
|
||||
var a = VIN_LIB.VIN.GetVinCountries();
|
||||
int i = 0;
|
||||
foreach ( var c in a)
|
||||
{
|
||||
i++;
|
||||
Console.WriteLine($"Ключ: {c.Key} Страна: {c.Value} Строка: {i}");
|
||||
}*/
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
foreach (string v in testVins)
|
||||
{
|
||||
if (VIN_LIB.VIN.CheckVIN(v))
|
||||
i++;
|
||||
else
|
||||
j++;
|
||||
Console.WriteLine($"Страна: {VIN_LIB.VIN.GetVINCountry(v)}");
|
||||
Console.WriteLine($"Вин номер: {(VIN_LIB.VIN.CheckVIN(v) ? "Верный" : "Не верный")}");
|
||||
Console.WriteLine($"Год: {VIN_LIB.VIN.GetTransportYear(v)}");
|
||||
}
|
||||
Console.WriteLine($"Успешно: {i}");
|
||||
Console.WriteLine($"Не успешно: {j}");
|
||||
Console.ReadLine();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
33
ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs
Normal file
33
ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Общие сведения об этой сборке предоставляются следующим набором
|
||||
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||
// связанные с этой сборкой.
|
||||
[assembly: AssemblyTitle("ConsoleApp1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("HP Inc.")]
|
||||
[assembly: AssemblyProduct("ConsoleApp1")]
|
||||
[assembly: AssemblyCopyright("Copyright © HP Inc. 2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||
// из модели COM задайте для атрибута ComVisible этого типа значение true.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
|
||||
[assembly: Guid("f7bbffb9-4067-4ae0-9e6d-88c23e7b6a78")]
|
||||
|
||||
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Номер редакции
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
6
VIN-LIB/ConsoleApp1/App.config
Normal file
6
VIN-LIB/ConsoleApp1/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
||||
57
VIN-LIB/ConsoleApp1/ConsoleApp1.csproj
Normal file
57
VIN-LIB/ConsoleApp1/ConsoleApp1.csproj
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{714254CA-DDE4-42B2-8077-38D9F565C70F}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>ConsoleApp1</RootNamespace>
|
||||
<AssemblyName>ConsoleApp1</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="VIN-LIB, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\VIN-LIB\bin\Release\VIN-LIB.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
23
VIN-LIB/ConsoleApp1/Program.cs
Normal file
23
VIN-LIB/ConsoleApp1/Program.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VIN_LIB;
|
||||
|
||||
namespace ConsoleApp1
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
string vin = "Z9MCM56557C404453";
|
||||
if (VIN_LIB.VIN.CheckVIN(vin))
|
||||
Console.WriteLine("Вин годен");
|
||||
VIN_LIB.VIN.GetVINCountry(vin);
|
||||
Console.ReadLine();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
33
VIN-LIB/ConsoleApp1/Properties/AssemblyInfo.cs
Normal file
33
VIN-LIB/ConsoleApp1/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Общие сведения об этой сборке предоставляются следующим набором
|
||||
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||
// связанные с этой сборкой.
|
||||
[assembly: AssemblyTitle("ConsoleApp1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("HP Inc.")]
|
||||
[assembly: AssemblyProduct("ConsoleApp1")]
|
||||
[assembly: AssemblyCopyright("Copyright © HP Inc. 2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||
// из модели COM задайте для атрибута ComVisible этого типа значение true.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
|
||||
[assembly: Guid("714254ca-dde4-42b2-8077-38d9f565c70f")]
|
||||
|
||||
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Номер редакции
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
31
VIN-LIB/VIN-LIB.sln
Normal file
31
VIN-LIB/VIN-LIB.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.13.35919.96
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIN-LIB", "VIN-LIB\VIN-LIB.csproj", "{78203663-3306-4E81-922F-1A5A939A22BC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{714254CA-DDE4-42B2-8077-38D9F565C70F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{78203663-3306-4E81-922F-1A5A939A22BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{78203663-3306-4E81-922F-1A5A939A22BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{78203663-3306-4E81-922F-1A5A939A22BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{78203663-3306-4E81-922F-1A5A939A22BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{714254CA-DDE4-42B2-8077-38D9F565C70F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{714254CA-DDE4-42B2-8077-38D9F565C70F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{714254CA-DDE4-42B2-8077-38D9F565C70F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{714254CA-DDE4-42B2-8077-38D9F565C70F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {309FDFE6-0A5F-4D5A-93A0-87FF7F7F2348}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
33
VIN-LIB/VIN-LIB/Properties/AssemblyInfo.cs
Normal file
33
VIN-LIB/VIN-LIB/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Общие сведения об этой сборке предоставляются следующим набором
|
||||
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||
// связанные со сборкой.
|
||||
[assembly: AssemblyTitle("VIN-LIB")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("HP Inc.")]
|
||||
[assembly: AssemblyProduct("VIN-LIB")]
|
||||
[assembly: AssemblyCopyright("Copyright © HP Inc. 2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
|
||||
[assembly: Guid("78203663-3306-4e81-922f-1a5a939a22bc")]
|
||||
|
||||
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Редакция
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
48
VIN-LIB/VIN-LIB/VIN-LIB.csproj
Normal file
48
VIN-LIB/VIN-LIB/VIN-LIB.csproj
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{78203663-3306-4E81-922F-1A5A939A22BC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VIN_LIB</RootNamespace>
|
||||
<AssemblyName>VIN-LIB</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="VIN.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
276
VIN-LIB/VIN-LIB/VIN.cs
Normal file
276
VIN-LIB/VIN-LIB/VIN.cs
Normal file
@@ -0,0 +1,276 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VIN_LIB
|
||||
{
|
||||
public class VIN
|
||||
{
|
||||
public static Dictionary<string, string> GetVinCountries()
|
||||
{
|
||||
var countries = new Dictionary<string, string>();
|
||||
//Африка
|
||||
SdelatInterval(countries, "AA", "AH", "ЮАР");
|
||||
SdelatInterval(countries, "AJ", "AN", "Кот-д’Ивуар");
|
||||
SdelatInterval(countries, "BA", "BE", "Ангола");
|
||||
SdelatInterval(countries, "BF", "BK", "Кения");
|
||||
SdelatInterval(countries, "BL", "BR", "Танзания");
|
||||
SdelatInterval(countries, "CA", "CE", "Бенин");
|
||||
SdelatInterval(countries, "CF", "CK", "Мадагаскар");
|
||||
SdelatInterval(countries, "CL", "CR", "Тунис");
|
||||
SdelatInterval(countries, "DA", "DE", "Египет");
|
||||
SdelatInterval(countries, "DF", "DK", "Марокко");
|
||||
SdelatInterval(countries, "DL", "DR", "Замбия");
|
||||
SdelatInterval(countries, "EA", "EE", "Эфиопия");
|
||||
SdelatInterval(countries, "EF", "EK", "Мозамбик");
|
||||
SdelatInterval(countries, "FA", "FE", "Гана");
|
||||
SdelatInterval(countries, "FF", "FK", "Нигерия");
|
||||
|
||||
//Азия
|
||||
SdelatInterval(countries, "JA", "JT", "Япония");
|
||||
SdelatInterval(countries, "KA", "KE", "Шри Ланка");
|
||||
SdelatInterval(countries, "KF", "KK", "Израиль");
|
||||
SdelatInterval(countries, "KL", "KR", "Южная Корея");
|
||||
SdelatInterval(countries, "KS", "K0", "Казахстан");
|
||||
SdelatInterval(countries, "LA", "L0", "Китай");
|
||||
SdelatInterval(countries, "MA", "ME", "Индия");
|
||||
SdelatInterval(countries, "MF", "MK", "Индонезия");
|
||||
SdelatInterval(countries, "ML", "MR", "Таиланд");
|
||||
SdelatInterval(countries, "NF", "NK", "Пакистан");
|
||||
SdelatInterval(countries, "NL", "NR", "Турция");
|
||||
SdelatInterval(countries, "PA", "PE", "Филиппины");
|
||||
SdelatInterval(countries, "PF", "PK", "Сингапур");
|
||||
SdelatInterval(countries, "PL", "PR", "Малайзия");
|
||||
SdelatInterval(countries, "RA", "RE", "ОАЭ");
|
||||
SdelatInterval(countries, "RF", "RK", "Тайвань");
|
||||
SdelatInterval(countries, "RL", "RR", "Вьетнам");
|
||||
SdelatInterval(countries, "RS", "R0", "Саудовская Аравия");
|
||||
|
||||
// Европа
|
||||
SdelatInterval(countries, "SA", "SM", "Великобритания");
|
||||
SdelatInterval(countries, "SN", "ST", "Германия");
|
||||
SdelatInterval(countries, "SU", "SZ", "Польша");
|
||||
SdelatInterval(countries, "S1", "S4", "Латвия");
|
||||
SdelatInterval(countries, "TA", "TH", "Швейцария");
|
||||
SdelatInterval(countries, "TJ", "TP", "Чехия");
|
||||
SdelatInterval(countries, "TR", "TV", "Венгрия");
|
||||
SdelatInterval(countries, "TW", "T1", "Португалия");
|
||||
SdelatInterval(countries, "UH", "UM", "Дания");
|
||||
SdelatInterval(countries, "UN", "UT", "Ирландия");
|
||||
SdelatInterval(countries, "UU", "UZ", "Румыния");
|
||||
SdelatInterval(countries, "U5", "U7", "Словакия");
|
||||
SdelatInterval(countries, "VA", "VE", "Австрия");
|
||||
SdelatInterval(countries, "VF", "VR", "Франция");
|
||||
SdelatInterval(countries, "VS", "VW", "Испания");
|
||||
SdelatInterval(countries, "VX", "V2", "Сербия");
|
||||
SdelatInterval(countries, "V3", "V5", "Хорватия");
|
||||
SdelatInterval(countries, "V6", "V0", "Эстония");
|
||||
SdelatInterval(countries, "WA", "W0", "Германия");
|
||||
SdelatInterval(countries, "XA", "XE", "Болгария");
|
||||
SdelatInterval(countries, "XF", "XK", "Греция");
|
||||
SdelatInterval(countries, "XL", "XR", "Нидерланды");
|
||||
SdelatInterval(countries, "XS", "XW", "СССР/СНГ");
|
||||
SdelatInterval(countries, "XX", "X2", "Люксембург");
|
||||
SdelatInterval(countries, "X3", "X0", "Россия");
|
||||
SdelatInterval(countries, "YA", "YE", "Бельгия");
|
||||
SdelatInterval(countries, "YF", "YK", "Финляндия");
|
||||
SdelatInterval(countries, "YL", "YR", "Мальта");
|
||||
SdelatInterval(countries, "YS", "YW", "Швеция");
|
||||
SdelatInterval(countries, "YX", "Y2", "Норвегия");
|
||||
SdelatInterval(countries, "Y3", "Y5", "Беларусь");
|
||||
SdelatInterval(countries, "Y6", "Y0", "Украина");
|
||||
SdelatInterval(countries, "ZA", "ZR", "Италия");
|
||||
SdelatInterval(countries, "ZX", "Z2", "Словения");
|
||||
SdelatInterval(countries, "Z3", "Z5", "Литва");
|
||||
SdelatInterval(countries, "Z6", "Z0", "Россия");
|
||||
|
||||
// Америка
|
||||
SdelatInterval(countries, "1A", "10", "США");
|
||||
SdelatInterval(countries, "2A", "20", "Канада");
|
||||
SdelatInterval(countries, "3A", "3W", "Мексика");
|
||||
SdelatInterval(countries, "3X", "37", "Коста-Рика");
|
||||
SdelatInterval(countries, "38", "30", "Каймановы острова");
|
||||
SdelatInterval(countries, "4A", "40", "США");
|
||||
SdelatInterval(countries, "5A", "50", "США");
|
||||
|
||||
// Океания
|
||||
SdelatInterval(countries, "6A", "6W", "Австралия");
|
||||
SdelatInterval(countries, "7A", "7E", "Новая Зеландия");
|
||||
|
||||
// Юж Америка
|
||||
SdelatInterval(countries, "8A", "8E", "Аргентина");
|
||||
SdelatInterval(countries, "8F", "8K", "Чили");
|
||||
SdelatInterval(countries, "8L", "8R", "Эквадор");
|
||||
SdelatInterval(countries, "8S", "8W", "Перу");
|
||||
SdelatInterval(countries, "8X", "82", "Венесуэла");
|
||||
SdelatInterval(countries, "9A", "9E", "Бразилия");
|
||||
SdelatInterval(countries, "9F", "9K", "Колумбия");
|
||||
SdelatInterval(countries, "9L", "9R", "Парагвай");
|
||||
SdelatInterval(countries, "9S", "9W", "Уругвай");
|
||||
SdelatInterval(countries, "9X", "92", "Тринидад и Тобаго");
|
||||
SdelatInterval(countries, "93", "99", "Бразилия");
|
||||
|
||||
return countries;
|
||||
}
|
||||
public static char[] allowedChars = "ABCDEFGHJKLMNPRSTUVWXYZ1234567890".ToCharArray();
|
||||
private static void SdelatInterval(Dictionary<string, string> dict, string start, string end, string country)
|
||||
{
|
||||
bool started = false;
|
||||
|
||||
// Перебираем все возможные комбинации из двух символов
|
||||
foreach (char c1 in allowedChars)
|
||||
{
|
||||
foreach (char c2 in allowedChars)
|
||||
{
|
||||
string current = $"{c1}{c2}";
|
||||
|
||||
if (current == start) started = true;
|
||||
|
||||
if (started)
|
||||
{
|
||||
if (!dict.ContainsKey(current))
|
||||
dict.Add(current, country);
|
||||
|
||||
if (current == end) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static string GetVINCountry(string vin)
|
||||
{
|
||||
if (string.IsNullOrEmpty(vin) || vin.Length < 17)
|
||||
return "Некорректный VIN";
|
||||
|
||||
string countryCode;
|
||||
|
||||
// Проверка правила "менее 500 автомобилей в год"
|
||||
if (vin[2] == '9')
|
||||
{
|
||||
countryCode = vin.Substring(11, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
countryCode = vin.Substring(0, 2);
|
||||
}
|
||||
|
||||
if (GetVinCountries().TryGetValue(countryCode, out string countryName))
|
||||
{
|
||||
return countryName;
|
||||
}
|
||||
|
||||
return "Страна не определена";
|
||||
}
|
||||
public static bool CheckWMI(string vin)
|
||||
{
|
||||
string code = vin.Substring(0, 2);
|
||||
|
||||
if (GetVinCountries().TryGetValue(code, out string country))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool CheckVDS(string vin)
|
||||
{
|
||||
if (vin[8] == CalculateCheckDigit(vin))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
public static char CalculateCheckDigit(string vin)
|
||||
{
|
||||
int GetValue(char c)
|
||||
{
|
||||
if (char.IsDigit(c)) return c - '0';
|
||||
switch (c)
|
||||
{
|
||||
case 'A': case 'J': return 1;
|
||||
case 'B': case 'K': case 'S': return 2;
|
||||
case 'C': case 'L': case 'T': return 3;
|
||||
case 'D': case 'M': case 'U': return 4;
|
||||
case 'E': case 'N': case 'V': return 5;
|
||||
case 'F': case 'P': case 'W': return 6;
|
||||
case 'G': case 'R': case 'X': return 7;
|
||||
case 'H': case 'Y': return 8;
|
||||
case 'Z': return 9;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int[] weights = { 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 };
|
||||
|
||||
int sum = 0;
|
||||
for (int i = 0; i < 17; i++)
|
||||
{
|
||||
sum += GetValue(vin[i]) * weights[i];
|
||||
}
|
||||
|
||||
|
||||
int remainder = sum % 11;
|
||||
|
||||
if (remainder == 10) return 'X';
|
||||
return (char)(remainder + '0');
|
||||
}
|
||||
|
||||
private static readonly Dictionary<char, int> YearCodes = new Dictionary<char, int>
|
||||
{
|
||||
{'A', 1980}, {'B', 1981}, {'C', 1982}, {'D', 1983}, {'E', 1984}, {'F', 1985}, {'G', 1986}, {'H', 1987}, {'J', 1988}, {'K', 1989},
|
||||
{'L', 1990}, {'M', 1991}, {'N', 1992}, {'P', 1993}, {'R', 1994}, {'S', 1995}, {'T', 1996}, {'V', 1997}, {'W', 1998}, {'X', 1999},
|
||||
{'Y', 2000}, {'1', 2001}, {'2', 2002}, {'3', 2003}, {'4', 2004}, {'5', 2005}, {'6', 2006}, {'7', 2007}, {'8', 2008}, {'9', 2009}
|
||||
};
|
||||
|
||||
public static int GetTransportYear(string vin)
|
||||
{
|
||||
if (string.IsNullOrEmpty(vin) || vin.Length < 10)
|
||||
return 0;
|
||||
|
||||
// Год — это всегда 10-й символ VIN (индекс 9)
|
||||
char yearCode = char.ToUpper(vin[9]);
|
||||
|
||||
if (YearCodes.TryGetValue(yearCode, out int baseYear))
|
||||
{
|
||||
// Поскольку коды повторяются каждые 30 лет (A было в 1980 и снова в 2010),
|
||||
// нужно определить, к какому периоду относится авто.
|
||||
// Современные системы обычно проверяют текущий год.
|
||||
|
||||
int currentYear = DateTime.Now.Year;
|
||||
int year = baseYear;
|
||||
|
||||
// Если машина из будущего (например, код 'A' и сейчас 2024 год),
|
||||
// значит это 2010 год, а не 1980.
|
||||
while (year + 30 <= currentYear + 1) // +1, так как модельный год может обгонять календарный
|
||||
{
|
||||
year += 30;
|
||||
}
|
||||
|
||||
return year;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
public static bool CheckVIS(string vin)
|
||||
{
|
||||
if (string.IsNullOrEmpty(vin) || vin.Length < 17)
|
||||
return false;
|
||||
|
||||
for (int i = 13; i < 17; i++)
|
||||
{
|
||||
if (!char.IsDigit(vin[i])) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static bool CheckVIN(string vin)
|
||||
{
|
||||
if (string.IsNullOrEmpty(vin) || vin.Length < 17)
|
||||
return false;
|
||||
if(!CheckWMI(vin))
|
||||
return false;
|
||||
if (!CheckVDS(vin))
|
||||
return false;
|
||||
if (!CheckVIS(vin))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user