public object Create(object key) { TypeFactoryEntry entry = null; try { entry = (TypeFactoryEntry)entries[key]; object o = CreateInstance(entry.Type); IPolicy policy = o as IPolicy; if (policy != null) { policy.FactoryKey = entry.Key; policy.Description = entry.Description; } return(o); } catch (Exception e) { Trace.WriteLineIf(info.Enabled, string.Format( "Exception creating ({0}, {1}): {2})", key, entry == null ? null : entry.Type, e.ToString())); return(null); } }
public void Add(TypeFactoryEntry entry) { Add(entry.Key, entry); }
// // New methods // public void Add(object key, TypeFactoryEntry value) { entries.Add(key, value); }
public TypeReflectorOptions() { AddArgumentOption(addAssemblies, "assemblies", "Add the specified assemblies to the list of " + "assemblies searched for types.", "<assembly-list>"); AddArgumentOption(referenceAssemblies, "reference", "Add the specified assembly names to the list of " + "assemblies searched for types.", "<assembly-name-list>"); AddOption(matchAll, "match-all", "Type names should be matched in all locations" ); AddOption(matchFullName, "match-full-name", "Match type names against the full type name " + "(Namespace + Class Name).\n" + "This is the default."); AddOption(matchClass, "match-class", "Match type names against only the class name"); AddOption(matchNamespace, "match-namespace", "Match the type's namespace."); AddOption(matchBase, "match-base", "Match type names against the base class " + "name.\nMatching of the base name is " + "identical to top-level type matches--it " + "matches the namespace, class name, or full " + "type name."); /* * AddOption (matchReturnType, "match-return-type", * "Match the return type of methods"); */ AddOption(showBase, "show-base", "Show the base class."); AddOption(showConstructors, "show-constructors", "Show the type's constructors."); AddOption(showEvents, "show-events", "Show the type's events."); AddOption(showFields, "show-fields", "Show the type's fields."); AddOption(showInterfaces, "show-interfaces", "Show the type's interfaces"); AddOption(showMethods, "show-methods", "Show the type's methods."); AddOption(showProperties, "show-properties", "Show the type's properties."); AddOption(showTypeProperties, "show-type-properties", "Show the properties of the type's System.Type " + "object.\nThis is not set by -S."); AddOption(showInheritedMembers, "show-inherited-members", "Show inherited members (members declared by " + "base classes).\nThis is not set by -S."); AddOption(showNonPublic, "show-non-public", "Show non-public members.\n" + "This is not set by -S."); AddOption(showMonoBroken, "show-mono-broken", "Some attributes shown in verbose output " + "cause exceptions when run under Mono. " + "These attributes are not shown by default. " + "This option shows these disabled attributes." + "\nThis is not set by -S."); AddOption(showAll, "show-all", "Show everything except System.Type " + "properties, inherited members, non-public " + "members, and \"broken\" Mono attributes. " + "Equivalent to -bcefimp."); AddOption(flattenHierarchy, "flatten-hierarchy", "Static members of base types should be " + "displayed."); AddOption(invokeMethods, "invoke-methods", "Invoke static methods that accept no arguments " + "and display the return value in the method " + "description (e.g. -m).\n" + "This is not set by -S."); StringBuilder formatterDescription = new StringBuilder(); formatterDescription.Append("Specify the output style to use. Available values are:"); foreach (DictionaryEntry de in Factories.Formatter) { TypeFactoryEntry e = (TypeFactoryEntry)de.Value; formatterDescription.AppendFormat("\n{0}:\t{1}", e.Key, e.Description); } AddArgumentOption(formatter, formatterDescription.ToString(), "<formatter>"); StringBuilder finderDescription = new StringBuilder(); finderDescription.Append("Specify how nodes are found. Available values are:"); foreach (DictionaryEntry de in Factories.Finder) { TypeFactoryEntry e = (TypeFactoryEntry)de.Value; finderDescription.AppendFormat("\n{0}:\t{1}", e.Key, e.Description); } AddArgumentOption(finder, finderDescription.ToString(), "<finder>"); StringBuilder displayerDescription = new StringBuilder(); displayerDescription.Append("Specify where output should be displayed. Available values are:"); foreach (DictionaryEntry de in Factories.Displayer) { TypeFactoryEntry e = (TypeFactoryEntry)de.Value; displayerDescription.AppendFormat("\n{0}:\t{1}", e.Key, e.Description); } AddArgumentOption(displayer, displayerDescription.ToString(), "<displayer>"); AddOption(verboseOutput, "verbose-output", "Print the contents of all the public " + "attributes of the reflection information " + "classes."); AddOption(defaultAssemblies, "Print the default search assemblies and exit."); AddOption(useDefaultAssemblies, "Load the default assemblies and display their contents."); AddArgumentOption(maxDepth, "Specify how deep the verbose output tree should display output.\nDefault is 10.", "INTEGER"); AddOption(version, "Output version information and exit."); AddHelpOption(); }
public void Add (TypeFactoryEntry entry) { Add (entry.Key, entry); }
// // New methods // public void Add (object key, TypeFactoryEntry value) { entries.Add (key, value); }