mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Added custom type conversion support to the SaveTo method of DefaultConnectionInfo
This commit is contained in:
@@ -43,7 +43,13 @@ namespace mRemoteNG.Connection
|
||||
{
|
||||
var propertyFromSettings = typeof(TDestination).GetProperty(propertyNameMutator(property.Name));
|
||||
var localValue = property.GetValue(Instance, null);
|
||||
propertyFromSettings.SetValue(destinationInstance, localValue, null);
|
||||
|
||||
var descriptor = TypeDescriptor.GetProperties(Instance)[property.Name];
|
||||
var converter = descriptor.Converter;
|
||||
if (converter != null && converter.CanConvertFrom(localValue.GetType()))
|
||||
property.SetValue(Instance, converter.ConvertFrom(localValue), null);
|
||||
else
|
||||
propertyFromSettings.SetValue(destinationInstance, localValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user