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