LeMP.MacroProcessor.AddMacros C# (CSharp) Method

AddMacros() public method

public AddMacros ( Assembly assembly, bool writeToSink = true ) : bool
assembly System.Reflection.Assembly
writeToSink bool
return bool
		public bool AddMacros(Assembly assembly, bool writeToSink = true)
		{
			bool any = false;
			foreach (Type type in assembly.GetExportedTypes()) {
				if (!type.IsGenericTypeDefinition &&
					type.GetCustomAttributes(typeof(ContainsMacrosAttribute), true).Any())
				{
					if (writeToSink && Sink.IsEnabled(Severity.Verbose))
						Sink.Write(Severity.Verbose, assembly.GetName().Name, "Adding macros in type '{0}'", type);
					any = AddMacros(type) || any;
				}
			}
			if (!any && writeToSink)
				Sink.Warning(assembly, "No macros found");
			return any;
		}

Same methods

MacroProcessor::AddMacros ( Type type ) : bool

Usage Example

Beispiel #1
0
        MacroProcessor NewLemp(int maxExpand)
        {
            var lemp = new MacroProcessor(typeof(LeMP.Prelude.Macros), _sink);

            lemp.AddMacros(typeof(LeMP.Prelude.Les.Macros));
            lemp.AddMacros(typeof(LeMP.StandardMacros));
            lemp.PreOpenedNamespaces.Add(GSymbol.Get("LeMP"));
            lemp.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude"));
            lemp.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude.Les"));
            lemp.MaxExpansions = maxExpand;
            return(lemp);
        }
All Usage Examples Of LeMP.MacroProcessor::AddMacros