Skip to content

Form1.cs | GetFiles

HackTheDev edited this page May 3, 2021 · 3 revisions

The method GetFiles() is responsible for collecting all Drives that are connected to the machine. For each drive it has found, it will call another method called ShowAllFoldersUnder(). write() is a simple method to pass text into the TextBox Control.

            try
            {
                write("Getting Drives...");

                foreach (var drive in DriveInfo.GetDrives())
                {
                    try
                    {
                        write("Found drive " + drive.Name);

                        try
                        {
                            ShowAllFoldersUnder(drive.Name, 0);
                        }
                        catch { }
                    }
                    catch (Exception ex1)
                    {
                        write("ex1 " + ex1.Message);
                    }
                }
            }
            catch(Exception ex)
            {

            }

            write("Done getting stuff :)");
Clone this wiki locally