@@ -19,17 +19,17 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.PowerShell.Host
1919 /// applications. Few members are actually implemented. Those that aren't throw a
2020 /// NotImplementedException.
2121 /// </summary>
22- internal class HostUserInterface : PSHostUserInterface
22+ class HostUserInterface : PSHostUserInterface
2323 {
2424 /// <summary>
2525 /// The private reference of the logger.
2626 /// </summary>
27- private RpcLogger _logger ;
27+ RpcLogger _logger ;
2828
2929 /// <summary>
3030 /// An instance of the PSRawUserInterface object.
3131 /// </summary>
32- private RawUserInterface RawUi = new RawUserInterface ( ) ;
32+ RawUserInterface RawUi = new RawUserInterface ( ) ;
3333
3434 /// <summary>
3535 /// Gets an instance of the PSRawUserInterface object for this host
@@ -50,10 +50,8 @@ public HostUserInterface(RpcLogger logger)
5050 /// <param name="descriptions">A collection of FieldDescription objects that
5151 /// describe each field of the prompt.</param>
5252 /// <returns>Throws a NotImplementedException exception because we don't need a prompt.</returns>
53- public override Dictionary < string , PSObject > Prompt ( string caption , string message , System . Collections . ObjectModel . Collection < FieldDescription > descriptions )
54- {
53+ public override Dictionary < string , PSObject > Prompt ( string caption , string message , System . Collections . ObjectModel . Collection < FieldDescription > descriptions ) =>
5554 throw new NotImplementedException ( "The method or operation is not implemented." ) ;
56- }
5755
5856 /// <summary>
5957 /// Provides a set of choices that enable the user to choose a single option from a set of options.
@@ -65,10 +63,8 @@ public override Dictionary<string, PSObject> Prompt(string caption, string messa
6563 /// <param name="defaultChoice">The index of the label in the Choices parameter
6664 /// collection. To indicate no default choice, set to -1.</param>
6765 /// <returns>Throws a NotImplementedException exception because we don't need a prompt.</returns>
68- public override int PromptForChoice ( string caption , string message , System . Collections . ObjectModel . Collection < ChoiceDescription > choices , int defaultChoice )
69- {
66+ public override int PromptForChoice ( string caption , string message , System . Collections . ObjectModel . Collection < ChoiceDescription > choices , int defaultChoice ) =>
7067 throw new NotImplementedException ( "The method or operation is not implemented." ) ;
71- }
7268
7369 /// <summary>
7470 /// Prompts the user for credentials with a specified prompt window caption,
@@ -79,10 +75,8 @@ public override int PromptForChoice(string caption, string message, System.Colle
7975 /// <param name="userName">The user name whose credential is to be prompted for.</param>
8076 /// <param name="targetName">The name of the target for which the credential is collected.</param>
8177 /// <returns>Throws a NotImplementedException exception because we don't need a prompt.</returns>
82- public override PSCredential PromptForCredential ( string caption , string message , string userName , string targetName )
83- {
78+ public override PSCredential PromptForCredential ( string caption , string message , string userName , string targetName ) =>
8479 throw new NotImplementedException ( "The method or operation is not implemented." ) ;
85- }
8680
8781 /// <summary>
8882 /// Prompts the user for credentials by using a specified prompt window caption,
@@ -98,40 +92,31 @@ public override PSCredential PromptForCredential(string caption, string message,
9892 /// <param name="options">A PSCredentialUIOptions constant that identifies the UI
9993 /// behavior when it gathers the credentials.</param>
10094 /// <returns>Throws a NotImplementedException exception because we don't need a prompt.</returns>
101- public override PSCredential PromptForCredential ( string caption , string message , string userName , string targetName , PSCredentialTypes allowedCredentialTypes , PSCredentialUIOptions options )
102- {
95+ public override PSCredential PromptForCredential ( string caption , string message , string userName , string targetName , PSCredentialTypes allowedCredentialTypes , PSCredentialUIOptions options ) =>
10396 throw new NotImplementedException ( "The method or operation is not implemented." ) ;
104- }
10597
10698 /// <summary>
10799 /// Reads characters that are entered by the user until a newline
108100 /// (carriage return) is encountered.
109101 /// </summary>
110102 /// <returns>Throws a NotImplemented exception because we are in a non-interactive experience.</returns>
111- public override string ReadLine ( )
112- {
103+ public override string ReadLine ( ) =>
113104 throw new NotImplementedException ( "The method or operation is not implemented." ) ;
114- }
115105
116106 /// <summary>
117107 /// Reads characters entered by the user until a newline (carriage return)
118108 /// is encountered and returns the characters as a secure string.
119109 /// </summary>
120110 /// <returns>Throws a NotImplemented exception because we are in a non-interactive experience.</returns>
121- public override System . Security . SecureString ReadLineAsSecureString ( )
122- {
111+ public override System . Security . SecureString ReadLineAsSecureString ( ) =>
123112 throw new NotImplementedException ( "The method or operation is not implemented." ) ;
124- }
125113
126114 /// <summary>
127115 /// Writes a new line character (carriage return) to the output display
128116 /// of the host.
129117 /// </summary>
130118 /// <param name="value">The characters to be written.</param>
131- public override void Write ( string value )
132- {
133- _logger . LogInformation ( value ) ;
134- }
119+ public override void Write ( string value ) => _logger . LogInformation ( value ) ;
135120
136121 /// <summary>
137122 /// Writes characters to the output display of the host with possible
@@ -140,48 +125,37 @@ public override void Write(string value)
140125 /// <param name="foregroundColor">The color of the characters.</param>
141126 /// <param name="backgroundColor">The backgound color to use.</param>
142127 /// <param name="value">The characters to be written.</param>
143- public override void Write ( ConsoleColor foregroundColor , ConsoleColor backgroundColor , string value )
144- {
145- // Just ignore the colors.
128+ public override void Write ( ConsoleColor foregroundColor , ConsoleColor backgroundColor , string value ) =>
146129 _logger . LogInformation ( value ) ;
147- }
148130
149131 /// <summary>
150132 /// Writes a debug message to the output display of the host.
151133 /// </summary>
152134 /// <param name="message">The debug message that is displayed.</param>
153- public override void WriteDebugLine ( string message )
154- {
135+ public override void WriteDebugLine ( string message ) =>
155136 _logger . LogDebug ( String . Format ( CultureInfo . CurrentCulture , "DEBUG: {0}" , message ) ) ;
156- }
157137
158138 /// <summary>
159139 /// Writes an error message to the output display of the host.
160140 /// </summary>
161141 /// <param name="value">The error message that is displayed.</param>
162- public override void WriteErrorLine ( string value )
163- {
142+ public override void WriteErrorLine ( string value ) =>
164143 _logger . LogError ( String . Format ( CultureInfo . CurrentCulture , "ERROR: {0}" , value ) ) ;
165- }
166144
167145 /// <summary>
168146 /// Writes a newline character (carriage return)
169147 /// to the output display of the host.
170148 /// </summary>
171- public override void WriteLine ( )
172- {
173- //do nothing because we don't need to log empty lines
174- }
149+ public override void WriteLine ( ) { } //do nothing because we don't need to log empty lines
175150
176151 /// <summary>
177152 /// Writes a line of characters to the output display of the host
178153 /// and appends a newline character(carriage return).
179154 /// </summary>
180155 /// <param name="value">The line to be written.</param>
181- public override void WriteLine ( string value )
182- {
156+ public override void WriteLine ( string value ) =>
183157 _logger . LogInformation ( value ) ;
184- }
158+
185159
186160 /// <summary>
187161 /// Writes a line of characters to the output display of the host
@@ -190,39 +164,30 @@ public override void WriteLine(string value)
190164 /// <param name="foregroundColor">The forground color of the display. </param>
191165 /// <param name="backgroundColor">The background color of the display. </param>
192166 /// <param name="value">The line to be written.</param>
193- public override void WriteLine ( ConsoleColor foregroundColor , ConsoleColor backgroundColor , string value )
194- {
195- // Write to the log, ignore the colors
167+ public override void WriteLine ( ConsoleColor foregroundColor , ConsoleColor backgroundColor , string value ) =>
196168 _logger . LogInformation ( value ) ;
197- }
198169
199170 /// <summary>
200171 /// Writes a progress report to the output display of the host.
201172 /// </summary>
202173 /// <param name="sourceId">Unique identifier of the source of the record. </param>
203174 /// <param name="record">A ProgressReport object.</param>
204- public override void WriteProgress ( long sourceId , ProgressRecord record )
205- {
175+ public override void WriteProgress ( long sourceId , ProgressRecord record ) =>
206176 _logger . LogTrace ( String . Format ( CultureInfo . CurrentCulture , "PROGRESS: {0}" , record . StatusDescription ) ) ;
207- }
208177
209178 /// <summary>
210179 /// Writes a verbose message to the output display of the host.
211180 /// </summary>
212181 /// <param name="message">The verbose message that is displayed.</param>
213- public override void WriteVerboseLine ( string message )
214- {
182+ public override void WriteVerboseLine ( string message ) =>
215183 _logger . LogTrace ( String . Format ( CultureInfo . CurrentCulture , "VERBOSE: {0}" , message ) ) ;
216- }
217184
218185 /// <summary>
219186 /// Writes a warning message to the output display of the host.
220187 /// </summary>
221188 /// <param name="message">The warning message that is displayed.</param>
222- public override void WriteWarningLine ( string message )
223- {
189+ public override void WriteWarningLine ( string message ) =>
224190 _logger . LogWarning ( String . Format ( CultureInfo . CurrentCulture , "WARNING: {0}" , message ) ) ;
225- }
226191 }
227192}
228193
0 commit comments