Ejemplo n.º 1
0
        private void WriteCollationRulesFromCustomSimple(XmlWriter writer, XmlReader reader, WritingSystemDefinitionV1 ws)
        {
            Debug.Assert(writer != null);
            Debug.Assert(ws != null);
            Debug.Assert(ws.SortUsing == WritingSystemDefinitionV1.SortRulesType.CustomSimple);

            var    parser = new SimpleRulesParser();
            string message;

            // avoid throwing exception, just don't save invalid data
            if (!parser.ValidateSimpleRules(ws.SortRules ?? string.Empty, out message))
            {
                return;
            }
            string icu = parser.ConvertToIcuRules(ws.SortRules ?? string.Empty);

            WriteCollationRulesFromICUString(writer, reader, icu);
        }
		public override bool Validate(out string message)
		{
			if (IsValid)
			{
				message = null;
				return true;
			}

			var parser = new SimpleRulesParser();
			if (parser.ValidateSimpleRules(SimpleRules, out message))
			{
				CollationRules = parser.ConvertToIcuRules(SimpleRules);
				IsValid = true;
				return true;
			}
			CollationRules = string.Empty;
			IsValid = false;
			return false;
		}
Ejemplo n.º 3
0
        public override bool Validate(out string message)
        {
            if (IsValid)
            {
                message = null;
                return(true);
            }

            var parser = new SimpleRulesParser();

            if (parser.ValidateSimpleRules(SimpleRules, out message))
            {
                CollationRules = parser.ConvertToIcuRules(SimpleRules);
                IsValid        = true;
                return(true);
            }
            CollationRules = string.Empty;
            IsValid        = false;
            return(false);
        }
Ejemplo n.º 4
0
		private void WriteCollationRulesFromCustomSimple(XmlWriter writer, XmlReader reader, WritingSystemDefinitionV1 ws)
		{
			Debug.Assert(writer != null);
			Debug.Assert(ws != null);
			Debug.Assert(ws.SortUsing == WritingSystemDefinitionV1.SortRulesType.CustomSimple);

			var parser = new SimpleRulesParser();
			string message;
			// avoid throwing exception, just don't save invalid data
			if (!parser.ValidateSimpleRules(ws.SortRules ?? string.Empty, out message))
			{
				return;
			}
			string icu = parser.ConvertToIcuRules(ws.SortRules ?? string.Empty);
			WriteCollationRulesFromICUString(writer, reader, icu);
		}