<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <!-- build number: concat 2-digit year with 3-digit day of the year (16-bits until 2066) -->
        <MyBuildNumber>$([System.DateTime]::Now.ToString(`yy`))$([System.DateTime]::Now.DayOfYear.ToString(`000`))</MyBuildNumber>

        <!-- git revision -->
        <MyGitRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), .git/HEAD))</MyGitRoot>
        <MyGitHead Condition=" Exists('$(MyGitRoot)/.git/HEAD')">$([System.IO.File]::ReadAllText($(MyGitRoot)/.git/HEAD).Trim())</MyGitHead>
        <MyGitHead Condition="!Exists('$(MyGitRoot)/.git/HEAD')">0000000</MyGitHead>
        <MyGitRevision Condition="$(MyGitHead.StartsWith(ref: )) And  Exists('$(MyGitRoot)/.git/$(MyGitHead.Substring(5))')">$([System.IO.File]::ReadAllText($(MyGitRoot)/.git/$(MyGitHead.Substring(5))).Trim().Substring(0, 7))</MyGitRevision>
        <MyGitRevision Condition="$(MyGitHead.StartsWith(ref: )) And !Exists('$(MyGitRoot)/.git/$(MyGitHead.Substring(5))')">$([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText($(MyGitRoot)/.git/packed-refs)), '[0-9a-fA-F]{40,}.*$(MyGitHead.Substring(5))').Value.Substring(0, 7))</MyGitRevision>
        <MyGitRevision Condition="!$(MyGitHead.StartsWith(ref: ))">$(MyGitHead.Substring(0, 7))</MyGitRevision>

        <MyProductName>WinFsp</MyProductName>
        <MyProductFileName>winfsp</MyProductFileName>
        <MyDescription>Windows File System Proxy</MyDescription>
        <MyCompanyName>Navimatics LLC</MyCompanyName>
        <MyCopyright>2015-$([System.DateTime]::Now.ToString(`yyyy`)) Bill Zissimopoulos</MyCopyright>

        <MyCanonicalVersion>2.0</MyCanonicalVersion>

        <MyProductVersion>2023 Beta1</MyProductVersion>
        <MyProductStage>Beta</MyProductStage>

        <MyCrossCert>DigiCertGlobalG3CodeSigningECCSHA3842021CA1.cer</MyCrossCert>
        <MyCertIssuer>DigiCert</MyCertIssuer>

        <MyVersion>$(MyCanonicalVersion).$(MyBuildNumber)</MyVersion>
        <MyVersionWithCommas>$(MyVersion.Replace('.',',')),0</MyVersionWithCommas>
        <MyFullVersion>$(MyCanonicalVersion).$(MyBuildNumber).$(MyGitRevision)</MyFullVersion>

        <MyAssemblyPolicyVersion>$(MyCanonicalVersion.Substring(0,$(MyVersion.IndexOf('.')))).0</MyAssemblyPolicyVersion>
        <MyAssemblyVersion>$(MyAssemblyPolicyVersion).0.0</MyAssemblyVersion>

        <MyProductFileArch Condition="'$(Platform)'=='ARM64'">a64</MyProductFileArch>
        <MyProductFileArch Condition="'$(Platform)'=='x64'">x64</MyProductFileArch>
        <MyProductFileArch Condition="'$(Platform)'=='Win32'">x86</MyProductFileArch>

        <!-- When rebranding WinFsp you MUST change the following GUIDs - use VS "Create GUID" tool -->
        <MyFspFsctlDeviceClassGuid>{ 0x6f9d25fa, 0x6dee, 0x4a9d, { 0x80, 0xf5, 0xe9, 0x8e, 0x14, 0xf3, 0x5e, 0x54 } }</MyFspFsctlDeviceClassGuid>
        <MyFspFsvrtDeviceClassGuid>{ 0xb48171c3, 0xdd50, 0x4852, { 0x83, 0xa3, 0x34, 0x4c, 0x50, 0xd9, 0x3b, 0x17 } }</MyFspFsvrtDeviceClassGuid>

        <!--
            Configure paths used for registration via DllRegisterServer:

            - MyFsctlRegisterPath: File System Driver registration path
            - MyNpRegisterPath: Network Provider registration path
            - MyEventLogRegisterPath: Event Log registration path

            These paths are assumed to be relative to the location of the WinFsp DLL during
            registration: during DLLRegisterServer the DLL uses PathCombineW to combine its own
            location with these paths to produce the final locations to be used for registration.

            For example, if the DLL location is `C:\Program Files (x86)\WinFsp\bin\winfsp-x64.dll`:

            - Combining with the path "." will produce the original DLL location:
                `C:\Program Files (x86)\WinFsp\bin\winfsp-x64.dll`

            - Combining with the path "..\\NetworkProvider.dll" will produce:
                `C:\Program Files (x86)\WinFsp\bin\NetworkProvider.dll`

            - For Network Provider registrations only it is allowed to use environment variables
            in the path. For example combining the above DLL location with the path
            "..\\NetworkProvider-\x25PROCESSOR_ARCHITECTURE\x25.dll" will produce:
                `C:\Program Files (x86)\WinFsp\bin\NetworkProvider-%PROCESSOR_ARCHITECTURE%.dll`

            (Note that the \x25 escape sequence must be used otherwise the VS build system will
            try to interpret the string %PROCESSOR_ARCHITECTURE% as an environment variable during
            the build.)
        -->
        <MyFsctlRegisterPath>"."</MyFsctlRegisterPath>
        <MyNpRegisterPath>"."</MyNpRegisterPath>
        <MyEventLogRegisterPath>"."</MyEventLogRegisterPath>
    </PropertyGroup>
</Project>