This commit is contained in:
2024-03-06 23:58:02 -05:00
parent e151295f31
commit bf57c1610e

View File

@@ -492,20 +492,30 @@ namespace Tor.Config
internal void SetValueDirect(string name, string value)
{
if (name == null)
throw new ArgumentNullException("name");
{
return;
// throw new ArgumentNullException("name");
}
ConfigurationNames association = ReflectionHelper.GetEnumerator<ConfigurationNames, ConfigurationAssocAttribute>(attr => attr.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase));
ConfigurationAssocAttribute attribute = ReflectionHelper.GetAttribute<ConfigurationNames, ConfigurationAssocAttribute>(association);
if (attribute.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
{
values[association] = ReflectionHelper.Convert(value, attribute.Type);
if (PropertyChanged != null)
PropertyChanged(client, new PropertyChangedEventArgs(attribute.Name));
try{values[association] = ReflectionHelper.Convert(value, attribute.Type);}
catch(Exception exception)
{
try{values[association] = ReflectionHelper.Convert(value, typeof(String));}
catch(Exception innerException)
{
Console.WriteLine(innerException);
}
}
if (PropertyChanged != null)PropertyChanged(client, new PropertyChangedEventArgs(attribute.Name));
}
}
/// <summary>
/// Starts the configuration listening for configuration changes using the client event handler.
/// </summary>