Skip to content

Commit

Permalink
use lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
yangcha committed Feb 4, 2015
1 parent 6a4d9e1 commit 5d2f458
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions modules/setvcenv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,8 @@ Param (
[string]$envars
)

#region Set of functions
function XmlWritePropertyGroup($conf) {
$xmlWriter.WriteStartElement('PropertyGroup')
$XmlWriter.WriteAttributeString('Condition', "'`$(Configuration)|`$(Platform)'=='$conf|$comparch'")
$xmlWriter.WriteElementString('LocalDebuggerEnvironment', $PathStr)
$xmlWriter.WriteElementString('DebuggerFlavor', 'WindowsLocalDebugger')
if($workdir) {
$xmlWriter.WriteElementString('LocalDebuggerWorkingDirectory', $workdir)
}
$xmlWriter.WriteEndElement()
}
#endregion

##### Main() #######
$encoding = [System.Text.Encoding]::UTF8
$XmlWriter = New-Object System.XMl.XmlTextWriter($userpath,$encoding)

# choose a pretty formatting:
$xmlWriter.Formatting = 'Indented'
$xmlWriter.Indentation = 2
Expand All @@ -45,9 +30,16 @@ if($envars) {
$PathStr = $PathStr + "`n" + ($envars -join ';')
}

foreach ($conf in $conftypes -split ';' ) {
XmlWritePropertyGroup $conf
}
$conftypes -split ';' | foreach {
$xmlWriter.WriteStartElement('PropertyGroup')
$XmlWriter.WriteAttributeString('Condition', "'`$(Configuration)|`$(Platform)'=='$_|$comparch'")
$xmlWriter.WriteElementString('LocalDebuggerEnvironment', $PathStr)
$xmlWriter.WriteElementString('DebuggerFlavor', 'WindowsLocalDebugger')
if($workdir) {
$xmlWriter.WriteElementString('LocalDebuggerWorkingDirectory', $workdir)
}
$xmlWriter.WriteEndElement()
}

# close the "Project" node:
$xmlWriter.WriteEndElement()
Expand Down

0 comments on commit 5d2f458

Please sign in to comment.