private void FindLongestWord(char[] word, int endIndex)
        {
            int trueLength = FindTrueLength(word);

            if (_longestWords.Count != 0)
            {
                for (int i = 0; i < _longestWords.Count; i++)
                {
                    if (trueLength >= _longestWords[i].Length)
                    {
                        if (trueLength > _longestWords[i].Length)
                        {
                            _longestWords.Clear();
                        }
                        _longestWords.Add(new EntryModel
                        {
                            StartIndex = endIndex - trueLength,
                            EndIndex   = endIndex,
                            TextColor  = GetColor.GetColorByCode(EntryCodes.LongestWord)
                        });
                        break;
                    }
                }
            }
            else
            {
                _longestWords.Add(new EntryModel
                {
                    StartIndex = endIndex - trueLength,
                    EndIndex   = endIndex,
                    TextColor  = GetColor.GetColorByCode(EntryCodes.LongestWord)
                });
            }
        }
        private void FindSymbols(char[] word, int endIndex, EntryCodes codes)
        {
            int trueLength = FindTrueLength(word);

            char[] symbols;
            bool   result = true;

            for (int i = 0; i < trueLength; i++)
            {
                symbols = LanguageGetter.GetCharArray(word[i], codes);
                if (symbols == null || !symbols.Contains(char.ToLower(word[i])))
                {
                    result = false;
                    break;
                }
            }
            if (result)
            {
                _entryModels.Add(new EntryModel
                {
                    StartIndex = endIndex - trueLength,
                    EndIndex   = endIndex,
                    TextColor  = GetColor.GetColorByCode(codes)
                });
            }
        }
Beispiel #3
0
 private void FindLongestWord(int endIndex, int trueLength, EntryCodes code)
 {
     if (_longestWords.Count > 0)
     {
         for (int i = 0; i < _longestWords.Count; i++)
         {
             if (trueLength >= _longestWords[i].Length)
             {
                 if (trueLength > _longestWords[i].Length)
                 {
                     _longestWords.Clear();
                 }
                 _longestWords.Add(new EntryModel
                 {
                     StartIndex = endIndex - trueLength,
                     EndIndex   = endIndex,
                     TextColor  = GetColor.GetColorByCode(code)
                 });
                 break;
             }
         }
     }
     else
     {
         _longestWords.Add(new EntryModel
         {
             StartIndex = endIndex - trueLength,
             EndIndex   = endIndex,
             TextColor  = GetColor.GetColorByCode(code)
         });
     }
 }
        private void FindBiggetsNum(char[] word, int endIndex)
        {
            int trueLength = FindTrueLength(word);

            char[] numPart = new char[trueLength];
            for (int i = 0; i < word.Length; i++)
            {
                if (char.IsDigit(word[i]))
                {
                    numPart[i] = word[i];
                }
                else
                {
                    break;
                }
            }
            int numTrueLength = FindTrueLength(numPart);

            if (numTrueLength != 0)
            {
                long newNum = long.Parse(new string(numPart));
                if (_biggestNums.Count != 0)
                {
                    for (int i = 0; i < _biggestNums.Count; i++)
                    {
                        if (newNum >= _biggestNums[i].Num)
                        {
                            if (newNum > _biggestNums[i].Num)
                            {
                                _biggestNums.Clear();
                            }
                            _biggestNums.Add(new EntryModelNum
                            {
                                StartIndex = endIndex - trueLength,
                                EndIndex   = endIndex - (trueLength - numTrueLength),
                                Num        = newNum,
                                TextColor  = GetColor.GetColorByCode(EntryCodes.LargestNumber)
                            });
                            break;
                        }
                    }
                }
                else
                {
                    _biggestNums.Add(new EntryModelNum
                    {
                        StartIndex = endIndex - trueLength,
                        EndIndex   = endIndex - (trueLength - numTrueLength),
                        Num        = newNum,
                        TextColor  = GetColor.GetColorByCode(EntryCodes.LargestNumber)
                    });
                }
            }
        }
        private ObservableCollection <ColorInfo> Load_Colors()
        {
            var        result     = new ObservableCollection <ColorInfo>();
            EntryCodes entryCodes = new EntryCodes();

            foreach (var meaning in Enum.GetValues(entryCodes.GetType()))
            {
                result.Add(new ColorInfo
                {
                    Mean = GetCode.GetCodeMeaning((EntryCodes)meaning),
                    Name = GetColor.GetColorByCode((EntryCodes)meaning).Name
                });
            }
            return(result);
        }
Beispiel #6
0
        private void FindNumber(char[] word, int endIndex, int trueLength, EntryCodes code)
        {
            char[] numPart       = new char[trueLength];
            int    newIndex      = 0;
            bool   IsNumberFound = false;

            for (int i = 0; i < trueLength; i++)
            {
                if (char.IsDigit(word[i]))
                {
                    numPart[newIndex] = word[i];
                    IsNumberFound     = true;
                    newIndex++;
                }
                else if (word[i] == '-' && newIndex == 0)
                {
                    numPart[newIndex] = word[i];
                    newIndex++;
                }
                else
                {
                    break;
                }
            }
            int numTrueLength = numPart.FindTrueLength();

            if (IsNumberFound && numTrueLength != 0)
            {
                long newNum = long.Parse(new string(numPart));
                _numbers.Add(new EntryModelNum
                {
                    StartIndex = endIndex - trueLength,
                    EndIndex   = endIndex - (trueLength - numTrueLength),
                    Num        = newNum,
                    TextColor  = GetColor.GetColorByCode(code)
                });
            }
        }