private void ReloadSettings(ClientRequestInfo requestInfo)
{
if (requestInfo.Request.Arguments.ContainsHelpRequest || requestInfo.Request.Arguments.OrderedArgCount < 1)
{
StringBuilder helpMessage = new StringBuilder();
helpMessage.Append("Reloads settings of the component whose settings are saved under the specified category in the config file.");
helpMessage.AppendLine();
helpMessage.AppendLine();
helpMessage.Append(" Usage:");
helpMessage.AppendLine();
helpMessage.Append(" ReloadSettings \"Category Name\" -options");
helpMessage.AppendLine();
helpMessage.AppendLine();
helpMessage.Append(" Options:");
helpMessage.AppendLine();
helpMessage.Append(" -?".PadRight(20));
helpMessage.Append("Displays this help message");
helpMessage.AppendLine();
helpMessage.AppendLine();
helpMessage.Append("IMPORTANT: Only settings under the categories listed by the \"Settings\" command can be reloaded.");
helpMessage.AppendLine();
helpMessage.AppendLine();
UpdateStatus(requestInfo.Sender.ClientID, UpdateType.Information, helpMessage.ToString());
}
else
{
string categoryName = requestInfo.Request.Arguments["orderedarg1"];
IPersistSettings typedComponent;
lock (m_serviceComponents)
{
foreach (object component in m_serviceComponents)
{
typedComponent = component as IPersistSettings;
if ((object)typedComponent == null || string.Compare(categoryName, typedComponent.SettingsCategory, StringComparison.OrdinalIgnoreCase) != 0)
continue;
typedComponent.LoadSettings();
UpdateStatus(requestInfo.Sender.ClientID, UpdateType.Information, "Successfully loaded settings from category \"{0}\".\r\n\r\n", categoryName);
return;
}
}
UpdateStatus(requestInfo.Sender.ClientID, UpdateType.Alarm, "Failed to load settings from category \"{0}\". No corresponding component exists.\r\n\r\n", categoryName);
}
}