public void RunICUTools(string unidataDir, string nfcOverridesFileName, string nfkcOverridesFileName)
{
// run commands similar to the following (with full paths in quotes)
//
// gennorm2 -o nfc.nrm nfc.txt nfcHebrew.txt nfcOverrides.txt
// gennorm2 -o nfkc.nrm nfc.txt nfkc.txt nfcHebrew.txt nfcOverrides.txt nfkcOverrides.txt
//
// Note: this compiles the input files to produce the two output files, which ICU loads to customize normalization.
// Get the icu directory information
var nfcTxtFileName = Path.Combine(unidataDir, "nfc.txt"); // Original from ICU, installed
var nfcHebrewFileName = Path.Combine(unidataDir, "nfcHebrew.txt"); // Original from ICU, installed
var nfkcTxtFileName = Path.Combine(unidataDir, "nfkc.txt"); // Original from ICU, installed
// The exact name of this directory is built into ICU and can't be changed. It must be this subdirectory
// relative to the IcuDir (which is the IcuDataDirectory passed to ICU).
var uniBinaryDataDir = Path.Combine(IcuDir, string.Format("icudt{0}l", Icu.Version));
var nfcBinaryFileName = Path.Combine(uniBinaryDataDir, "nfc_fw.nrm"); // Binary file generated by gennorm2
var nfkcBinaryFileName = Path.Combine(uniBinaryDataDir, "nfkc_fw.nrm"); // Binary file generated by gennorm2
// Make a one-time original backup of the files we are about to generate.
var nfcBackup = CreateBackupFile(nfcBinaryFileName);
var nfkcBackup = CreateBackupFile(nfkcBinaryFileName);
AddUndoFileFrame(nfcBinaryFileName, nfcBackup);
AddUndoFileFrame(nfkcBinaryFileName, nfkcBackup);
// Clean up the ICU and set the icuDatadir correctly
Icu.Cleanup();
var genNorm2 = GetIcuExecutable("gennorm2");
// run it to generate the canonical binary data.
var args = String.Format(" -o \"{0}\" \"{1}\" \"{2}\" \"{3}\"",
nfcBinaryFileName, nfcTxtFileName, nfcHebrewFileName, nfcOverridesFileName);
RunProcess(genNorm2, args);
// run it again to generate the non-canonical binary data.
args = String.Format(" -o \"{0}\" \"{1}\" \"{2}\" \"{3}\" \"{4}\" \"{5}\"",
nfkcBinaryFileName, nfcTxtFileName, nfkcTxtFileName, nfcHebrewFileName, nfcOverridesFileName, nfkcOverridesFileName);
RunProcess(genNorm2, args);
}