private static void ConstructType(Type type, Dictionary <string, TypeInformation> objectTypes) { if (!type.IsAbstract) { var typeAttributes = type.GetCustomAttribute(typeof(EditorTypeAttribute)); if (typeAttributes != null) { objectTypes.Add(type.Name, TypeInformation.Construct(type)); } } }
public static TypeManifest Construct(Type[] types) { var manifest = new TypeManifest(); var information = new List <TypeInformation> (); foreach (var type in types) { information.Add(TypeInformation.Construct(type)); } manifest.Types = information.ToArray(); return(manifest); }
public static BehaviourManifest CreateFromAppDomain(AppDomain appDomain) { var manifest = new BehaviourManifest(); var objectTypes = new Dictionary <string, TypeInformation>(); foreach (var type in frameworkTypes) { objectTypes.Add(type.Name, TypeInformation.Construct(type)); } var nodeTypes = new Dictionary <string, NodeInformation>(); foreach (var assembly in GetDependentAssemblies(appDomain, typeof(NodeTemplate).Assembly)) { Type[] types; try { types = assembly.GetTypes(); } catch { continue; } foreach (var type in types) { ConstructType(type, objectTypes); if (type.IsAbstract) { continue; } if (typeof(NodeTemplate).IsAssignableFrom(type)) { nodeTypes.Add(type.FullName, NodeInformation.Construct(type)); } } } manifest.Types = new TypeManifest() { ObjectTypes = objectTypes, NodeTypes = nodeTypes, }; return(manifest); }
public static TypeManifest Construct(Type[] valueTypes, Type[] objectTypes) { var manifest = new TypeManifest(); var valueTypeInformation = new Dictionary <string, TypeInformation> (); foreach (var type in valueTypes) { valueTypeInformation.Add(type.Name, TypeInformation.Construct(type)); } manifest.JsonTypes = valueTypeInformation; var objectTypeInformation = new Dictionary <string, TypeInformation> (); foreach (var type in objectTypes) { objectTypeInformation.Add(type.Name, TypeInformation.Construct(type)); } manifest.ObjectTypes = objectTypeInformation; return(manifest); }