1+ <#
2+ . SYNOPSIS
3+ Reads a psd1 file with settings for the current diagram.
4+
5+ . DESCRIPTION
6+ Reads a psd1 file with settings for the current diagram. Should be called after a diagram has been opened or created.
7+ Currently supported sections are:
8+ StenciPaths - list of paths to be added to the stencilpath
9+ Stencils - hashtable with name=nickname of stencil, value=filename to stencil
10+ Shapes - hashtable with name=nickname, value=array with stencilname and mastername
11+ Containers - hashtable with name=nickname, value=array with stencilname and mastername
12+ Connectors - hashtable with name=nickname, value=hashtable of parameters splatted to register-visioconnector
13+
14+ . PARAMETER Path
15+ The path to the psd1 file. Must be a full path, not just a filename.
16+
17+
18+ . INPUTS
19+ You cannot pipe anything to Import-VisioSettings
20+
21+ . OUTPUTS
22+ None
23+
24+ . EXAMPLE
25+ Import-VisioSettings c:\Config\DepartmentalDiagramSettings.psd1
26+
27+
28+ #>
29+ function Import-VisioSettings {
30+ [CmdletBinding ()]
31+ Param ([string ]$path )
32+ $dir = Split-Path - Path $path - Parent
33+ $file = split-path - Path $path - leaf
34+ $settings = Import-LocalizedData - FileName $file - BaseDirectory $dir
35+ if ($settings.StencilPaths ){
36+ $settings.StencilPaths | foreach-object {Add-StencilSearchPath - Path $_ }
37+ }
38+
39+ if ($settings.Stencils ){
40+ $Settings.Stencils.GetEnumerator () | foreach {Register-VisioStencil - Name $_.Key - Path $_.Value }
41+ }
42+
43+ if ($settings.Shapes ){
44+ $Settings.Shapes.GetEnumerator () | foreach {Register-VisioShape - Name $_.Key - From $_.Value [0 ] - MasterName $_.Value [1 ]}
45+ }
46+ if ($settings.Containers ){
47+ $Settings.Containers.GetEnumerator () | foreach {Register-VisioContainer - Name $_.Key - From $_.Value [0 ] - MasterName $_.Value [1 ]}
48+ }
49+ if ($settings.Connectors ){
50+
51+ $Settings.Connectors.GetEnumerator () | foreach {$options = $_.Value ;Register-VisioConnector - Name $_.Key @options }
52+ }
53+
54+
55+ }
0 commit comments