ShaderInterpreter.Converter.CommentLinesWith C# (CSharp) Method

CommentLinesWith() private static method

Comments any line containing the specified pattern
private static CommentLinesWith ( string _Source, string _Pattern ) : string
_Source string
_Pattern string
return string
        private static string CommentLinesWith( string _Source, string _Pattern )
        {
            int	CurrentPosition = 0;
            int	MatchIndex = 0;
            while( true )
            {
                MatchIndex = _Source.IndexOf( _Pattern, CurrentPosition, StringComparison.InvariantCultureIgnoreCase );
                if ( MatchIndex == -1 )
                    break;

                // Insert comment at beginning of line
                int	BOLIndex = FindBOL( _Source, MatchIndex );
                _Source = _Source.Insert( BOLIndex, "// " );

                CurrentPosition = MatchIndex + 3 + 1;
            }

            return _Source;
        }