Example #1
0
        public string GetSequenceResult(KeySequence sequence, bool ignore_case)
        {
            Search flags = Search.Sequences;

            if (ignore_case)
            {
                flags |= Search.IgnoreCase;
            }

            // First check if the sequence exists in our tree
            SequenceNode subtree = GetSubtree(sequence, flags);

            if (subtree != null && subtree.m_result != "")
            {
                return(subtree.m_result);
            }

            // Otherwise, check for a generic Unicode sequence
            if (Settings.UnicodeInput.Value)
            {
                var sequenceString = sequence.ToString().Replace(", ", "").ToLower(CultureInfo.InvariantCulture);
                var m = Regex.Match(sequenceString, @"^u([0-9a-f]{2,5})$");
                if (m.Success)
                {
                    int codepoint = Convert.ToInt32(m.Groups[1].Value, 16);
                    return(char.ConvertFromUtf32(codepoint));
                }
            }

            return("");
        }
Example #2
0
        public bool IsValidSequence(KeySequence sequence, bool ignore_case)
        {
            Search flags = Search.Sequences;

            if (ignore_case)
            {
                flags |= Search.IgnoreCase;
            }

            // First check if the sequence exists in our tree
            if (GetSubtree(sequence, flags) != null)
            {
                return(true);
            }

            // Otherwise, check for generic Unicode sequence
            if (Settings.UnicodeInput.Value)
            {
                var sequenceString = sequence.ToString().Replace(", ", "").ToLower(CultureInfo.InvariantCulture);
                return(Regex.Match(sequenceString, @"^u[0-9a-f]{2,5}$").Success &&
                       !Regex.Match(sequenceString, @"^ud[89a-f]..$").Success);
            }

            return(false);
        }
Example #3
0
        public static string GetGenericSequenceResult(KeySequence sequence)
        {
            if (!UnicodeInput.Value)
            {
                return("");
            }
            var seq_string = sequence.ToString().Replace(", ", "").ToLower(CultureInfo.InvariantCulture);
            var m          = m_match_gen_seq.Match(seq_string);

            if (!m.Success)
            {
                return("");
            }
            int codepoint = Convert.ToInt32(m.Groups[1].Value, 16);

            if (codepoint < 0 || codepoint > 0x10ffff)
            {
                return("");
            }
            if (codepoint >= 0xd800 && codepoint < 0xe000)
            {
                return("");
            }
            return(char.ConvertFromUtf32(codepoint));
        }
Example #4
0
        public string GetSequenceResult(KeySequence sequence, bool ignore_case)
        {
            Search flags = Search.Sequences;

            if (ignore_case)
            {
                flags |= Search.IgnoreCase;
            }

            // First check if the sequence exists in our tree
            SequenceTree subtree = GetSubtree(sequence, flags);

            if (subtree != null && subtree.m_result != "")
            {
                return(subtree.m_result);
            }

            // Otherwise, check for a generic Unicode sequence
            if (Settings.UnicodeInput.Value)
            {
                var m = Regex.Match(sequence.ToString(), @"^[uU][0-9a-fA-F]{2,5}$");
                if (m.Success)
                {
                    int codepoint = Convert.ToInt32(m.Groups[0].Value.Substring(1), 16);
                    return(char.ConvertFromUtf32(codepoint));
                }
            }

            return("");
        }
Example #5
0
        public static bool IsValidGenericSequence(KeySequence sequence)
        {
            if (!UnicodeInput.Value)
            {
                return(false);
            }
            var seq_string = sequence.ToString().Replace(", ", "").ToLower(CultureInfo.InvariantCulture);

            return(m_match_gen_seq.Match(seq_string).Success);
        }
Example #6
0
        public static bool IsValidGenericSequence(KeySequence sequence)
        {
            if (!UnicodeInput.Value)
            {
                return(false);
            }
            var sequenceString = sequence.ToString().Replace(", ", "").ToLower(CultureInfo.InvariantCulture);

            return(Regex.Match(sequenceString, @"^u[0-9a-f]{2,5}$").Success &&
                   !Regex.Match(sequenceString, @"^ud[89a-f]..$").Success);
        }
Example #7
0
        public static string GetGenericSequenceResult(KeySequence sequence)
        {
            if (!UnicodeInput.Value)
            {
                return("");
            }
            var sequenceString = sequence.ToString().Replace(", ", "").ToLower(CultureInfo.InvariantCulture);
            var m = Regex.Match(sequenceString, @"^u([0-9a-f]{2,5})$");

            if (!m.Success)
            {
                return("");
            }
            int codepoint = Convert.ToInt32(m.Groups[1].Value, 16);

            return(char.ConvertFromUtf32(codepoint));
        }
Example #8
0
        public bool IsValidSequence(KeySequence sequence, bool ignore_case)
        {
            Search flags = Search.Sequences;

            if (ignore_case)
            {
                flags |= Search.IgnoreCase;
            }

            // First check if the sequence exists in our tree
            if (GetSubtree(sequence, flags) != null)
            {
                return(true);
            }

            // Otherwise, check for generic Unicode sequence
            if (Settings.UnicodeInput.Value)
            {
                return(Regex.Match(sequence.ToString(), @"^[uU][0-9a-fA-F]{2,5}$").Success);
            }

            return(false);
        }