ArielAuxFn.psm1

# # Helper functions for building the class
# # Add methods here
# Register-NativeMethod "user32.dll" "bool SetForegroundWindow(IntPtr hWnd)"
# Register-NativeMethod "user32.dll" "bool ShowWindowAsync(IntPtr hWnd, int nCmdShow)"

# # This builds the class and registers them (you can only do this one-per-session, as the type cannot be unloaded?)
# Add-NativeMethods

# And to use them:

# # (the Out-Null is just to throw away the return value)
# [NativeMethods]::SetForegroundWindow((Get-Process -name notepad).MainWindowHandle) | Out-Null
# [NativeMethods]::ShowWindowAsync((Get-Process -name notepad).MainWindowHandle, 2) | Out-Null


$script:nativeMethods = @();
function Register-NativeMethod([string]$dll, [string]$methodSignature) {
    $script:nativeMethods += [PSCustomObject]@{ Dll = $dll; Signature = $methodSignature; }
}
function Add-NativeMethods() {
    $nativeMethodsCode = $script:nativeMethods | ForEach-Object { "
        [DllImport(`"$($_.Dll)`")]
        public static extern $($_.Signature);
    "
 }

    Add-Type @"
        using System;
        using System.Runtime.InteropServices;
        public static class NativeMethods {
            $nativeMethodsCode
        }
"@

}

function Initialize-ArielAuxFn {
    [CmdletBinding()]
    param(
    )
    Begin {

    }
    Process {
        try {
            #region Module variables

            #endregion Module variables

            #region Return codes

            #endregion Return codes
        }
        catch {
            throw
        }
    }
    End {

    }
}

if (Test-Path -Path "$PSScriptRoot\Private\*.ps1") {
    Get-ChildItem -Path "$PSScriptRoot\Private\*.ps1" | ForEach-Object { . $_.FullName }
}
Get-ChildItem -Path "$PSScriptRoot\Public\*.ps1" | ForEach-Object { . $_.FullName }

#Export-ModuleMember -Function * -Alias *

#Initialize-ArielAuxFn