| @@ -225,6 +225,11 @@ namespace GSF.ServiceProcess · 224 unmodified lines |
| 225 | 225 | /// </summary> |
| 226 | 226 | public const bool DefaultSecureRemoteInteractions = false; |
| 227 | 227 | |
| 228 | + /// <summary> |
| 229 | + /// Specifies the default value for the <see cref="ServiceHelper.SerializationFormat"/> property. |
| 230 | + /// </summary> |
| 231 | + public const SerializationFormat DefaultSerializationFormat = SerializationFormat.Binary; |
| 232 | + |
| 228 | 233 | /// <summary> |
| 229 | 234 | /// Specifies the default value for the <see cref="PersistSettings"/> property. |
| 230 | 235 | /// </summary> |
| @@ -353,6 +358,7 @@ namespace GSF.ServiceProcess · 122 unmodified lines |
| 353 | 358 | private bool m_supportTelnetSessions; |
| 354 | 359 | private bool m_supportSystemCommands; |
| 355 | 360 | private bool m_secureRemoteInteractions; |
| 361 | + private SerializationFormat m_serializationFormat; |
| 356 | 362 | private bool m_persistSettings; |
| 357 | 363 | private string m_settingsCategory; |
| 358 | 364 | private string m_telnetSessionPassword; |
| @@ -370,15 +376,15 @@ namespace GSF.ServiceProcess · 11 unmodified lines |
| 370 | 376 | private readonly Dictionary<ISupportLifecycle, bool> m_componentEnabledStates; |
| 371 | 377 | private TryGetClientPrincipalFunctionSignature m_tryGetClientPrincipalFunction; |
| 372 | 378 | private readonly ProcessQueue<StatusUpdate> m_statusUpdateQueue; |
| 373 | | − private bool m_enabled; |
| 374 | | − private bool m_disposed; |
| 375 | | − private bool m_initialized; |
| 376 | 379 | private bool m_suppressUpdates; |
| 377 | 380 | private Guid m_remoteCommandClientID; |
| 378 | 381 | private Process m_remoteCommandProcess; |
| 379 | 382 | private Ticks m_lastStatusUpdateTime; |
| 380 | 383 | private long m_statusUpdateCount; |
| 381 | 384 | private bool m_supressStatusUpdates; |
| 385 | + private bool m_enabled; |
| 386 | + private bool m_initialized; |
| 387 | + private bool m_disposed; |
| 382 | 388 | |
| 383 | 389 | #endregion |
| 384 | 390 | |
| @@ -399,6 +405,7 @@ namespace GSF.ServiceProcess · 14 unmodified lines |
| 399 | 405 | m_supportTelnetSessions = DefaultSupportTelnetSessions; |
| 400 | 406 | m_supportSystemCommands = DefaultSupportSystemCommands; |
| 401 | 407 | m_secureRemoteInteractions = DefaultSecureRemoteInteractions; |
| 408 | + m_serializationFormat = DefaultSerializationFormat; |
| 402 | 409 | m_persistSettings = DefaultPersistSettings; |
| 403 | 410 | m_settingsCategory = DefaultSettingsCategory; |
| 404 | 411 | m_processes = new List<ServiceProcess>(); |
| @@ -622,6 +629,24 @@ namespace GSF.ServiceProcess · 217 unmodified lines |
| 622 | 629 | } |
| 623 | 630 | } |
| 624 | 631 | |
| 632 | + /// <summary> |
| 633 | + /// Gets or sets a value that indicates the desired message <see cref="GSF.SerializationFormat"/> for interaction with <see cref="ClientHelper"/>. |
| 634 | + /// </summary> |
| 635 | + [Category("Settings"), |
| 636 | + DefaultValue(DefaultSerializationFormat), |
| 637 | + Description("Indicates messaging serialization format for interactions with ClientHelper.")] |
| 638 | + public SerializationFormat SerializationFormat |
| 639 | + { |
| 640 | + get |
| 641 | + { |
| 642 | + return m_serializationFormat; |
| 643 | + } |
| 644 | + set |
| 645 | + { |
| 646 | + m_serializationFormat = value; |
| 647 | + } |
| 648 | + } |
| 649 | + |
| 625 | 650 | /// <summary> |
| 626 | 651 | /// Gets or sets a boolean value that indicates whether the settings of <see cref="ServiceHelper"/> are to be saved to the config file. |
| 627 | 652 | /// </summary> |
| @@ -1049,6 +1074,7 @@ namespace GSF.ServiceProcess · 421 unmodified lines |
| 1049 | 1074 | settings["SupportTelnetSessions", true].Update(m_supportTelnetSessions); |
| 1050 | 1075 | settings["SupportSystemCommands", true].Update(m_supportSystemCommands); |
| 1051 | 1076 | settings["SecureRemoteInteractions", true].Update(m_secureRemoteInteractions); |
| 1077 | + settings["SerializationFormat", true].Update(m_serializationFormat); |
| 1052 | 1078 | config.Save(); |
| 1053 | 1079 | } |
| 1054 | 1080 | |
| @@ -1103,6 +1129,7 @@ namespace GSF.ServiceProcess · 48 unmodified lines |
| 1103 | 1129 | settings.Add("SupportTelnetSessions", m_supportTelnetSessions, "True to enable the support for remote telnet-like sessions; otherwise False."); |
| 1104 | 1130 | settings.Add("SupportSystemCommands", m_supportSystemCommands, "True to enable system-level access (-system switch) via the build-in commands; otherwise False."); |
| 1105 | 1131 | settings.Add("SecureRemoteInteractions", m_secureRemoteInteractions, "True to enable security of remote client interactions; otherwise False."); |
| 1132 | + settings.Add("SerializationFormat", m_serializationFormat, "Message serialization format for interactions with clients, one of: Xml, Json or Binary. Default is Binary."); |
| 1106 | 1133 | |
| 1107 | 1134 | if ((object)settings["TelnetSessionPassword"] != null) |
| 1108 | 1135 | m_telnetSessionPassword = settings["TelnetSessionPassword"].ValueAs(m_telnetSessionPassword); |
| @@ -1116,6 +1143,7 @@ namespace GSF.ServiceProcess · 7 unmodified lines |
| 1116 | 1143 | SupportTelnetSessions = settings["SupportTelnetSessions"].ValueAs(m_supportTelnetSessions); |
| 1117 | 1144 | SupportSystemCommands = settings["SupportSystemCommands"].ValueAs(m_supportSystemCommands); |
| 1118 | 1145 | SecureRemoteInteractions = settings["SecureRemoteInteractions"].ValueAs(m_secureRemoteInteractions); |
| 1146 | + SerializationFormat = settings["SerializationFormat"].ValueAs(m_serializationFormat); |
| 1119 | 1147 | } |
| 1120 | 1148 | |
| 1121 | 1149 | /// <summary> |
| @@ -2146,7 +2174,7 @@ namespace GSF.ServiceProcess · 1024 unmodified lines |
| 2146 | 2174 | if ((object)client == null) |
| 2147 | 2175 | { |
| 2148 | 2176 | // First message from a remote client should be its info. |
| 2149 | | − Serialization.TryDeserialize(e.Argument2.BlockCopy(0, e.Argument3), SerializationFormat.Binary, out client); |
| 2177 | + Serialization.TryDeserialize(e.Argument2.BlockCopy(0, e.Argument3), m_serializationFormat, out client); |
| 2150 | 2178 | |
| 2151 | 2179 | try |
| 2152 | 2180 | { |
| @@ -2210,7 +2238,7 @@ namespace GSF.ServiceProcess · 57 unmodified lines |
| 2210 | 2238 | ClientRequest request; |
| 2211 | 2239 | ClientRequestInfo requestInfo = null; |
| 2212 | 2240 | |
| 2213 | | − Serialization.TryDeserialize(e.Argument2.BlockCopy(0, e.Argument3), SerializationFormat.Binary, out request); |
| 2241 | + Serialization.TryDeserialize(e.Argument2.BlockCopy(0, e.Argument3), m_serializationFormat, out request); |
| 2214 | 2242 | |
| 2215 | 2243 | if ((object)request != null) |
| 2216 | 2244 | { |