Example #1
0
        public bool IsExistOtherSymbols()
        {
            ReadFile();
            var listText = StringExtensional.RemoveNewlines(StringWithMultipleSpaces);
            //string infoAboutSymbols = CustomConfig.FileFormatStringInfo.StringFormatInfo;
            string pattern = "[А-Яа-яЁё]+";

            if (Regex.IsMatch(StringWithMultipleSpaces, pattern))
            {
                for (int i = 0; i < listText.Count; i++)
                {
                    foreach (Match match in Regex.Matches(listText[i], pattern))
                    {
                        string infoAboutSymbols = String.Format(CustomConfig.FileFormatStringSubstringInfo.StringFormatInfo, i + 1, match.Index, match.Value);
                        var    strToChange      = ReplaceSymbols(match.Value);
                        listText[i] = listText[i].Replace(match.Value, strToChange);
                        if (isReplaceable)
                        {
                            Log.WriteSymbolsInfo(infoAboutSymbols + " - the value can be replaced");
                        }
                        else
                        {
                            Log.WriteSymbolsInfo(infoAboutSymbols);
                        }
                    }
                }
            }
            Log.WriteScanResult(countSymbolsIsReplaced, countSymbolsNotReplaced);

            if (countSymbolsIsReplaced > 0)
            {
                listChangeText = listText;
                if (EnableCopyFile)
                {
                    CopyFile();
                }
                if (EnableSaveFile)
                {
                    SaveChanges();
                }
                return(true);
            }
            return(false);
        }
Example #2
0
        public bool IsExistOtherSymbols()
        {
            ReadFile();
            var listText = StringExtensional.RemoveNewlines(StringWithMultipleSpaces);

            string pattern = "[А-Яа-яЁё]+";

            if (Regex.IsMatch(StringWithMultipleSpaces, pattern))
            {
                for (int i = 0; i < listText.Count; i++)
                {
                    foreach (Match match in Regex.Matches(listText[i], pattern))
                    {
                        string infoAboutSymbols = $" lN ={i + 1}, Start index= {match.Index}, Text = {match.Value}";
                        var    strToChange      = ReplaceSymbols(match.Value);
                        listText[i] = listText[i].Replace(match.Value, strToChange);
                        if (isReplaceable)
                        {
                            ConsoleLog.WriteSymbolsInfo(infoAboutSymbols + " - the value can be replaced");
                        }
                        else
                        {
                            ConsoleLog.WriteSymbolsInfo(infoAboutSymbols);
                        }
                    }
                }
            }
            ConsoleLog.WriteScanResult(countSymbolsIsReplaced, countSymbolsNotReplaced);

            if (countSymbolsIsReplaced > 0)
            {
                listChangeText = listText;
                return(true);
            }
            return(false);
        }