static int DoWork(HelpGenPaths ps, bool verbose) { List <HelpItem> items = GetHelpItemsFromXMLFile(ps.xmlPath, ps.xsdPath); items.Sort(delegate(HelpItem x, HelpItem y) { return(x.helpID.CompareTo(y.helpID)); }); if (null == items) { return(1); } FixBadAtomNames(items); if (CheckForDuplicateKeys(items) > 0) { return(1); } string helpProjectTemp = ps.tmpDir + "help-proj.txt"; WriteHelpProject(items, ps.inputDir, helpProjectTemp); CopyIfDifferent(helpProjectTemp, ps.helpDir + "FontValidatorHelp.hhp", verbose); string helpTOCTemp = ps.tmpDir + "help-toc.txt"; WriteHelpTableOfContents(items, ps.contentsTemplatePath, ps.inputDir, helpTOCTemp); CopyIfDifferent(helpTOCTemp, ps.helpDir + "Table of Contents.hhc", verbose); CopyConstantHelpFiles(ps.inputDir, ps.helpDir, verbose); WriteHelpFiles(items, ps.templatePath, ps.tmpDir, ps.helpDir); string valstringsTemp = ps.tmpDir + "OTFontFileVal.ValStrings.noresx"; WriteValStrings(items, ps.inputDir, valstringsTemp); CopyIfDifferent(valstringsTemp, ps.genDir + "OTFontFileVal.ValStrings.resx", verbose); string atomsTemp = ps.tmpDir + "atoms.notcs"; WriteAtomsFile(items, atomsTemp); CopyIfDifferent(atomsTemp, ps.genDir + "atoms.cs", verbose); return(0); }
static int Main( string [] args ) { HelpGenPaths ps = new HelpGenPaths(); bool err = false; bool usage = false; int iarg = 0; bool verbose = false; for ( iarg = 0; iarg < args.Length; iarg++ ) { if ( G.StrMatch( "-xml", args[iarg] ) ) { iarg++; ps.xmlPath = args[iarg]; } else if ( G.StrMatch( "-xsd", args[iarg] ) ) { iarg++; ps.xsdPath = args[iarg]; } else if ( G.StrMatch( "-template", args[iarg] ) ) { iarg++; ps.templatePath = args[iarg]; } else if ( G.StrMatch( "-contents-template", args[iarg] ) ) { iarg++; ps.contentsTemplatePath = args[iarg]; } else if ( G.StrMatch( "-outdir", args[iarg] ) ) { iarg++; ps.helpDir = args[iarg]; } else if ( G.StrMatch( "-tmpdir", args[iarg] ) ) { iarg++; ps.tmpDir = args[iarg]; } else if ( G.StrMatch( "-inputdir", args[iarg] ) ) { iarg++; ps.inputDir = args[iarg]; } else if ( G.StrMatch( "-gendir", args[iarg] ) ) { iarg++; ps.genDir = args[iarg]; } else if ( G.StrMatch( "-verbose", args[iarg] ) ) { verbose = true; } else if ( G.StrMatch( "-u", args[iarg] ) || G.StrMatch( "-usage", args[iarg] ) || G.StrMatch( "-h", args[iarg] ) || G.StrMatch( "-help", args[iarg] ) || G.StrMatch( "--help", args[iarg] ) ) { usage = true; } else { G.CO( "Unknown arg: " + args[iarg] ); err = true; } } if ( usage || err ) { Usage(); return !err? 0 : 1; } ps.FillInDefaults( verbose ); return DoWork( ps, verbose ); }
static int DoWork( HelpGenPaths ps, bool verbose ) { List<HelpItem> items = GetHelpItemsFromXMLFile( ps.xmlPath, ps.xsdPath ); if ( null == items ) { return 1; } FixBadAtomNames( items ); if ( CheckForDuplicateKeys( items ) > 0 ) { return 1; } string helpProjectTemp = ps.tmpDir + "help-proj.txt"; WriteHelpProject( items, ps.inputDir, helpProjectTemp ); CopyIfDifferent( helpProjectTemp, ps.helpDir + "FontValidatorHelp.hhp", verbose ); string helpTOCTemp = ps.tmpDir + "help-toc.txt"; WriteHelpTableOfContents( items, ps.contentsTemplatePath, ps.inputDir, helpTOCTemp ); CopyIfDifferent( helpTOCTemp, ps.helpDir+"Table of Contents.hhc", verbose ); CopyConstantHelpFiles( ps.inputDir, ps.helpDir, verbose ); WriteHelpFiles( items, ps.templatePath, ps.tmpDir, ps.helpDir ); string valstringsTemp = ps.tmpDir + "OTFontFileVal.ValStrings.noresx"; WriteValStrings( items, ps.inputDir, valstringsTemp ); CopyIfDifferent( valstringsTemp, ps.genDir + "OTFontFileVal.ValStrings.resx", verbose ); string atomsTemp = ps.tmpDir + "atoms.notcs"; WriteAtomsFile( items, atomsTemp ); CopyIfDifferent( atomsTemp, ps.genDir + "atoms.cs", verbose ); return 0; }
static int Main(string [] args) { HelpGenPaths ps = new HelpGenPaths(); bool err = false; bool usage = false; int iarg = 0; bool verbose = false; for (iarg = 0; iarg < args.Length; iarg++) { if (G.StrMatch("-xml", args[iarg])) { iarg++; ps.xmlPath = args[iarg]; } else if (G.StrMatch("-xsd", args[iarg])) { iarg++; ps.xsdPath = args[iarg]; } else if (G.StrMatch("-template", args[iarg])) { iarg++; ps.templatePath = args[iarg]; } else if (G.StrMatch("-contents-template", args[iarg])) { iarg++; ps.contentsTemplatePath = args[iarg]; } else if (G.StrMatch("-outdir", args[iarg])) { iarg++; ps.helpDir = args[iarg]; } else if (G.StrMatch("-tmpdir", args[iarg])) { iarg++; ps.tmpDir = args[iarg]; } else if (G.StrMatch("-inputdir", args[iarg])) { iarg++; ps.inputDir = args[iarg]; } else if (G.StrMatch("-gendir", args[iarg])) { iarg++; ps.genDir = args[iarg]; } else if (G.StrMatch("-verbose", args[iarg])) { verbose = true; } else if (G.StrMatch("-u", args[iarg]) || G.StrMatch("-usage", args[iarg]) || G.StrMatch("-h", args[iarg]) || G.StrMatch("-help", args[iarg]) || G.StrMatch("--help", args[iarg])) { usage = true; } else { G.CO("Unknown arg: " + args[iarg]); err = true; } } if (usage || err) { Usage(); return(!err? 0 : 1); } ps.FillInDefaults(verbose); return(DoWork(ps, verbose)); }