public ToolAction(CodeGenerator codeGenerator, CodeGeneratorEntry entry, Dictionary<string, string> props) { this.CodeGenerator = codeGenerator; _props = props; this.Entry = entry; this.Comment = _props.GetOrDefault("comment"); this.FileName = _props.GetOrDefault("file-name"); }
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; }
public GenerateServiceProxyToolAction(CodeGenerator codeGenerator, CodeGeneratorEntry entry, Dictionary<string, string> props) : base(codeGenerator, entry, props) { }
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; }
public GenerateHandleClassToolAction(CodeGenerator codeGenerator, CodeGeneratorEntry entry, Dictionary<string, string> props) : base(codeGenerator, entry, props) { }
private ToolAction ResolveAction(CodeGenerator codeGenerator, XmlElement actionEl) { string verb = actionEl.GetMandatoryAttribute("verb"); CodeGeneratorEntry entry; if (actionEl.HasAttribute("entry-name")) { entry = _namedEntries[actionEl.GetAttribute("entry-name")]; } else { throw new ApplicationException(); // todo2[ak] } var props = actionEl.Attributes .Cast<XmlAttribute>() .ToDictionary(attr => attr.Name, attr => attr.Value); ToolAction action; switch (verb) { case "generate-service-interface": action = new GenerateServiceInterfaceToolAction(codeGenerator, entry, props); break; case "generate-service-proxy": action = new GenerateServiceProxyToolAction(codeGenerator, entry, props); break; case "generate-handle-class": action = new GenerateHandleClassToolAction(codeGenerator, entry, props); break; default: throw new ApplicationException(); // todo2[ak] } return action; }