private void BuildUsings(ArchiveGeneratorConfiguration archiveGeneratorConfiguration) { var usingEntries = config.GetAll(ConfigUtils.DefaultSection, "usings", "using") .Select(n => n.RawValue); foreach (var entry in usingEntries) { archiveGeneratorConfiguration.AddUsing(entry); } archiveGeneratorConfiguration.AddUsing(SystemNamespaceName); if (archiveGeneratorConfiguration.TermAttribute != TermAttributeType.none) { archiveGeneratorConfiguration.AddUsing(TermAttributeNamespaceName); } if (archiveGeneratorConfiguration.MapMethod) { archiveGeneratorConfiguration.AddUsing(ExtensionsNamespaceName); } }
public IGeneratorConfiguration BuildConfiguration( string @namespace, bool pascalCase, TermAttributeType termAttribute, string output, bool mapMethod) { var archiveGeneratorConfiguration = new ArchiveGeneratorConfiguration() .AddNamespace(@namespace) .AddPascalCase(pascalCase) .AddTermAttribute(termAttribute) .AddOutput(output) .AddMapMethod(mapMethod); BuildUsings(archiveGeneratorConfiguration); BuildProperties(archiveGeneratorConfiguration); return(archiveGeneratorConfiguration); }
private void BuildProperties(ArchiveGeneratorConfiguration archiveGeneratorConfiguration) { var props = config.GetRegex(ConfigUtils.PropertySection); var keys = props .Select(n => n.Subsection) .Distinct(); foreach (var key in keys) { if (archiveGeneratorConfiguration.Properties.ContainsKey(key)) { archiveGeneratorConfiguration.Properties.Remove(key); } archiveGeneratorConfiguration.Properties.Add(key, new PropertyConfiguration() { Include = config.GetBoolean(ConfigUtils.PropertySection, key, "include") ?? true, TypeName = config.GetString(ConfigUtils.PropertySection, key, "typeName"), PropertyName = config.GetString(ConfigUtils.PropertySection, key, "propertyName") }); } }