public static IEnumerable <AssemblyAndType> EnumerateFromFile(string filePath, Type[] enumerateTypes) { if (!File.Exists(filePath)) { Console.WriteLine("{0} does not exist.", filePath); yield break; } var asm = System.Reflection.Assembly.LoadFrom(filePath); foreach (Type t in asm.GetTypes()) { if (t.IsClass && t.IsPublic && !t.IsAbstract) { var asmAndType = new AssemblyAndType(asm, t); foreach (Type enumerateType in enumerateTypes) { if (t.IsSubclassOf(enumerateType)) { yield return(asmAndType); } } if (!ShouldBeIgnored(t)) { if (t.IsSubclassOf(typeof(FlowSourceObjectBase))) { FlowSourceObjectManager.AddFlowSourceObject(asmAndType); } else if (t.IsSubclassOf(typeof(TypeConverterBase))) { TypeConverterManager.AddConverter((TypeConverterBase)asmAndType.Assembly.CreateInstance(asmAndType.Type.FullName)); } else if (t.IsSubclassOf(typeof(TypeConverterFromBase))) { TypeConverterManager.AddConverter((TypeConverterFromBase)asmAndType.Assembly.CreateInstance(asmAndType.Type.FullName)); } else if (t.IsSubclassOf(typeof(TypeConverterToBase))) { TypeConverterManager.AddConverter((TypeConverterToBase)asmAndType.Assembly.CreateInstance(asmAndType.Type.FullName)); } else if (t.IsSubclassOf(typeof(TypeFormatterBase))) { TypeFormatterManager.AddFormatter((TypeFormatterBase)asmAndType.Assembly.CreateInstance(asmAndType.Type.FullName)); } else if (t.IsSubclassOf(typeof(TypeSerializerBase))) { TypeSerializerManager.AddSerializer((TypeSerializerBase)asmAndType.Assembly.CreateInstance(asmAndType.Type.FullName)); } } } } }
internal void SetValue(string propertyName, string value) { CustomMemberInfo <PropertyInfo> info = inProperty[propertyName]; if (info != null) { var formatter = TypeFormatterManager.GetFormatter(info.MemberInfo.PropertyType); if (formatter.Format(value, out object convert)) { SetPropertyValue(propertyName, convert); } } }