C# Recursion – File Processing

I have made an important improvement to my C# script that parses an entire web application for significant code. I have added the ability to parse subdirectories using a recursive function. This was necessary because not all web applications keep all their scripts in one directory. Many web applications try to organize the scripts by using subdirectories. My C Sharp script needed to parse all the files in the root directory and then move on to parse the files in all the subdirectories. It does this by using a function to process a directory and then recursively calls that function for each subdirectory within that directory.

I use my C# script to search web application files for SQL statements; INSERT INTO, DELETE FROM, and UPDATE SET kinds of SQL Statements. I get a list of table names from the database information schema and then plug that table name into the SQL statement fragment in order to find the web application files that are adding records, deleting records, or updating records in that table. This gives me a very useful report on the web application design. I even output the line numbers where the SQL statements can be found. It saves me a lot of time when I need to search through the code of a web application that I did not create.

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.