Permalink
Browse files

Updated PowerShell scripts to work with the Beaver Music application

  • Loading branch information...
1 parent 766317e commit 33732f14a5ac5756501de11da32a6a82a89bb99f @dfinke committed May 31, 2012
@@ -1,16 +1,16 @@
-cls
-
-.\Add-RoslynLibraries
-
-$slnFileName = Resolve-Path "..\..\C#\BeaverMusic\BeaverMusic.sln"
-
-$result = ForEach ($Project in ([Roslyn.Services.Solution]::Load($slnFileName)).Projects) {
- ForEach($Document in $Project.DocumentIds) {
- New-Object PSObject -Property @{
- Filename = Split-Path $Document.FileName -leaf
- ProjectName = $Project.DisplayName
- }
- }
-}
-
+cls
+
+.\Add-RoslynLibraries
+
+$slnFileName = Resolve-Path "..\chapter05\BeaverMusic\BeaverMusic.sln"
+
+$result = ForEach ($Project in ([Roslyn.Services.Solution]::Load($slnFileName)).Projects) {
+ ForEach($Document in $Project.DocumentIds) {
+ New-Object PSObject -Property @{
+ Filename = Split-Path $Document.FileName -leaf
+ ProjectName = $Project.DisplayName
+ }
+ }
+}
+
$result | Format-Table -AutoSize
@@ -1,13 +1,13 @@
-.\Add-RoslynLibraries
-
-$slnFileName = Resolve-Path "..\..\C#\BeaverMusic\BeaverMusic.sln"
-
-$FirstProject = ([Roslyn.Services.Solution]::Load($slnFileName)).Projects |
- Select -First 1
-
-$FirstDocument = $FirstProject.Documents |
- Select -First 1
-
-$cancelToken = New-Object System.Threading.CancellationToken
-$Root = $FirstDocument.GetSyntaxTree($cancelToken).Root
+.\Add-RoslynLibraries
+
+$slnFileName = Resolve-Path "..\chapter05\BeaverMusic\BeaverMusic.sln"
+
+$FirstProject = ([Roslyn.Services.Solution]::Load($slnFileName)).Projects |
+ Select -First 1
+
+$FirstDocument = $FirstProject.Documents |
+ Select -First 1
+
+$cancelToken = New-Object System.Threading.CancellationToken
+$Root = $FirstDocument.GetSyntaxTree($cancelToken).Root
$Root.Usings | Select name
View
@@ -1,16 +1,16 @@
-cls
-
-Add-Type -Path "c:\Program Files\Reference Assemblies\Microsoft\Roslyn\v1.0\Roslyn.Services.dll"
-
-$slnFileName = "..\..\C#\BeaverMusic\BeaverMusic.sln"
-
-$result = ForEach ($Project in ([Roslyn.Services.Solution]::Load($slnFileName)).Projects) {
- ForEach($Document in $Project.DocumentIds) {
- New-Object PSObject -Property @{
- Filename = Split-Path $Document.FileName -leaf
- ProjectName = $Project.DisplayName
- }
- }
-}
-
+cls
+
+.\Add-RoslynLibraries
+
+$slnFileName = Resolve-Path "..\chapter05\BeaverMusic\BeaverMusic.sln"
+
+$result = ForEach ($Project in ([Roslyn.Services.Solution]::Load($slnFileName)).Projects) {
+ ForEach($Document in $Project.DocumentIds) {
+ New-Object PSObject -Property @{
+ Filename = Split-Path $Document.FileName -leaf
+ ProjectName = $Project.DisplayName
+ }
+ }
+}
+
$result | Format-Table -AutoSize
View
@@ -1,6 +1,6 @@
-cls
-
-Add-Type -Path "c:\Program Files\Reference Assemblies\Microsoft\Roslyn\v1.0\Roslyn.Services.dll"
-$slnFileName = Resolve-Path "..\..\C#\BeaverMusic\BeaverMusic.sln"
-
-[Roslyn.Services.Solution]::Load($slnFileName)
+cls
+
+.\Add-RoslynLibraries
+$slnFileName = Resolve-Path "..\chapter05\BeaverMusic\BeaverMusic.sln"
+
+[Roslyn.Services.Solution]::Load($slnFileName)
View
@@ -1,7 +1,7 @@
-cls
-
-.\Add-RoslynLibraries.ps1
-
-$slnFileName = Resolve-Path "..\..\C#\BeaverMusic\BeaverMusic.sln"
-
+cls
+
+.\Add-RoslynLibraries.ps1
+
+$slnFileName = Resolve-Path "..\chapter05\BeaverMusic\BeaverMusic.sln"
+
[Roslyn.Services.Solution]::Load($slnFileName)
View
@@ -1,27 +1,27 @@
-$RoslynLibraries = "Roslyn.Compilers.dll", "Roslyn.Services.dll"
-
-$RoslynLibraries |
- ForEach {
- $dll = Join-Path "Reference Assemblies\Microsoft\Roslyn\v1.0" $_
- .\Add-RoslynLibraries $dll
- }
-
-function Get-NullCancellationToken { New-Object System.Threading.CancellationToken }
-
-function Get-SLNProject {
- param (
- [Parameter(ValueFromPipeline=$true)]
- [string]
- $solution
- )
-
- Process {
- if( ! (Test-Path $solution) ) {
- throw "$solution not found"
- }
-
- [Roslyn.Services.Solution]::Load($solution).Projects
- }
-}
-
-Get-SLNProject ..\..\C#\BeaverMusic\BeaverMusic.sln
+$RoslynLibraries = "Roslyn.Compilers.dll", "Roslyn.Services.dll"
+
+$RoslynLibraries |
+ ForEach {
+ $dll = Join-Path "Reference Assemblies\Microsoft\Roslyn\v1.0" $_
+ .\Add-RoslynLibraries $dll
+ }
+
+function Get-NullCancellationToken { New-Object System.Threading.CancellationToken }
+
+function Get-SLNProject {
+ param (
+ [Parameter(ValueFromPipeline=$true)]
+ [string]
+ $solution
+ )
+
+ Process {
+ if( ! (Test-Path $solution) ) {
+ throw "$solution not found"
+ }
+
+ [Roslyn.Services.Solution]::Load($solution).Projects
+ }
+}
+
+Get-SLNProject (Resolve-Path ..\chapter05\BeaverMusic\BeaverMusic.sln)
@@ -1,6 +1,12 @@
-$dll = "C:\Program Files\Reference Assemblies\Microsoft\Roslyn\v1.0\Roslyn.Services.dll"
-
-Add-Type -Path $dll -PassThru |
- Where {$_.IsPublic -And $_.BaseType} | Sort Name
-
+$roslyn = "Reference Assemblies\Microsoft\Roslyn\v1.0\Roslyn.Services.dll"
+
+$dll = Join-Path $env:ProgramFiles $roslyn
+
+if(-not (Test-Path $dll)) {
+ $dll = Join-Path ${env:ProgramFiles(x86)} $roslyn
+}
+
+Add-Type -Path $dll -PassThru |
+ Where {$_.IsPublic -And $_.BaseType} | Sort Name
+
[Roslyn.Services.Solution] | Get-Member -Static
View
@@ -1,23 +1,23 @@
-param (
- $targetDirectory="..\..\C#\BeaverMusic"
-)
-
-
-Import-Module ShowUI
-
-New-Window -Title "PowerShell/Rosyln Class Viewer" -WindowStartupLocation CenterScreen -Height 500 -Width 800 -Show {
- Grid -Columns 50*, 100*{
-
- ListBox -Column 0 -Margin 5 `
- -DataContext ( . .\GetCSharpClass.ps1 $targetDirectory | Sort Name) `
- -DataBinding @{ItemsSource = "."} `
- -DisplayMemberPath 'Name' `
- -On_SelectionChanged {
- $TB.Text = $this.SelectedItem.Class.Parent.ToString().Trim()
- }
-
- TextBox -Column 1 -Margin 5 -Name TB `
- -IsReadOnly -VerticalScrollBarVisibility Auto `
- -HorizontalScrollBarVisibility Auto
- }
+param (
+ $targetDirectory="..\chapter05\BeaverMusic"
+)
+
+
+Import-Module ShowUI
+
+New-Window -Title "PowerShell/Rosyln Class Viewer" -WindowStartupLocation CenterScreen -Height 500 -Width 800 -Show {
+ Grid -Columns 50*, 100*{
+
+ ListBox -Column 0 -Margin 5 `
+ -DataContext ( . .\GetCSharpClass.ps1 $targetDirectory | Sort Name) `
+ -DataBinding @{ItemsSource = "."} `
+ -DisplayMemberPath 'Name' `
+ -On_SelectionChanged {
+ $TB.Text = $this.SelectedItem.Class.Parent.ToString().Trim()
+ }
+
+ TextBox -Column 1 -Margin 5 -Name TB `
+ -IsReadOnly -VerticalScrollBarVisibility Auto `
+ -HorizontalScrollBarVisibility Auto
+ }
}
@@ -1,7 +1,7 @@
-cls
-
-.\Add-RoslynLibraries.ps1
-
-$slnFileName = Resolve-Path "..\..\C#\BeaverMusic\BeaverMusic.sln"
-
+cls
+
+.\Add-RoslynLibraries.ps1
+
+$slnFileName = Resolve-Path "..\chapter05\BeaverMusic\BeaverMusic.sln"
+
[Roslyn.Services.Solution]::Load($slnFileName).Projects | Select -First 1
@@ -1,12 +1,12 @@
-.\Add-RoslynLibraries
-
-$slnFileName = Resolve-Path "..\..\C#\BeaverMusic\BeaverMusic.sln"
-
-$FirstProject = ([Roslyn.Services.Solution]::Load($slnFileName)).Projects |
- Select -First 1
-
-$FirstDocument = $FirstProject.Documents |
- Select -First 1
-
-$cancelToken = New-Object System.Threading.CancellationToken
+.\Add-RoslynLibraries
+
+$slnFileName = Resolve-Path "..\chapter05\BeaverMusic\BeaverMusic.sln"
+
+$FirstProject = ([Roslyn.Services.Solution]::Load($slnFileName)).Projects |
+ Select -First 1
+
+$FirstDocument = $FirstProject.Documents |
+ Select -First 1
+
+$cancelToken = New-Object System.Threading.CancellationToken
$FirstDocument.GetSyntaxTree($cancelToken).Root

0 comments on commit 33732f1

Please sign in to comment.