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

View File

@@ -492,18 +492,28 @@ namespace Tor.Config
internal void SetValueDirect(string name, string value) internal void SetValueDirect(string name, string value)
{ {
if (name == null) 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)); ConfigurationNames association = ReflectionHelper.GetEnumerator<ConfigurationNames, ConfigurationAssocAttribute>(attr => attr.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase));
ConfigurationAssocAttribute attribute = ReflectionHelper.GetAttribute<ConfigurationNames, ConfigurationAssocAttribute>(association); ConfigurationAssocAttribute attribute = ReflectionHelper.GetAttribute<ConfigurationNames, ConfigurationAssocAttribute>(association);
if (attribute.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase)) if (attribute.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
{ {
values[association] = ReflectionHelper.Convert(value, attribute.Type); 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) if (PropertyChanged != null)PropertyChanged(client, new PropertyChangedEventArgs(attribute.Name));
PropertyChanged(client, new PropertyChangedEventArgs(attribute.Name));
} }
} }
/// <summary> /// <summary>