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.
CodePudding user response:
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
}
}