public GeneratorConfiguration FromAbiFiles(string projectFileName, string assemblyName, CodeGenLanguage language) { var config = new GeneratorConfiguration(); var projectFolder = Path.GetDirectoryName(projectFileName); var projectName = Path.GetFileNameWithoutExtension(projectFileName); var abiFiles = Directory.GetFiles(projectFolder, "*.abi", SearchOption.AllDirectories); var abiConfigurations = new List <ABIConfiguration>(abiFiles.Length); config.ABIConfigurations = abiConfigurations; foreach (var abiFile in abiFiles) { var abiConfig = CreateAbiConfiguration(abiFile, projectFolder, projectName, assemblyName, language); abiConfigurations.Add(abiConfig); } return(config); }
private static GeneratorConfiguration Merge(GeneratorConfiguration configFileGeneratorConfig, GeneratorConfiguration abiFileDrivenConfig) { //config file wins over abi based config foreach (var configFileDrivenAbi in configFileGeneratorConfig.ABIConfigurations) { var duplicateConfigEntries = abiFileDrivenConfig.ABIConfigurations.Where(c => c.ContractName == configFileDrivenAbi.ContractName).ToArray(); foreach (var duplicate in duplicateConfigEntries) { abiFileDrivenConfig.ABIConfigurations.Remove(duplicate); } } abiFileDrivenConfig.ABIConfigurations.AddRange(configFileGeneratorConfig.ABIConfigurations); return(abiFileDrivenConfig); }