4
4
#
5
5
6
6
if (! $PSVersionTable.PSEdition -or $PSVersionTable.PSEdition -eq " Desktop" ) {
7
- Add-Type - Path " $PSScriptRoot /bin/Desktop/Microsoft.PowerShell.EditorServices.dll"
8
- Add-Type - Path " $PSScriptRoot /bin/Desktop/Microsoft.PowerShell.EditorServices.Host.dll"
7
+ Microsoft.PowerShell. Utility\ Add-Type - Path " $PSScriptRoot /bin/Desktop/Microsoft.PowerShell.EditorServices.dll"
8
+ Microsoft.PowerShell. Utility\ Add-Type - Path " $PSScriptRoot /bin/Desktop/Microsoft.PowerShell.EditorServices.Host.dll"
9
9
}
10
10
else {
11
- Add-Type - Path " $PSScriptRoot /bin/Core/Microsoft.PowerShell.EditorServices.dll"
12
- Add-Type - Path " $PSScriptRoot /bin/Core/Microsoft.PowerShell.EditorServices.Protocol.dll"
13
- Add-Type - Path " $PSScriptRoot /bin/Core/Microsoft.PowerShell.EditorServices.Host.dll"
11
+ Microsoft.PowerShell. Utility\ Add-Type - Path " $PSScriptRoot /bin/Core/Microsoft.PowerShell.EditorServices.dll"
12
+ Microsoft.PowerShell. Utility\ Add-Type - Path " $PSScriptRoot /bin/Core/Microsoft.PowerShell.EditorServices.Protocol.dll"
13
+ Microsoft.PowerShell. Utility\ Add-Type - Path " $PSScriptRoot /bin/Core/Microsoft.PowerShell.EditorServices.Host.dll"
14
14
}
15
15
16
16
function Start-EditorServicesHost {
@@ -75,10 +75,14 @@ function Start-EditorServicesHost {
75
75
)
76
76
77
77
$editorServicesHost = $null
78
- $hostDetails = New-Object Microsoft.PowerShell.EditorServices.Session.HostDetails @ ($HostName , $HostProfileId , (New-Object System.Version @ ($HostVersion )))
78
+ $hostDetails =
79
+ Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Session.HostDetails @ (
80
+ $HostName ,
81
+ $HostProfileId ,
82
+ (Microsoft.PowerShell.Utility\New-Object System.Version @ ($HostVersion )))
79
83
80
84
$editorServicesHost =
81
- New-Object Microsoft.PowerShell.EditorServices.Host.EditorServicesHost @ (
85
+ Microsoft.PowerShell. Utility\ New-Object Microsoft.PowerShell.EditorServices.Host.EditorServicesHost @ (
82
86
$hostDetails ,
83
87
$BundledModulesPath ,
84
88
$EnableConsoleRepl.IsPresent ,
@@ -87,15 +91,19 @@ function Start-EditorServicesHost {
87
91
$FeatureFlags )
88
92
89
93
# Build the profile paths using the root paths of the current $profile variable
90
- $profilePaths = New-Object Microsoft.PowerShell.EditorServices.Session.ProfilePaths @ (
91
- $hostDetails.ProfileId ,
92
- [System.IO.Path ]::GetDirectoryName($profile.AllUsersAllHosts ),
93
- [System.IO.Path ]::GetDirectoryName($profile.CurrentUserAllHosts ));
94
+ $profilePaths =
95
+ Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Session.ProfilePaths @ (
96
+ $hostDetails.ProfileId ,
97
+ [System.IO.Path ]::GetDirectoryName($profile.AllUsersAllHosts ),
98
+ [System.IO.Path ]::GetDirectoryName($profile.CurrentUserAllHosts ))
94
99
95
100
$editorServicesHost.StartLogging ($LogPath , $LogLevel );
96
101
97
- $languageServiceConfig = New-Object Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportConfig
98
- $debugServiceConfig = New-Object Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportConfig
102
+ $languageServiceConfig =
103
+ Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportConfig
104
+
105
+ $debugServiceConfig =
106
+ Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportConfig
99
107
100
108
if ($Stdio.IsPresent ) {
101
109
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportType ]::Stdio
@@ -143,23 +151,24 @@ function Compress-LogDir {
143
151
144
152
begin {
145
153
function LegacyZipFolder ($Path , $ZipPath ) {
146
- if (! (Test-Path ($ZipPath ))) {
147
- Set-Content - LiteralPath $ZipPath - Value (" PK" + [char ]5 + [char ]6 + (" $ ( [char ]0 ) " * 18 ))
148
- (Get-Item $ZipPath ).IsReadOnly = $false
154
+ if (! (Microsoft.PowerShell.Management\Test-Path ($ZipPath ))) {
155
+ $zipMagicHeader = " PK" + [char ]5 + [char ]6 + (" $ ( [char ]0 ) " * 18 )
156
+ Microsoft.PowerShell.Management\Set-Content - LiteralPath $ZipPath - Value $zipMagicHeader
157
+ (Microsoft.PowerShell.Management\Get-Item $ZipPath ).IsReadOnly = $false
149
158
}
150
159
151
- $shellApplication = New-Object - ComObject Shell.Application
160
+ $shellApplication = Microsoft.PowerShell. Utility\ New-Object - ComObject Shell.Application
152
161
$zipPackage = $shellApplication.NameSpace ($ZipPath )
153
162
154
- foreach ($file in (Get-ChildItem - LiteralPath $Path )) {
163
+ foreach ($file in (Microsoft.PowerShell. Management\ Get-ChildItem - LiteralPath $Path )) {
155
164
$zipPackage.CopyHere ($file.FullName )
156
165
Start-Sleep - MilliSeconds 500
157
166
}
158
167
}
159
168
}
160
169
161
170
end {
162
- $zipPath = ((Convert-Path $Path ) -replace ' (\\|/)$' , ' ' ) + " .zip"
171
+ $zipPath = ((Microsoft.PowerShell. Management\ Convert-Path $Path ) -replace ' (\\|/)$' , ' ' ) + " .zip"
163
172
164
173
if (Get-Command Microsoft.PowerShell.Archive\Compress-Archive ) {
165
174
if ($PSCmdlet.ShouldProcess ($zipPath , " Create ZIP" )) {
@@ -196,7 +205,7 @@ function Get-PowerShellEditorServicesVersion {
196
205
$versionInfo += " macOS $ ( lsb_release - d - s) $nl "
197
206
}
198
207
else {
199
- $osInfo = Get-CimInstance Win32_OperatingSystem
208
+ $osInfo = CimCmdlets\ Get-CimInstance Win32_OperatingSystem
200
209
$versionInfo += " Windows $ ( $osInfo.OSArchitecture ) $ ( $osInfo.Version ) $nl "
201
210
}
202
211
0 commit comments