Fix warnings, update version format, organize DLLs in subfolder, and use System.Reflection.Assembly::LoadBytes

This commit is contained in:
GraceSolutions
2025-04-14 22:57:09 -04:00
parent afcb6dbbfa
commit bfbc031a76
15 changed files with 49 additions and 12 deletions
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
@{
RootModule = 'PSOPNSenseAPI.dll'
ModuleVersion = '2025.04.14.2246'
RootModule = 'PSOPNSenseAPI.psm1'
ModuleVersion = '2025.04.14.2253'
GUID = '1f0e4b77-cc7c-4a1e-b45a-d7c51a3c562e'
Author = 'PSOPNSenseAPI Contributors'
CompanyName = 'PSOPNSenseAPI'
+25
View File
@@ -0,0 +1,25 @@
# Load assemblies from the lib folder using System.Reflection.Assembly::LoadBytes
# This avoids file lock issues when the module is loaded
$libPath = Join-Path $PSScriptRoot "lib"
$dllFiles = Get-ChildItem -Path $libPath -Filter "*.dll"
foreach ($dll in $dllFiles) {
try {
$dllBytes = [System.IO.File]::ReadAllBytes($dll.FullName)
[System.Reflection.Assembly]::Load($dllBytes) | Out-Null
Write-Verbose "Loaded assembly: $($dll.Name)"
}
catch {
Write-Warning "Failed to load assembly $($dll.Name): $_"
}
}
# Export all cmdlets
$cmdlets = [System.AppDomain]::CurrentDomain.GetAssemblies() |
Where-Object { $_.FullName -like "*PSOPNSenseAPI*" } |
ForEach-Object { $_.GetTypes() } |
Where-Object { $_.IsPublic -and $_.IsClass -and $_.Name -like "*Cmdlet" } |
ForEach-Object { $_.Name }
Export-ModuleMember -Cmdlet $cmdlets
+12
View File
@@ -0,0 +1,12 @@
## What's New
### Added
- Port forwarding management (Get, New, Set, Remove)
- Added unit tests for interface management
### Changed
- Updated IPNetwork2 library from version 2.6.618 to 3.1.764
- Updated code to use the new namespace (System.Net) for IPNetwork2
- Added support for .NET 8.0 and .NET 9.0
- Improved XML documentation for all classes and methods
- Made OPNSenseApiClient more testable by introducing an interface