<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--Based on SQLite .targets file-->
  <!--Library Build Items-->
  <ItemGroup>
    <YaraSharpFiles Condition="'$(MSBuildThisFileDirectory)' != '' And HasTrailingSlash('$(MSBuildThisFileDirectory)')"
                        Include="$(MSBuildThisFileDirectory)**\YaraSharp.*" />
  </ItemGroup>

  <!--Library Content Items-->
  <ItemGroup Condition="'$(ContentYaraSharpFiles)' != '' And '$(ContentYaraSharpFiles)' != 'false' And '@(YaraSharpFiles)' != ''">
    <Content Include="@(YaraSharpFiles)">
      <Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <!--Library Build Targets-->
  <Target Name="CopyYaraSharpFiles" Condition="'$(CopyYaraSharpFiles)' != 'false' And '$(OutDir)' != '' And HasTrailingSlash('$(OutDir)') And Exists('$(OutDir)')"
          Inputs="@(YaraSharpFiles)" Outputs="@(YaraSharpFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')">
    <Copy SourceFiles="@(YaraSharpFiles)" DestinationFiles="@(YaraSharpFiles -> '$(OutDir)lib\%(RecursiveDir)%(Filename)%(Extension)')" />
  </Target>

  <Target Name="CleanYaraSharpFiles" Condition="'$(CleanYaraSharpFiles)' != 'false' And '$(OutDir)' != '' And HasTrailingSlash('$(OutDir)') And Exists('$(OutDir)')">
    <Delete Files="@(YaraSharpFiles -> '$(OutDir)lib\%(RecursiveDir)%(Filename)%(Extension)')" />
  </Target>


  <!--Library Build Properties-->
  <PropertyGroup>
    <PostBuildEventDependsOn>
      $(PostBuildEventDependsOn);
      CopyYaraSharpFiles;
    </PostBuildEventDependsOn>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyYaraSharpFiles;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanYaraSharpFiles;
    </CleanDependsOn>
  </PropertyGroup>
</Project>
