Esempio n. 1
0
        /// <summary> Handles the <see cref="E:FileStep" /> event.
        /// This function gets fired for each file handled
        /// </summary>
        /// <param name="e">The <see cref="FileStepEventArgs"/> instance containing the event data.</param>
        protected override void OnFileStep(FileStepEventArgs e)
        {
            var path = e.Info.FullName;

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            // var newLines = File.ReadAllLines(path).Where(oldLine => !oldLine.Contains( Filter ));
            var newLines = new List <string>( );

            foreach (var readAllLine in File.ReadAllLines(path))
            {
                if (readAllLine.Contains(Filter))
                {
                    var replace = readAllLine.Replace(Filter, Replacement);
                    newLines.Add(replace);
                }
                else
                {
                    newLines.Add(readAllLine);
                }
            }

            File.WriteAllLines(path, newLines);
        }
        /// <summary> Handles the <see cref="E:FileStep" /> event.
        /// This function gets fired for each file handled
        /// </summary>
        /// <param name="e">The <see cref="FileStepEventArgs"/> instance containing the event data.</param>
        protected override void OnFileStep(FileStepEventArgs e)
        {
            var path = e.Info.FullName;
            if( string.IsNullOrEmpty( path ) ) { return; }

            // var newLines = File.ReadAllLines(path).Where(oldLine => !oldLine.Contains( Filter ));
            var newLines = new List< string >( );
            foreach( var readAllLine in File.ReadAllLines( path ) ){
                if( readAllLine.Contains( Filter ) ){
                    var replace = readAllLine.Replace( Filter, Replacement );
                    newLines.Add( replace );
                }
                else{ newLines.Add( readAllLine ); }
            }

            File.WriteAllLines( path, newLines );
        }
 /// <summary>
 /// Handles the <see cref="E:FileStep" /> event.
 /// This function gets fired for each file handled
 /// </summary>
 /// <param name="e">The <see cref="FileStepEventArgs"/> instance containing the event data.</param>
 protected abstract void OnFileStep( FileStepEventArgs e );
Esempio n. 4
0
 /// <summary>
 /// Handles the <see cref="E:FileStep" /> event.
 /// This function gets fired for each file handled
 /// </summary>
 /// <param name="e">The <see cref="FileStepEventArgs"/> instance containing the event data.</param>
 protected abstract void OnFileStep(FileStepEventArgs e);