DSCResources/SynergyLicensing/SynergyLicensing.psm1

DATA localizedData
{
    #culture en-US

}

# Import the common Synergy functions
Import-Module -Name ( Join-Path `
    -Path(Split-Path -Path $PSSCriptRoot -Parent) `
    -ChildPath '\SynergyInstallCommon\SynergyInstallCommon.psm1')

function Install_Synergy_License
{
    [CmdletBinding()]
    param
    (
        [ValidateSet('Present', 'Absent')]
        [String]
        $Ensure = 'Present',
        
        # Should the an existing license server be used OR will a Synergy .skf file be installed locally
        [Parameter(Mandatory = $true)]
        [ValidateSet('Server', 'SKF')]
        [String]
        $LicenseType = 'SKF',

        # Existing license server name
        [Parameter()]
        [String]
        $ServerName = '',

        # Existing license server port number
        [Parameter()]
        [int]
        $ServerPort = '2380',

        # Synergy .skf file path
        [Parameter()]
        [String]
        $SkfPath = '',
        
        # Synergy .skf file name
        [Parameter()]
        [String]
        $SkfFile = ''
    )
    
    $argString = ""
    if ($LicenseType -eq "SKF")
    {
        $argString += "-f "
        $argString += $SkfPath
        $argString += "\"
        $argString += $SkfFile
    }
    if ($LicenseType -eq "Server")
    {
        $argString += "-c "
        $argString += $ServerName
        $argString += ":"
        $argString += $ServerPort
    }
    $argString += " "
    $cmd = $env:SynergyDE64
    $cmd += "dbl\bin\lmu.exe"
    echo $cmd
    echo $argString
    #Not sure about how to execute the lmu command from here
    Install-Synergy-Product -Name "LMU" -Path $cmd -ProductId 036E36C2-52E9-443D-81B7-EE3B69787565 -Arguments $argString
    # Install_Synergy_License -Path $cmd -ProductId 036E36C2-52E9-443D-81B7-EE3B69787565 -Arguments $argString
}

Export-ModuleMember -Function *Synergy_License