<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project=".\packages\Costura.Fody.6.2.0\build\Costura.Fody.props" Condition="Exists('.\packages\Costura.Fody.6.2.0\build\Costura.Fody.props')" />
  <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>{2ED77BFD-0EF1-49C4-A199-75D89EC3941E}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>NfcAime.Dll</RootNamespace>
    <AssemblyName>NfcAime.Dll</AssemblyName>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
    <DllExportTargetFrameworkVersion>v4.5</DllExportTargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <LangVersion>13</LangVersion>
    <Nullable>disable</Nullable>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>x64</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>x64</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup>
    <DllExportIdent>8BAB90F1-9613-4660-B2E2-C888DDACEA57</DllExportIdent>
    <DllExportMetaLibName>DllExport.dll</DllExportMetaLibName>
    <DllExportNamespace>NfcAime.Dll</DllExportNamespace>
    <DllExportDDNSCecil>true</DllExportDDNSCecil>
    <DllExportSkipOnAnyCpu>false</DllExportSkipOnAnyCpu>
    <DllExportPlatform>Auto</DllExportPlatform>
    <DllExportOrdinalsBase>1</DllExportOrdinalsBase>
    <DllExportGenExpLib>false</DllExportGenExpLib>
    <DllExportOurILAsm>false</DllExportOurILAsm>
    <DllExportSysObjRebase>false</DllExportSysObjRebase>
    <DllExportLeaveIntermediateFiles>false</DllExportLeaveIntermediateFiles>
    <DllExportTimeout>30000</DllExportTimeout>
    <DllExportPeCheck>6</DllExportPeCheck>
    <DllExportPatches>0</DllExportPatches>
    <DllExportRefreshObj>false</DllExportRefreshObj>
    <DllExportILAsmExternAsm />
    <DllExportILAsmTypeRef />
    <DllExportTypeRefOptions>0</DllExportTypeRefOptions>
    <DllExportRefPackages />
    <DllExportPreProcType>0</DllExportPreProcType>
    <DllExportPostProcType>0</DllExportPostProcType>
    <DllExportDir>$(MSBuildProjectDirectory)\.\packages\DllExport.1.8.1\</DllExportDir>
  </PropertyGroup>
  <PropertyGroup>
    <wSlnDir Condition="'$(SolutionDir)' != ''">$(SolutionDir)</wSlnDir>
    <wSlnFile Condition="'$(SolutionPath)' != ''">$(SolutionPath)</wSlnFile>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Costura, Version=6.2.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
      <HintPath>.\packages\Costura.Fody.6.2.0\lib\netstandard2.0\Costura.dll</HintPath>
    </Reference>
    <Reference Include="mscorlib" />
    <Reference Include="System" />
    <Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
      <HintPath>.\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
    </Reference>
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.IO.Ports, Version=10.0.0.7, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
      <HintPath>.\packages\System.IO.Ports.10.0.7\lib\net462\System.IO.Ports.dll</HintPath>
    </Reference>
    <Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
      <HintPath>.\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
    </Reference>
    <Reference Include="System.Numerics" />
    <Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>.\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
    </Reference>
    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>.\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
    </Reference>
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AccessCodeFormatter.cs" />
    <Compile Include="Config.cs" />
    <Compile Include="FelicaCommandBuilder.cs" />
    <Compile Include="FeliCaDecryptor.cs" />
    <Compile Include="FelicaResponseParser.cs" />
    <Compile Include="MainDll.cs" />
    <Compile Include="MiFareHandle.cs" />
    <Compile Include="PN532\CompilerSupport.cs" />
    <Compile Include="PN532\IPn532FrameTransport.cs" />
    <Compile Include="PN532\Pn532FrameKind.cs" />
    <Compile Include="PN532\Pn532FrameParser.cs" />
    <Compile Include="PN532\Pn532FrameParseResult.cs" />
    <Compile Include="PN532\Pn532HsuFrame.cs" />
    <Compile Include="PN532\Pn532Session.cs" />
    <Compile Include="PN532\ReplayFrameTransport.cs" />
    <Compile Include="PN532\SerialFrameTransport.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="AimeReader.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="FodyWeavers.xml" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="DllExport">
      <Version>1.8.1</Version>
      <Visible>false</Visible>
      <Wz>1</Wz>
    </PackageReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project=".\packages\Fody.6.9.3\build\Fody.targets" Condition="Exists('.\packages\Fody.6.9.3\build\Fody.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('.\packages\Fody.6.9.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '.\packages\Fody.6.9.3\build\Fody.targets'))" />
    <Error Condition="!Exists('.\packages\Costura.Fody.6.2.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '.\packages\Costura.Fody.6.2.0\build\Costura.Fody.props'))" />
    <Error Condition="!Exists('.\packages\Costura.Fody.6.2.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '.\packages\Costura.Fody.6.2.0\build\Costura.Fody.targets'))" />
  </Target>
  <Import Project=".\packages\Costura.Fody.6.2.0\build\Costura.Fody.targets" Condition="Exists('.\packages\Costura.Fody.6.2.0\build\Costura.Fody.targets')" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
         Other similar extension points exist, see Microsoft.Common.targets.
    <Target Name="BeforeBuild">
    </Target>
    <Target Name="AfterBuild">
    </Target>
    -->
  <ImportGroup Label=".NET DllExport">
    <Import Project="$(DllExportDir)packages\DllExport.1.8.1\tools\net.r_eg.DllExport.targets" Condition="Exists($([MSBuild]::Escape('$(DllExportDir)packages\DllExport.1.8.1\tools\net.r_eg.DllExport.targets')))" Label="8337224c9ad9e356" />
  </ImportGroup>
  <Target Name="DllExportRestorePkg" BeforeTargets="PrepareForBuild">
    <Error Condition="'$(DllExportNoRestore)'!='true' And !Exists('$(DllExportDir)DllExport.bat')" Text="DllExport.bat was not found in $(DllExportDir); https://github.com/3F/DllExport" />
    <Exec Condition="'$(DllExportNoRestore)'!='true' And ('$(DllExportModImported)'!='true' Or !Exists('$(DllExportDir)packages\DllExport.1.8.1\tools\net.r_eg.DllExport.targets') Or !Exists('$(DllExportDir)packages\DllExport.1.8.1\gcache')) And Exists('$(DllExportDir)DllExport.bat')" Command=".\DllExport.bat -action Restore -sln-dir &quot;$(SolutionDir)&quot; -sln-file &quot;$(SolutionPath)&quot;" WorkingDirectory="$(DllExportDir)" />
    <MSBuild Condition="'$(DllExportModImported)'!='true'" Projects="$(DllExportDir)packages\DllExport.1.8.1\tools\net.r_eg.DllExport.targets" Targets="DllExportMetaXBaseTarget" Properties="TargetFramework=$(TargetFramework)">
      <Output TaskParameter="TargetOutputs" PropertyName="DllExportMetaXBase" />
    </MSBuild>
    <ItemGroup>
      <Reference Include="DllExport, PublicKeyToken=8337224c9ad9e356">
        <HintPath>$(DllExportDir)packages\DllExport.1.8.1\gcache\$(DllExportMetaXBase)\$(DllExportNamespace)\$(DllExportMetaLibName)</HintPath>
        <Private>False</Private>
        <SpecificVersion>False</SpecificVersion>
      </Reference>
    </ItemGroup>
  </Target>
  <Target Name="DllExportRPkgDynamicImport" BeforeTargets="PostBuildEvent" DependsOnTargets="GetFrameworkPaths" Condition="'$(DllExportModImported)'!='true' And '$(DllExportRPkgDyn)'!='false'">
    <MSBuild BuildInParallel="true" UseResultsCache="true" Projects="$(MSBuildProjectFullPath)" Properties="Configuration=$(Configuration);DllExportRPkgDyn=true" Targets="Build" />
  </Target>
  <Target Name="InjectGitVersion" BeforeTargets="CoreCompile">
    <!-- 1. 获取最新 tag (如果有的话) 作为基础版本 -->
    <Exec Command="git describe --tags --abbrev=0" ConsoleToMSBuild="true" StandardOutputImportance="low" IgnoreExitCode="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="GitBaseVersion" />
    </Exec>
    <PropertyGroup>
      <!-- 如果没有Tag，默认设为 1.0.0 -->
      <GitBaseVersion Condition="'$(GitBaseVersion)' == '' Or $(GitBaseVersion.Contains('fatal'))">1.0.0</GitBaseVersion>
      <!-- 移除可能存在的 v 前缀 (例如把 v1.2 变成 1.2) -->
      <GitBaseVersion>$([System.Text.RegularExpressions.Regex]::Replace($(GitBaseVersion), `^v`, ``))</GitBaseVersion>
    </PropertyGroup>

    <!-- 2. 获取自上一个 Tag 之后的 Commit 数量 (如果 Tag=1.0.0, 这里算的就是 Patch 号) -->
    <Exec Command="git rev-list --count $(GitBaseVersion)..HEAD" ConsoleToMSBuild="true" StandardOutputImportance="low" IgnoreExitCode="true" Condition="'$(GitBaseVersion)' != '1.0.0'">
      <Output TaskParameter="ConsoleOutput" PropertyName="GitPatchCount" />
    </Exec>
    <!-- 如果连 Tag 都没有，就退化为使用全部 commit 数量 -->
    <Exec Command="git rev-list --count HEAD" ConsoleToMSBuild="true" StandardOutputImportance="low" IgnoreExitCode="true" Condition="'$(GitBaseVersion)' == '1.0.0' Or '$(GitPatchCount)' == '' Or $(GitPatchCount.Contains('fatal'))">
      <Output TaskParameter="ConsoleOutput" PropertyName="GitPatchCount" />
    </Exec>

    <!-- 3. 获取 Git 的简短 Commit Hash 和分支名 -->
    <Exec Command="git rev-parse --short HEAD" ConsoleToMSBuild="true" StandardOutputImportance="low" IgnoreExitCode="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="GitCommitHash" />
    </Exec>
    <Exec Command="git rev-parse --abbrev-ref HEAD" ConsoleToMSBuild="true" StandardOutputImportance="low" IgnoreExitCode="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="GitBranchName" />
    </Exec>

    <!-- 异常情况回退默认值 -->
    <PropertyGroup>
      <GitCommitHash Condition="'$(GitCommitHash)' == '' Or $(GitCommitHash.Contains('fatal'))">unknown</GitCommitHash>
      <GitBranchName Condition="'$(GitBranchName)' == '' Or $(GitBranchName.Contains('fatal'))">local</GitBranchName>
      <GitPatchCount Condition="'$(GitPatchCount)' == '' Or $(GitPatchCount.Contains('fatal'))">0</GitPatchCount>
    </PropertyGroup>

    <!-- 动态为程序集附加完整版本号属性 -->
    <ItemGroup>
      <!-- 标准版本号: Tag号.Patch级.0 (如: 1.2.3) -->
      <AssemblyAttributes Include="System.Reflection.AssemblyVersionAttribute">
        <_Parameter1>$(GitBaseVersion).$(GitPatchCount)</_Parameter1>
      </AssemblyAttributes>
      <AssemblyAttributes Include="System.Reflection.AssemblyFileVersionAttribute">
        <_Parameter1>$(GitBaseVersion).$(GitPatchCount)</_Parameter1>
      </AssemblyAttributes>
      <!-- Informational 详细版本: 1.2.3-master-a1b2c3d -->
      <AssemblyAttributes Include="System.Reflection.AssemblyInformationalVersionAttribute">
        <_Parameter1>$(GitBaseVersion).$(GitPatchCount)-$(GitBranchName)-$(GitCommitHash)</_Parameter1>
      </AssemblyAttributes>
    </ItemGroup>

    <WriteCodeFragment Language="C#" OutputFile="$(IntermediateOutputPath)VersionInfo.g.cs" AssemblyAttributes="@(AssemblyAttributes)" />
    <ItemGroup>
      <Compile Include="$(IntermediateOutputPath)VersionInfo.g.cs" />
    </ItemGroup>
  </Target>

</Project>