Exemple #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
            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("");
        }
Exemple #2
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 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("");
        }
Exemple #3
0
        public string GetSequenceResult(List <Key> sequence, bool ignore_case)
        {
            Search flags = Search.Sequences;

            if (ignore_case)
            {
                flags |= Search.IgnoreCase;
            }
            SequenceTree node = GetSubtree(sequence, flags);

            return(node == null ? "" : node.m_result);
        }
Exemple #4
0
        public static void LoadSequences()
        {
            m_sequences      = new SequenceTree();
            m_sequence_count = 0;

            LoadSequenceFile(Path.Combine(GetDataDir(), "Xorg.txt"));
            LoadSequenceFile(Path.Combine(GetDataDir(), "XCompose.txt"));
            LoadSequenceFile(Path.Combine(GetDataDir(), "Emoji.txt"));
            LoadSequenceFile(Path.Combine(GetDataDir(), "WinCompose.txt"));

            LoadSequenceFile(Path.Combine(GetUserDir(), ".XCompose"));
            LoadSequenceFile(Path.Combine(GetUserDir(), ".XCompose.txt"));
        }
Exemple #5
0
        public static void LoadSequences()
        {
            m_sequences = new SequenceTree();

            m_sequences.LoadResource("3rdparty.xorg.rules");
            m_sequences.LoadResource("3rdparty.xcompose.rules");

            m_sequences.LoadFile(Path.Combine(GetDataDir(), "Emoji.txt"));
            m_sequences.LoadFile(Path.Combine(GetDataDir(), "WinCompose.txt"));

            m_sequences.LoadFile(Path.Combine(GetUserDir(), ".XCompose"));
            m_sequences.LoadFile(Path.Combine(GetUserDir(), ".XCompose.txt"));
        }