[英]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”, “文本” };
字符串游戲文件夾 = oyunDizin;
foreach (var folderName in folderNames)
{
if (Directory.Exists(gameFolder + folderName))
{
MessageBox.Show(folderName + " İzinli");
}
else
{
MessageBox.Show(folderName + " İzinsiz");
}
}
我想檢測我的 gta san andreas 文件夾中是否有不同的文件夾? 授予文件夾名稱中的文件夾,但如果我沒有授予文件夾消息框錯誤,我想要。
使用Directory.GetDirectories()
掃描根文件夾中的現有文件夾
foreach (string f in Directory.GetDirectories(gameFolder))
{
if(!folderNames.Contains(Path.GetFileName(f)))
{
//show error
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.