internal static void traverseNormalClassesAndInstantiate(DirectoryInfo dir, DirectoryVisitor visitor) { if (!dir.Exists) { throw new ArgumentException("not a directory: " + dir.Name); } visitor.enterDirectory(dir); // ignore classes in directories "auto", "datatypes" and // "util" // ignoreList : abstract classes, classes which are no jdf // elements ... //FileFilter ff = new FileFilter() //{ // public bool accept(File pathname) // { // bool acceptFile = false; // string name = pathname.getName(); // if (pathname.isDirectory()) // { // acceptFile = !name.Equals("auto") && !name.Equals("datatypes") && !name.Equals("util") && !name.Equals("validate"); // } // else // { // VString ignoreList = new VString("JDFConstants.java JDFDoc.java JDFDocumentBuilder.java " + "JDFException.java JDFParser.java JDFVersions.java JDFAbstractState.java " + "JDFEvaluation.java JDFNodeTerm.java JDFTerm.java JDFEnumerationSpan.java " + "JDFSpan.java JDFSpanBase.java " + "JDFDurationSpan.java JDFIntegerSpan.java JDFNameSpan.java JDFNumberSpan.java " + "JDFOptionSpan.java JDFShapeSpan.java JDFSpanNamedColor.java " + "JDFStringSpan.java JDFTimeSpan.java JDFXYPairSpan.java " + "JDFResourceLink.java " + "JDFPool.java", null); // acceptFile = !ignoreList.Contains(name) && name.StartsWith("JDF") && name.ToLower().EndsWith(".cs"); // } // return acceptFile; // } //); DirectoryInfo[] dirs = dir.GetDirectories(); for (int j = 0; j < dirs.Length; ++j) { DirectoryInfo jDir = dirs[j]; if (OkToVisitDir(jDir.Name)) { traverseNormalClassesAndInstantiate(jDir, visitor); } } FileInfo[] files = dir.GetFiles("JDF*.cs"); for (int i = 0; i < files.Length; ++i) { FileInfo file = files[i]; if (OkToVisitFile(file.Name)) { visitor.visitFile(file); } } visitor.leaveDirectory(dir); }
internal static void traverseAutoClassesAndCheckForCorrespondingNormalClass(DirectoryInfo dir, DirectoryVisitor visitor) { if (!dir.Exists) { throw new ArgumentException("not a directory: " + dir.Name); } //new FileFilter() //{ // public bool accept(File pathname) // { // bool acceptFile = false; // string name = pathname.getName(); // if (pathname.isDirectory()) // { // acceptFile = false; // } // else // { // acceptFile = name.StartsWith("JDFAuto") && name.ToLower().EndsWith(".cs"); // } // return acceptFile; // } // } //); visitor.enterDirectory(dir); DirectoryInfo[] dirs = dir.GetDirectories(); for (int j = 0; j < dirs.Length; ++j) { traverseAutoClassesAndCheckForCorrespondingNormalClass(dirs[j], visitor); } FileInfo[] files = dir.GetFiles("JDFAuto*.cs"); for (int i = 0; i < files.Length; ++i) { try { visitor.visitFile(files[i]); } catch (Exception e) { Console.WriteLine(e.Message); } } visitor.leaveDirectory(dir); }