private static void BindFolder(string input, string outputh, string outputc) { input = input.TrimEnd('/'); outputh = outputh.TrimEnd('/'); outputc = outputc.TrimEnd('/'); // Get the DirectoryInfo for the input folder. DirectoryInfo dir = new DirectoryInfo(input); // Convert directories. foreach (DirectoryInfo d in dir.GetDirectories()) { string namespc = input.Substring(BuildConfiguration["Input"].Length).Replace('/', '.'); Console.WriteLine(BatchProgram.ConvertAliases(namespc + "." + d.Name)); if (!Directory.Exists(outputh + "/" + d.Name)) { Directory.CreateDirectory(outputh + "/" + d.Name); } if (!Directory.Exists(outputc + "/" + d.Name)) { Directory.CreateDirectory(outputc + "/" + d.Name); } BatchProgram.BindFolder(input + "/" + d.Name, outputh + "/" + d.Name, outputc + "/" + d.Name); } foreach (FileInfo f in dir.GetFiles("*.bpp")) { string namespc = input.Substring(BuildConfiguration["Input"].Length).Replace('/', '.'); Console.WriteLine(BatchProgram.ConvertAliases(namespc + "." + f.Name.Substring(0, f.Name.Length - f.Extension.Length))); BatchProgram.BindFile(input + "/" + f.Name, outputh + "/" + f.Name, outputc + "/" + f.Name); } }
static void Main(string[] args) { // Check to make sure the build configuration file exists. if (!File.Exists("./AutoBind.xml")) { BatchProgram.CompilerError("A0001", null); return; } // Read the build configuration. Dictionary <string, string> info = BatchProgram.GetBuildConfiguration(); // Check to make sure all of the output / input folders exist. if (Directory.Exists(info["Input"])) { BatchProgram.CompilerError("A0002", new string[] { info["Input"] }); return; } if (!Directory.Exists(info["OutputH"])) { BatchProgram.CompilerError("A0003", new string[] { info["OutputH"] }); return; } if (!Directory.Exists(info["OutputC"])) { BatchProgram.CompilerError("A0004", new string[] { info["OutputC"] }); return; } BatchProgram.BuildConfiguration = info; // Now perform the automatic binding process. BatchProgram.BindFolder(info["Input"], info["OutputH"], info["OutputC"]); }