public bool DeleteSection(string section)
{
Argument.IsNotNullOrWhitespace(() => section);
var result = true;
try
{
var sectionListKey = GetSectionListKey();
var sectionsString = _configurationService.GetRoamingValue<string>(sectionListKey);
if (string.IsNullOrEmpty(sectionsString))
{
return true;
}
var newSections = sectionsString.Split(Separator).Where(x => !string.Equals(x, section));
sectionsString = string.Join(Separator.ToString(), newSections);
_configurationService.SetRoamingValue(sectionListKey, sectionsString);
var values = GetValues(section, false);
if (values == null)
{
return false;
}
foreach (var settingValue in values)
{
result = result && DeleteValue(section, settingValue.Key);
}
}
catch
{
return false;
}
return result;
}