Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how can i detect if there are different folders in the my game folder?

string[] folderNames = new[]
{
"anim",
"audio",
"cleo",
"custom_models",
"data",
"libraries",
"models",
"modloader",
"movies",
"SAMP",
"text"
};

string gameFolder = oyunDizin;

        foreach (var folderName in folderNames)
        {
            if (Directory.Exists(gameFolder + folderName))
            {


                MessageBox.Show(folderName + " İzinli");
            }
            else
            {
                MessageBox.Show(folderName + " İzinsiz");
 }


    }

I want detect if there are different folders in my gta san andreas folder? Granted folders in a folderNames but i want if i have not granted folder messagebox error.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

use Directory.GetDirectories() to scan existing folders in your root folder

foreach (string f in Directory.GetDirectories(gameFolder))
{
    if(!folderNames.Contains(Path.GetFileName(f)))
    {
        //show error
    }
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading