mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Add test function for add type
This commit is contained in:
parent
25d539e1f8
commit
23041ef59f
2 changed files with 20 additions and 0 deletions
|
|
@ -11,6 +11,8 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
|
||||
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/15?closed=1)
|
||||
|
||||
* [#305](https://github.com/Icinga/icinga-powershell-framework/pull/305) Adds a new Cmdlet to test if functions with `Add-Type` are already present inside the current scope of the shell
|
||||
|
||||
## 1.5.2 (2021-07-09)
|
||||
|
||||
### Security Fixes
|
||||
|
|
|
|||
18
lib/core/tools/Test-IcingaAddTypeExist.psm1
Normal file
18
lib/core/tools/Test-IcingaAddTypeExist.psm1
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function Test-IcingaAddTypeExist()
|
||||
{
|
||||
param (
|
||||
[string]$Type = $null
|
||||
);
|
||||
|
||||
if ([string]::IsNullOrEmpty($Type)) {
|
||||
return $FALSE;
|
||||
}
|
||||
|
||||
foreach ($entry in [System.AppDomain]::CurrentDomain.GetAssemblies()) {
|
||||
if ($entry.GetTypes() -Match $Type) {
|
||||
return $TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return $FALSE;
|
||||
}
|
||||
Loading…
Reference in a new issue