mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
26 lines
955 B
PowerShell
26 lines
955 B
PowerShell
|
|
function Test-IcingaForWindowsComponentPublicFunctions()
|
||
|
|
{
|
||
|
|
param (
|
||
|
|
$FileObject = $null,
|
||
|
|
[string]$ModuleName = ''
|
||
|
|
);
|
||
|
|
|
||
|
|
if ($null -eq $FileObject -Or [string]::IsNullOrEmpty($ModuleName)) {
|
||
|
|
return $FALSE;
|
||
|
|
}
|
||
|
|
|
||
|
|
# If we load the main .psm1 file of this module, add all functions inside to the public space
|
||
|
|
if ($FileObject.Name -eq ([string]::Format('{0}.psm1', $ModuleName))) {
|
||
|
|
return $TRUE;
|
||
|
|
}
|
||
|
|
|
||
|
|
[int]$RelativPathStartIndex = $FileObject.FullName.IndexOf($ModuleName) + $ModuleName.Length;
|
||
|
|
$ModuleFileRelativePath = $FileObject.FullName.SubString($RelativPathStartIndex, $FileObject.FullName.Length - $RelativPathStartIndex);
|
||
|
|
|
||
|
|
if ($ModuleFileRelativePath.Contains('\public\') -Or $ModuleFileRelativePath.Contains('\plugins\') -Or $ModuleFileRelativePath.Contains('\endpoint\') -Or $ModuleFileRelativePath.Contains('\daemon\')) {
|
||
|
|
return $TRUE;
|
||
|
|
}
|
||
|
|
|
||
|
|
return $FALSE;
|
||
|
|
}
|