<# FPS:Containers:Make:SN-Initialize-DataResources-Locations:ACTIVE #>

 

<#

.DESCRIPTION

Module: Make

Core Snippet: SN-Initialize-DataResources-Locations

 

Initializes the calling Script, Encapsulation, etc. module Locations

 

.EXAMPLE

$overrideSrc = 'SN-Stub'

. (Get-ActiveFileNm -PS1 Initialize-DataResources-Locations)

 

.CC

 

[2024.11.06 JD] Integrated ConvertTo-DotFill for use with the Show shortcut

[2024.11.05 JD] Integrated $showBuff for use with the Show shortcut

[2024.10.10 JD] Added KeePass Open entries

[2024.09.29 JD] Removed hooked int testing attributes.  Use shortcut Show to retrieve values.

[2024.09.25 JD] Original code release.

 

.NOTES

 

To test the locations configured

 

Show -DataResources

 

 

#>

 

if ($overrideSrc -gt "") {

    $drcCallingCode = $overrideSrc

} else {

    $drcCallingCode = $PSCmdlet.MyInvocation.MyCommand.Name

}

 

# Some overrides will use the full filename, but for shortcuts we only want the shortcut name

if ($drcCallingCode -like 'SC-*') { $drcCallingCode = $drcCallingCode.replace('SC-','') }

 

if ($drcCallingCode -ne 'Show') {

    # Logs are used quite a bit in DataResources, so lets just create the logfile rather than repeating

    # within the switch statement.  Also, combine keepass entries in one place so the progression of use

    # can be derived.

    if ($drcCallingCode -in ("SN-OpenKP","SN-CloseKP","Get-KeePass","Put-KeePass")) {

        $drcLoc_Logs = $global:pro_CIBase.RuntimeLogs+"\DataResources\$YYYY-KeePass\$MM"

        $drcLoc_Logs += '\'+$DD+'-Log.txt'

    } else {

        $drcLoc_Logs = $global:pro_CIBase.RuntimeLogs+"\DataResources\$YYYY-$drcCallingCode\$MM"

        $drcLoc_Logs += '\'+$DD+'-Log.txt'

    }

 

    $showBuff += (ConvertTo-DotFill $global:ShowDotLen ($drcCallingCode+' Logs: $drcLoc_Logs'))+$drcLoc_Logs+'|'

 

    switch ($drcCallingCode) {

 

        # Shortcuts - Only use shortcut name

        'KPXtract'         {  

 

                                $drcLoc_KPPath = $global:pro_CI.SourceDrive+'\FPS\Collections\KeePass'

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('SC-KPXtract: $drcLoc_KPPath'))+$drcLoc_KPPath+'|'

 

 

                                $drcLoc_KPXML = $drcLoc_KPPath+'\DBExportToXml.xml'                   

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('SC-KPXtract: $drcLoc_KPXML'))+$drcLoc_KPXML+'|'

 

 

                            }   

       

        # Snippets

        'SN-OpenKP'         {

 

                                $drcLoc_KPPath = $global:pro_CI.SourceDrive+'\FPS\Collections\KeePass'

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('SN-OpenKP: $drcLoc_KPPath'))+$drcLoc_KPPath+'|'

 

 

                                $drcLoc_KPDB = $drcLoc_KPPath+'\KPDB.kdbx'

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('SN-OpenKP: $drcLoc_KPDB'))+$drcLoc_KPDB+'|'

 

 

                                $drcLoc_KPexe = 'C:\Program Files\KeePass Password Safe 2\KeePass.exe'

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('SN-OpenKP: $drcLoc_KPexe'))+$drcLoc_KPexe+'|'

 

                                # The key resides on the source and the password resides on the CI

                                $drcLoc_KeyPath = $global:pro_CI.SourceDrive+"\FPS\Collections\KeePass\securekey-enckey.txt"

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('SN-OpenKP: $drcLoc_KeyPath'))+$drcLoc_KeyPath+'|'

 

 

                                $drcLoc_PassPath = $global:pro_CIBase.RuntimeCollections+"\KeePass\securekey-encpass.txt"

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('SN-OpenKP: $drcLoc_PassPath'))+$drcLoc_PassPath+'|'

 

 

                            }

 

        # CmdLets

        'Get-KeePass'       {  

 

                                $drcLoc_RuntimeImagePath = $global:pro_CIBase.RuntimeCollections+"\Images"

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('Get-KeePass: $drcLoc_RuntimeImagePath'))+$drcLoc_RuntimeImagePath+'|'

 

                                $drcLoc_SourceImagePath = $global:pro_CI.SourceDrive+"\FPS\Collections\Images"

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('Get-KeePass: $drcLoc_SourceImagePath'))+$drcLoc_SourceImagePath+'|'

                            }

        'Put-KeePass'       {  

 

                                $drcLoc_ScratchPath = Mount-Path($global:pro_CIBase.RuntimeScratch+"\DataResources\Put-KeePass")

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('Put-KeePass: $drcLoc_ScratchPath'))+$drcLoc_ScratchPath+'|'

 

                                $drcLoc_RuntimeImagePath = $global:pro_CIBase.RuntimeCollections+"\Images"

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('Put-KeePass: $drcLoc_RuntimeImagePath'))+$drcLoc_RuntimeImagePath+'|'

 

                                $drcLoc_SourceImagePath = $global:pro_CI.SourceDrive+"\FPS\Collections\Images"

                                $showBuff += (ConvertTo-DotFill $global:ShowDotLen ('Put-KeePass: $drcLoc_SourceImagePath'))+$drcLoc_SourceImagePath+'|'

 

                            }

 

 

        default { if ($drcPrintValue -gt "") { Write-Host "$drcCallingCode is not a configured option" } }

    }

}