java: public static void main(String[] args) throws IOException {boolean printTree = false;String path = null;for(int i=0;i<args.length;i++) {if (args[i].equals("-printTree")) {printTree = true;} else {path = args[i];}}if (args.length != (printTree ? 2 : 1)) {System.out.println("\nUsage: java -classpath ... org.apache.lucene.facet.util.PrintTaxonomyStats [-printTree] /path/to/taxononmy/index\n");System.exit(1);}Directory dir = FSDirectory.open(Paths.get(path));TaxonomyReader r = new DirectoryTaxonomyReader(dir);printStats(r, System.out, printTree);r.close();dir.close();}
C#: public static int Main(string[] args){bool printTree = false;string path = null;for (int i = 0; i < args.Length; i++){if (args[i].Equals("-printTree", StringComparison.Ordinal)){printTree = true;}else{path = args[i];}}if (args.Length != (printTree ? 2 : 1)){throw new ArgumentException();}using (Store.Directory dir = FSDirectory.Open(new DirectoryInfo(path))){using (var r = new DirectoryTaxonomyReader(dir)){PrintStats(r, System.Console.Out, printTree);}}return 0;}