Showing the changes to Source/Libraries/GSF.ServiceProcess/ClientHelper.cs (1 of 3 files). Show all
Unified · Split
| @@ -156,6 +156,7 @@ namespace GSF.ServiceProcess · 155 unmodified lines | |||
| 156 | private ClientBase m_remotingClient; | 156 | private ClientBase m_remotingClient; |
| 157 | private string m_username; | 157 | private string m_username; |
| 158 | private string m_password; | 158 | private string m_password; |
| 159 | private SerializationFormat m_serializationFormat; | ||
| 159 | private bool m_persistSettings; | 160 | private bool m_persistSettings; |
| 160 | private string m_settingsCategory; | 161 | private string m_settingsCategory; |
| 161 | private bool m_attemptReconnection; | 162 | private bool m_attemptReconnection; |
| @@ -274,6 +275,24 @@ namespace GSF.ServiceProcess · 112 unmodified lines | |||
| 274 | } | 275 | } |
| 275 | } | 276 | } |
| 276 | 277 | ||
| 278 | /// <summary> | ||
| 279 | /// Gets or sets a value that indicates the desired message <see cref="GSF.SerializationFormat"/> for interaction with <see cref="ServiceHelper"/>. | ||
| 280 | /// </summary> | ||
| 281 | [Category("Settings"), | ||
| 282 | DefaultValue(ServiceHelper.DefaultSerializationFormat), | ||
| 283 | Description("Indicates messaging serialization format for interactions with ServiceHelper.")] | ||
| 284 | public SerializationFormat SerializationFormat | ||
| 285 | { | ||
| 286 | get | ||
| 287 | { | ||
| 288 | return m_serializationFormat; | ||
| 289 | } | ||
| 290 | set | ||
| 291 | { | ||
| 292 | m_serializationFormat = value; | ||
| 293 | } | ||
| 294 | } | ||
| 295 | |||
| 277 | /// <summary> | 296 | /// <summary> |
| 278 | /// Gets or sets a boolean value that indicates whether the settings of <see cref="ClientHelper"/> are to be saved to the config file. | 297 | /// Gets or sets a boolean value that indicates whether the settings of <see cref="ClientHelper"/> are to be saved to the config file. |
| 279 | /// </summary> | 298 | /// </summary> |
| @@ -423,6 +442,7 @@ namespace GSF.ServiceProcess · 143 unmodified lines | |||
| 423 | 442 | ||
| 424 | settings["Username", true].Update(m_username); | 443 | settings["Username", true].Update(m_username); |
| 425 | settings["Password", true].Update(m_password); | 444 | settings["Password", true].Update(m_password); |
| 445 | settings["SerializationFormat", true].Update(m_serializationFormat); | ||
| 426 | 446 | ||
| 427 | settings["Username"].Scope = SettingScope.User; | 447 | settings["Username"].Scope = SettingScope.User; |
| 428 | settings["Password"].Scope = SettingScope.User; | 448 | settings["Password"].Scope = SettingScope.User; |
| @@ -450,9 +470,11 @@ namespace GSF.ServiceProcess · 21 unmodified lines | |||
| 450 | 470 | ||
| 451 | settings.Add("Username", m_username, "Username to be used for authentication with the service.", false, SettingScope.User); | 471 | settings.Add("Username", m_username, "Username to be used for authentication with the service.", false, SettingScope.User); |
| 452 | settings.Add("Password", m_password, "Password to be used for authentication with the service.", true, SettingScope.User); | 472 | settings.Add("Password", m_password, "Password to be used for authentication with the service.", true, SettingScope.User); |
| 473 | settings.Add("SerializationFormat", m_password, "Message serialization format for interactions with service, one of: Xml, Json or Binary. Default is Binary."); | ||
| 453 | 474 | ||
| 454 | Username = settings["Username"].ValueAs(m_username); | 475 | Username = settings["Username"].ValueAs(m_username); |
| 455 | Password = settings["Password"].ValueAs(m_password); | 476 | Password = settings["Password"].ValueAs(m_password); |
| 477 | SerializationFormat = settings["SerializationFormat"].ValueAs(m_serializationFormat); | ||
| 456 | } | 478 | } |
| 457 | } | 479 | } |
| 458 | 480 | ||
| @@ -686,7 +708,7 @@ namespace GSF.ServiceProcess · 227 unmodified lines | |||
| 686 | { | 708 | { |
| 687 | ServiceResponse response; | 709 | ServiceResponse response; |
| 688 | 710 | ||
| 689 | Serialization.TryDeserialize(e.Argument1.BlockCopy(0, e.Argument2), SerializationFormat.Binary, out response); | 711 | Serialization.TryDeserialize(e.Argument1.BlockCopy(0, e.Argument2), m_serializationFormat, out response); |
| 690 | 712 | ||
| 691 | if ((object)response != null) | 713 | if ((object)response != null) |
| 692 | { | 714 | { |
| @@ -792,7 +814,7 @@ namespace GSF.ServiceProcess · 99 unmodified lines | |||
| 792 | } | 814 | } |
| 793 | 815 | ||
| 794 | /// <summary> | 816 | /// <summary> |
| 795 | /// Attempts to parse an actionable reponse sent from the service. | 817 | /// Attempts to parse an actionable response sent from the service. |
| 796 | /// </summary> | 818 | /// </summary> |
| 797 | /// <param name="serviceResponse"><see cref="ServiceResponse"/> to test for actionable response.</param> | 819 | /// <param name="serviceResponse"><see cref="ServiceResponse"/> to test for actionable response.</param> |
| 798 | /// <param name="sourceCommand">Command that invoked <paramref name="serviceResponse"/>.</param> | 820 | /// <param name="sourceCommand">Command that invoked <paramref name="serviceResponse"/>.</param> |
| @@ -812,7 +834,7 @@ namespace GSF.ServiceProcess · 13 unmodified lines | |||
| 812 | // Attempt to parse response message | 834 | // Attempt to parse response message |
| 813 | if (!string.IsNullOrWhiteSpace(response)) | 835 | if (!string.IsNullOrWhiteSpace(response)) |
| 814 | { | 836 | { |
| 815 | // Reponse types are formatted as "Command:Success" or "Command:Failure" | 837 | // Response types are formatted as "Command:Success" or "Command:Failure" |
| 816 | string[] parts = response.Split(':'); | 838 | string[] parts = response.Split(':'); |
| 817 | 839 | ||
| 818 | if (parts.Length > 1) | 840 | if (parts.Length > 1) |