<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <EnableDynamicLoading>true</EnableDynamicLoading>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="Resources\**">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="NxEditor.PluginBase" Version="1.5.0">
      <Private>false</Private>
      <ExcludeAssets>runtime</ExcludeAssets>
    </PackageReference>
    <PackageReference Include="SarcLibrary" Version="3.1.2" />
    <PackageReference Include="ZstdSharp.Port" Version="0.7.6" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\lib\TotK-RstbCalculator\src\TotkRstbGenerator.Core\TotkRstbGenerator.Core.csproj" />
  </ItemGroup>

  <ItemGroup>
    <None Update="meta.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

  <!-- Copy build to plugins folder for quick debugging -->
  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <!-- Copy into plugins dir on anything that is not Windows, should work for both Linux & macOS -->
    <Exec Condition="!$([MSBuild]::IsOsPlatform('Windows'))" Command="mkdir -p $HOME/.local/share/nx-editor/plugins/$(TargetName)/" ContinueOnError="WarnAndContinue" />
    <Exec Condition="!$([MSBuild]::IsOsPlatform('Windows'))" Command="cp -R $(TargetDir)/* $HOME/.local/share/nx-editor/plugins/$(TargetName)/" ContinueOnError="WarnAndContinue" />

    <!-- Copy into plugins dir for Windows -->
    <Exec Condition="$([MSBuild]::IsOsPlatform('Windows'))" Command="xcopy &quot;$(TargetDir)\*.*&quot; &quot;%25APPDATA%25\nx-editor\plugins\$(TargetName)\&quot; /Y /E" ContinueOnError="WarnAndContinue" />
  </Target>

</Project>
