static void Main(String[] args) { properties = new Properties(args); mh = properties.getMessageHandler(); config = properties.getConfig(); omProject = properties.getOMProject(); baseDir = properties.getBaseDir(); String tgtMode = "Full"; if (properties.isIncremental()) tgtMode = "Incremental"; Console.WriteLine("\nGenerating TGTs in " + tgtMode + " mode."); List<String> dependencies = findDependencies(baseDir); if (dependencies.Count == 0) mh.warn("No TGTs to generate. No matching dependencies were found. Please check your Recursive, Includes and Excludes settings in the TGT Generation Configuration file."); Console.WriteLine("\n########## Auto Generating Visual Studio TGTs ##########\n"); String[] slnDependencies = dependencies.FindAll(new Predicate<String>(testForSln)).ToArray(); String[] projDependencies = dependencies.FindAll(new Predicate<String>(testForProj)).ToArray(); if (slnDependencies.Length > 0) createSlnTGTs(slnDependencies); if (projDependencies.Length > 0) createProjTGTs(projDependencies); if (Environment.ExitCode > 0) Console.WriteLine("\n########## Visual Studio TGT Generation Completed With Errrors ##########\n"); else { Console.WriteLine("\n########## Visual Studio TGT Generation Completed ##########\n"); } mh.indent("TGTs Created: " + createdTGTsCount); mh.indent("TGTs Skipped: " + skippedTGTsCount); mh.indent("Warnings: " + mh.getWarningCount()); mh.indent("Errors: " + mh.getErrorCount() + "\n"); }
private void getProperties(String configFile) { Console.WriteLine("Processing \"" + configFile + "\" for properties...\n"); String line = ""; StreamReader filereader = new StreamReader(configFile); //temporary Dictionary containing expandable Lists as values - will later convert back to string array Dictionary<String, List<String>> tmpProperties = new Dictionary<String, List<String>>(); String key = ""; //bool inLines = false; List<String> values = new List<String>(); while ((line = filereader.ReadLine()) != null) { line.Trim(); if (line.StartsWith("#") || line.Equals("")) continue; else if (line.StartsWith("@@")) //this is the key { key = line.Replace("@", ""); tmpProperties.Add(key, new List<String>()); continue; } else { tmpProperties[key].Add(line); } } //convert list values backt to string arrays properties = new Dictionary<String, String[]>(); MessageHandler tmpMh = new MessageHandler(false); foreach (KeyValuePair<String, List<String>> kvp in tmpProperties) { String logValue = ""; String tmpKey = kvp.Key; List<String> tmpValue = kvp.Value; if (tmpValue.Count > 1) logValue = "[Multiple Values]"; else if (tmpValue.Count == 0) logValue = "[Not Defined]"; else logValue = tmpValue[0]; tmpMh.indent(tmpKey + ": " + logValue); this.properties.Add(tmpKey, tmpValue.ToArray()); } filereader.Close(); }