private CodeGenerator MakeCodeGenerator() { //CodeGeneratorDomain domain = this.MakeDomain(); CodeGenerator gen = new CodeGenerator(); var entries = this.MakeCodeGenEntries(); foreach (var entry in entries) { gen.AddEntry(entry); } return gen; }
private CodeGenerator CreateCodeGenerator(XmlElement domainEl) { string[] dlls = domainEl.GetMandatoryAttribute("dlls").Split(','); CodeGenerator gen = new CodeGenerator(); XmlElement[] entryEls = domainEl.GetChildElements("entry"); _namedEntries.Clear(); foreach (XmlElement entryEl in entryEls) { string typeName = entryEl.GetMandatoryAttribute("handle-interface"); string entryName = entryEl.GetMandatoryAttribute("entry-name"); Type handleInterfaceType = null; for (int i = 0; i < dlls.Length; i++) { string fullDllPath = Path.Combine(Directory.GetCurrentDirectory(), dlls[i]); Assembly asm = Assembly.LoadFile(fullDllPath); handleInterfaceType = asm.GetType(typeName); if (handleInterfaceType != null) { break; } } if (handleInterfaceType == null) { throw new ApplicationException(); // todo2[ak] } CodeGeneratorEntry entry = new CodeGeneratorEntry(handleInterfaceType); gen.AddEntry(entry); _namedEntries[entryName] = entry; } return gen; }