Showing the changes to Source/Libraries/GSF.ServiceProcess (6 of 12 files). Show all
Unified · Split
| @@ -394,13 +394,7 @@ namespace GSF.ServiceProcess · 393 unmodified lines | ||
| 394 | 394 | [Browsable(false), |
| 395 | 395 | EditorBrowsable(EditorBrowsableState.Never), |
| 396 | 396 | DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] |
| 397 | − public bool IsDisposed | |
| 398 | − { | |
| 399 | − get | |
| 400 | − { | |
| 401 | − return m_disposed; | |
| 402 | − } | |
| 403 | − } | |
| 397 | + public bool IsDisposed => m_disposed; | |
| 404 | 398 | |
| 405 | 399 | #endregion |
| 406 | 400 | |
| @@ -596,7 +590,7 @@ namespace GSF.ServiceProcess · 189 unmodified lines | ||
| 596 | 590 | else |
| 597 | 591 | { |
| 598 | 592 | // File does not exist. |
| 599 | − throw new FileNotFoundException(string.Format("File '{0}' does not exist", source)); | |
| 593 | + throw new FileNotFoundException($"File '{source}' does not exist"); | |
| 600 | 594 | } |
| 601 | 595 | } |
| 602 | 596 | |
| @@ -107,7 +107,7 @@ namespace GSF.ServiceProcess · 106 unmodified lines | ||
| 107 | 107 | if ((object)parent == null || string.IsNullOrEmpty(parent.Username) || string.IsNullOrEmpty(parent.Password)) |
| 108 | 108 | m_clientUserCredentials = string.Empty; |
| 109 | 109 | else |
| 110 | − m_clientUserCredentials = string.Format("{0}:{1}", parent.Username, parent.Password); | |
| 110 | + m_clientUserCredentials = $"{parent.Username}:{parent.Password}"; | |
| 111 | 111 | |
| 112 | 112 | // Initialize client application name. |
| 113 | 113 | if (m_clientType == ApplicationType.Web) |
| @@ -181,57 +181,27 @@ namespace GSF.ServiceProcess · 67 unmodified lines | ||
| 181 | 181 | /// <summary> |
| 182 | 182 | /// Gets the <see cref="ApplicationType"/> of the remote client application. |
| 183 | 183 | /// </summary> |
| 184 | − public ApplicationType ClientType | |
| 185 | − { | |
| 186 | − get | |
| 187 | − { | |
| 188 | − return m_clientType; | |
| 189 | − } | |
| 190 | − } | |
| 184 | + public ApplicationType ClientType => m_clientType; | |
| 191 | 185 | |
| 192 | 186 | /// <summary> |
| 193 | 187 | /// Gets the friendly name of the remote client application. |
| 194 | 188 | /// </summary> |
| 195 | − public string ClientName | |
| 196 | − { | |
| 197 | − get | |
| 198 | − { | |
| 199 | − return m_clientName; | |
| 200 | − } | |
| 201 | − } | |
| 189 | + public string ClientName => m_clientName; | |
| 202 | 190 | |
| 203 | 191 | /// <summary> |
| 204 | 192 | /// Gets the <see cref="IPrincipal"/> of the remote client application's user. |
| 205 | 193 | /// </summary> |
| 206 | − public IPrincipal ClientUser | |
| 207 | − { | |
| 208 | − get | |
| 209 | − { | |
| 210 | − return m_clientUser; | |
| 211 | − } | |
| 212 | − } | |
| 194 | + public IPrincipal ClientUser => m_clientUser; | |
| 213 | 195 | |
| 214 | 196 | /// <summary> |
| 215 | 197 | /// Gets the credentials in 'username:password' format for authenticating the remote client application's user if a valid <see cref="ClientUser"/> is not available. |
| 216 | 198 | /// </summary> |
| 217 | − public string ClientUserCredentials | |
| 218 | − { | |
| 219 | − get | |
| 220 | − { | |
| 221 | − return m_clientUserCredentials; | |
| 222 | − } | |
| 223 | − } | |
| 199 | + public string ClientUserCredentials => m_clientUserCredentials; | |
| 224 | 200 | |
| 225 | 201 | /// <summary> |
| 226 | 202 | /// Gets the name of the machine running the remote client application. |
| 227 | 203 | /// </summary> |
| 228 | − public string MachineName | |
| 229 | − { | |
| 230 | − get | |
| 231 | − { | |
| 232 | − return m_machineName; | |
| 233 | − } | |
| 234 | − } | |
| 204 | + public string MachineName => m_machineName; | |
| 235 | 205 | |
| 236 | 206 | /// <summary> |
| 237 | 207 | /// Gets or sets the <see cref="DateTime"/> when the remote client application connected to the <see cref="ServiceHelper"/>. |
| @@ -153,13 +153,7 @@ namespace GSF.ServiceProcess · 152 unmodified lines | ||
| 153 | 153 | /// <summary> |
| 154 | 154 | /// Gets a list of attachments for the <see cref="ClientRequest"/>. |
| 155 | 155 | /// </summary> |
| 156 | − public List<object> Attachments | |
| 157 | − { | |
| 158 | − get | |
| 159 | − { | |
| 160 | − return m_attachments; | |
| 161 | − } | |
| 162 | − } | |
| 156 | + public List<object> Attachments => m_attachments; | |
| 163 | 157 | |
| 164 | 158 | #endregion |
| 165 | 159 | |
| @@ -171,7 +165,7 @@ namespace GSF.ServiceProcess · 5 unmodified lines | ||
| 171 | 165 | /// <returns>A <see cref="String"/> that represents the <see cref="ClientRequest"/>.</returns> |
| 172 | 166 | public override string ToString() |
| 173 | 167 | { |
| 174 | − return string.Format("{0} {1}", m_command, m_arguments).Trim(); | |
| 168 | + return $"{m_command} {m_arguments}".Trim(); | |
| 175 | 169 | } |
| 176 | 170 | |
| 177 | 171 | /// <summary> |
| @@ -2448,9 +2448,9 @@ namespace GSF.ServiceProcess · 2447 unmodified lines | ||
| 2448 | 2448 | SendResponse(clientID, new ServiceResponse("AuthenticationFailure")); |
| 2449 | 2449 | } |
| 2450 | 2450 | |
| 2451 | − private void SendUpdateClientStatusResponse(Guid clientID, UpdateType type, string responseMessage) | |
| 2451 | + private void SendUpdateClientStatusResponse(Guid clientID, UpdateType type, string responseMessage, bool telnetMessage = false) | |
| 2452 | 2452 | { |
| 2453 | − if (string.IsNullOrEmpty(responseMessage)) | |
| 2453 | + if (string.IsNullOrEmpty(responseMessage) || (clientID == m_remoteCommandClientID && !telnetMessage)) | |
| 2454 | 2454 | return; |
| 2455 | 2455 | |
| 2456 | 2456 | ServiceResponse response = new ServiceResponse(); |
| @@ -2680,15 +2680,9 @@ namespace GSF.ServiceProcess · 223 unmodified lines | ||
| 2680 | 2680 | } |
| 2681 | 2681 | } |
| 2682 | 2682 | |
| 2683 | − private void RemoteCommandProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e) | |
| 2684 | − { | |
| 2685 | − UpdateStatus(m_remoteCommandClientID, UpdateType.Alarm, e.Data + "\r\n"); | |
| 2686 | − } | |
| 2683 | + private void RemoteCommandProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e) => SendUpdateClientStatusResponse(m_remoteCommandClientID, UpdateType.Alarm, $"{e.Data}\r\n", true); | |
| 2687 | 2684 | |
| 2688 | − private void RemoteCommandProcess_OutputDataReceived(object sender, DataReceivedEventArgs e) | |
| 2689 | − { | |
| 2690 | − UpdateStatus(m_remoteCommandClientID, UpdateType.Information, e.Data + "\r\n"); | |
| 2691 | − } | |
| 2685 | + private void RemoteCommandProcess_OutputDataReceived(object sender, DataReceivedEventArgs e) => SendUpdateClientStatusResponse(m_remoteCommandClientID, UpdateType.Information, $"{e.Data}\r\n", true); | |
| 2692 | 2686 | |
| 2693 | 2687 | #region [ Client Request Handlers ] |
| 2694 | 2688 | |
| @@ -198,35 +198,17 @@ namespace GSF.ServiceProcess · 197 unmodified lines | ||
| 198 | 198 | /// <summary> |
| 199 | 199 | /// Gets the <see cref="DateTime"/> when execution of <see cref="ServiceProcess"/> last started. |
| 200 | 200 | /// </summary> |
| 201 | − public DateTime ExecutionStartTime | |
| 202 | − { | |
| 203 | − get | |
| 204 | − { | |
| 205 | − return m_executionStartTime; | |
| 206 | − } | |
| 207 | − } | |
| 201 | + public DateTime ExecutionStartTime => m_executionStartTime; | |
| 208 | 202 | |
| 209 | 203 | /// <summary> |
| 210 | 204 | /// Gets the <see cref="DateTime"/> when execution of <see cref="ServiceProcess"/> last completed. |
| 211 | 205 | /// </summary> |
| 212 | − public DateTime ExecutionStopTime | |
| 213 | − { | |
| 214 | − get | |
| 215 | − { | |
| 216 | − return m_executionStopTime; | |
| 217 | − } | |
| 218 | − } | |
| 206 | + public DateTime ExecutionStopTime => m_executionStopTime; | |
| 219 | 207 | |
| 220 | 208 | /// <summary> |
| 221 | 209 | /// Gets the <see cref="Time"/> taken by the <see cref="ServiceProcess"/> during the last execution. |
| 222 | 210 | /// </summary> |
| 223 | − public Time LastExecutionTime | |
| 224 | − { | |
| 225 | − get | |
| 226 | − { | |
| 227 | − return Ticks.ToSeconds(m_executionStopTime.Ticks - m_executionStartTime.Ticks); | |
| 228 | − } | |
| 229 | − } | |
| 211 | + public Time LastExecutionTime => Ticks.ToSeconds(m_executionStopTime.Ticks - m_executionStartTime.Ticks); | |
| 230 | 212 | |
| 231 | 213 | /// <summary> |
| 232 | 214 | /// Gets the descriptive status of the <see cref="ServiceProcess"/>. |
| @@ -146,13 +146,7 @@ namespace GSF.ServiceProcess · 145 unmodified lines | ||
| 146 | 146 | /// <summary> |
| 147 | 147 | /// Gets a list of serializable attachments of the <see cref="ServiceResponse"/>. |
| 148 | 148 | /// </summary> |
| 149 | − public List<object> Attachments | |
| 150 | − { | |
| 151 | − get | |
| 152 | − { | |
| 153 | − return m_attachments; | |
| 154 | − } | |
| 155 | − } | |
| 149 | + public List<object> Attachments => m_attachments; | |
| 156 | 150 | |
| 157 | 151 | #endregion |
| 158 | 152 | |