110,571
社区成员
发帖
与我相关
我的任务
分享
string [] fileEntries = Directory.GetFiles(targetDirectory);
foreach(string fileName in fileEntries)
ProcessFile(fileName);
string path = @"materials\images"; //就是你数据库里存的图片所在文件夹的路径
string finalPath = "";
string[] type = new string[] { "实拍", "效果", "绘制" };
int n = 1;
int t = 0;
while (true)
{
if (t < 3)
{
finalPath = string.Format(@"{0}\{1}{2}.jpg", path, type[t], n);
//图片存在的话就直接返回图片路径,否则按照实拍>效果>绘制这样的顺序来取
if (File.Exists(string.Format(finalPath)))
{
break;
}
else
{
t++;
}
}
else
{
t = 0;
n++;
}
}
Console.WriteLine(finalPath);
materials\images\1.jpg 这难道不是路径?