Exemplo n.º 1
0
        /// <summary>
        /// Cleans up the SLDR. This should be called to properly clean up SLDR resources.
        /// </summary>
        public static void Cleanup()
        {
            CheckInitialized();

            _sldrCacheMutex.Dispose();
            _sldrCacheMutex = null;
            _languageTags   = null;

            IcuRulesCollator.DisposeCollators();
        }
Exemplo n.º 2
0
		private static AddSortKeysToXml.SortKeyGenerator GetSortKeyGeneratorFromArgument(string s)
		{
			string icuRules = null;
			if (s.StartsWith("icu:", StringComparison.CurrentCultureIgnoreCase))
			{
				icuRules = s.Substring(4);
			}
			else if (s.StartsWith("simple:", StringComparison.CurrentCultureIgnoreCase))
			{
				var parser = new SimpleRulesParser();
				icuRules = parser.ConvertToIcuRules(s.Substring(7));
			}

			if (icuRules != null)
			{
				var collator = new IcuRulesCollator(icuRules);
				return collator.GetSortKey;
			}
			return CultureInfo.GetCultureInfo(s).CompareInfo.GetSortKey;
		}