static bool WeaveMessage(TypeDefinition td) { if (!td.IsClass) { return(false); } // already processed if (WeaveLists.ProcessedMessages.Contains(td.FullName)) { return(false); } bool modified = false; if (td.ImplementsInterface(WeaverTypes.IMessageBaseType)) { // process this and base classes from parent to child order try { TypeDefinition parent = td.BaseType.Resolve(); // process parent WeaveMessage(parent); } catch (AssemblyResolutionException) { // this can happen for plugins. //Console.WriteLine("AssemblyResolutionException: "+ ex.ToString()); } // process this MessageClassProcessor.Process(td); WeaveLists.ProcessedMessages.Add(td.FullName); modified = true; } // check for embedded types // inner classes should be processed after outter class to avoid StackOverflowException foreach (TypeDefinition embedded in td.NestedTypes) { modified |= WeaveMessage(embedded); } return(modified); }
static bool CheckMessageBase(TypeDefinition td) { if (!td.IsClass) { return(false); } bool didWork = false; // are ANY parent classes MessageBase TypeReference parent = td.BaseType; while (parent != null) { if (parent.FullName == MessageBaseType.FullName) { MessageClassProcessor.Process(td); didWork = true; break; } try { parent = parent.Resolve().BaseType; } catch (AssemblyResolutionException) { // this can happen for plugins. //Console.WriteLine("AssemblyResolutionException: "+ ex.ToString()); break; } } // check for embedded types foreach (TypeDefinition embedded in td.NestedTypes) { didWork |= CheckMessageBase(embedded); } return(didWork); }
static bool WeaveMessage(TypeDefinition td) { if (!td.IsClass) { return(false); } bool modified = false; if (td.ImplementsInterface(IMessageBaseType)) { // process this and base classes from parent to child order try { TypeDefinition parent = td.BaseType.Resolve(); // process parent WeaveMessage(parent); } catch (AssemblyResolutionException) { // this can happen for plugins. //Console.WriteLine("AssemblyResolutionException: "+ ex.ToString()); } // process this MessageClassProcessor.Process(td); modified = true; } // check for embedded types foreach (TypeDefinition embedded in td.NestedTypes) { modified |= WeaveMessage(embedded); } return(modified); }
static bool WeaveMessage(TypeDefinition td) { if (!td.IsClass) { return(false); } bool modified = false; if (td.ImplementsInterface(IMessageBaseType)) { MessageClassProcessor.Process(td); modified = true; } // check for embedded types foreach (TypeDefinition embedded in td.NestedTypes) { modified |= WeaveMessage(embedded); } return(modified); }
static bool CheckMessageBase(TypeDefinition td) { if (!td.IsClass) { return(false); } bool didWork = false; if (td.ImplementsInterface(IMessageBaseType)) { MessageClassProcessor.Process(td); didWork = true; } // check for embedded types foreach (TypeDefinition embedded in td.NestedTypes) { didWork |= CheckMessageBase(embedded); } return(didWork); }