Allow selecting only types with the given base types in GetAvailableTypes, and don't needlessly catch all exceptions when debugging
This commit is contained in:
parent
0d9ddc0426
commit
dffeaa46cb
@ -31,7 +31,7 @@ namespace UniversalEditor.Common
|
||||
}
|
||||
|
||||
private static Type[] mvarAvailableTypes = null;
|
||||
public static Type[] GetAvailableTypes()
|
||||
public static Type[] GetAvailableTypes(Type[] inheritsFrom = null)
|
||||
{
|
||||
if (mvarAvailableTypes == null)
|
||||
{
|
||||
@ -56,6 +56,19 @@ namespace UniversalEditor.Common
|
||||
}
|
||||
mvarAvailableTypes = types;
|
||||
}
|
||||
|
||||
if (inheritsFrom != null)
|
||||
{
|
||||
List<Type> retval = new List<Type>();
|
||||
foreach (Type tAvailable in mvarAvailableTypes)
|
||||
{
|
||||
foreach (Type tInheritsFrom in inheritsFrom)
|
||||
{
|
||||
if (tAvailable.IsSubclassOf(tInheritsFrom)) retval.Add(tAvailable);
|
||||
}
|
||||
}
|
||||
return retval.ToArray();
|
||||
}
|
||||
return mvarAvailableTypes;
|
||||
}
|
||||
|
||||
@ -187,8 +200,10 @@ namespace UniversalEditor.Common
|
||||
XMLFileNames = System.IO.Directory.GetFiles(path, System.Configuration.ConfigurationManager.AppSettings["UniversalEditor.Configuration.ConfigurationFileNameFilter"], System.IO.SearchOption.AllDirectories);
|
||||
foreach (string fileName in XMLFileNames)
|
||||
{
|
||||
#if !DEBUG
|
||||
try
|
||||
{
|
||||
#endif
|
||||
string basePath = System.IO.Path.GetDirectoryName(fileName);
|
||||
|
||||
UEPackageObjectModel mom = new UEPackageObjectModel();
|
||||
@ -202,10 +217,12 @@ namespace UniversalEditor.Common
|
||||
{
|
||||
listProjectTypes.Add(projtype);
|
||||
}
|
||||
#if !DEBUG
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// ensure project types are loaded before running the next pass
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user