io commander
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
@@ -755,6 +756,20 @@ namespace Inspectron.Settings
|
||||
{
|
||||
v = Enum.Parse(setting.PropertyDescriptor.PropertyType, setting.ValueString);
|
||||
}
|
||||
// if is list
|
||||
else if (setting.PropertyDescriptor.PropertyType.IsGenericType &&
|
||||
setting.PropertyDescriptor.PropertyType.GetGenericTypeDefinition() == typeof(List<>))
|
||||
{
|
||||
Type itemType = setting.PropertyDescriptor.PropertyType.GetGenericArguments()[0];
|
||||
TypeConverter converter = TypeDescriptor.GetConverter(itemType);
|
||||
string[] items = setting.ValueString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
IList list = (IList)Activator.CreateInstance(setting.PropertyDescriptor.PropertyType);
|
||||
foreach (string item in items)
|
||||
{
|
||||
list.Add(converter.ConvertFromInvariantString(item.Trim()));
|
||||
}
|
||||
v = list;
|
||||
}
|
||||
else
|
||||
{
|
||||
v = Convert.ChangeType(setting.ValueString, setting.PropertyDescriptor.PropertyType);
|
||||
@@ -815,7 +830,7 @@ namespace Inspectron.Settings
|
||||
|
||||
}
|
||||
}
|
||||
ApplyStoredSettings();
|
||||
//ApplyStoredSettings();
|
||||
Reloaded.Raise(this, EventArgs.Empty);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user