Beispiel #1
0
 /// <summary>
 /// Initialize the ICU Data Dir. If necessary, adds the architecture-appropriate ICU DLL's to the PATH.
 /// </summary>
 public static void InitializeIcu()
 {
     // Set ICU_DATA environment variable
     if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ICU_DATA")))
     {
         // We read the registry value and set an environment variable ICU_DATA here so that
         // FwKernelInterfaces.dll is independent of WinForms.
         // ENHANCE: store data directory somewhere else other than registry (user.config
         // file?) and use that.
         string icuDirValueName = string.Format("Icu{0}DataDir",
                                                CustomIcu.Version);
         using (var userKey = RegistryHelper.CompanyKey)
             using (var machineKey = RegistryHelper.CompanyKeyLocalMachine)
             {
                 string dir = null;
                 if (userKey != null && userKey.GetValue(icuDirValueName) != null)
                 {
                     dir = userKey.GetValue(icuDirValueName, dir) as string;
                 }
                 else if (machineKey != null && machineKey.GetValue(icuDirValueName) != null)
                 {
                     dir = machineKey.GetValue(icuDirValueName, dir) as string;
                 }
                 if (!string.IsNullOrEmpty(dir))
                 {
                     Environment.SetEnvironmentVariable("ICU_DATA", dir);
                 }
             }
     }
     // ICU_DATA should point to the directory that contains nfc_fw.nrm and nfkc_fw.nrm
     // (i.e. icudt54l).
     CustomIcu.InitIcuDataDir();
 }
Beispiel #2
0
        public static void Main(string[] args)
        {
            // The only purpose of this TestHelper app is to output the ICU version
            // so that we can run unit tests that test loading of our custom ICU
            // or fallback to default ICU
            var baseDir = args?.Length > 0 ? args[0] : CodeDir;

            SetIcuDataDirectory(baseDir, "IcuData");
            CustomIcu.InitIcuDataDir();
            Console.WriteLine(Wrapper.IcuVersion);
            Console.WriteLine(Character.GetCharType('\xF171'));
            Console.WriteLine(CustomIcu.HaveCustomIcuLibrary);
            Wrapper.Cleanup();
        }