true v = new Dictionary(); string year = DateTime.UtcNow.Year.ToString(); v.Add("SWITCH_VERSION_YEAR", year); foreach (Match m in Regex.Matches(ConfigureAC, pattern)) { v.Add(m.Groups[1].Value.Trim(), m.Groups[2].Value.Trim()); Log.LogMessage(MessageImportance.High, m.Groups[1].Value + " = '" + m.Groups[2].Value + "'"); } //--------------------------------------------------------- Log.LogMessage(MessageImportance.High, "Generating switch_version.h"); TemplatePath = basedir + @"src\include\switch_version.h.template"; DestinationPath = basedir + @"src\include\switch_version.h"; string template = File.ReadAllText(TemplatePath); foreach (var version_bit in v) { template = template.Replace("@" + version_bit.Key + "@", version_bit.Value); } File.WriteAllText(DestinationPath, template); //--------------------------------------------------------- Log.LogMessage(MessageImportance.High, "Generating switch_version.inc"); TemplatePath = @"$(ProjectDir)\switch_version.inc.template"; DestinationPath = @"$(ProjectDir)\switch_version.inc"; template = File.ReadAllText(TemplatePath); foreach (var version_bit in v) { template = template.Replace("@" + version_bit.Key + "@", version_bit.Value); } File.WriteAllText(DestinationPath, template); //--------------------------------------------------------- return true; } } ]]>