Пример #1
0
        public int CountOfOccurrences()
        {
            if (File.Exists(this.path))
            {
                string text = File.ReadAllText(this.path);
                this.wordProcessing = new WordProcessing(text);
                return(this.wordProcessing.CountOfOccurrences(this.substring));
            }

            return(-1);
        }
Пример #2
0
        public bool ReplaseText()
        {
            if (File.Exists(this.path))
            {
                string text = File.ReadAllText(this.path);
                this.wordProcessing = new WordProcessing(text);
                string newText = this.wordProcessing.GetReplasedText(this.substring, this.newSubstring);
                File.WriteAllText(this.path, newText, System.Text.Encoding.UTF8);
                return(true);
            }

            return(false);
        }