我目前正在处理应用程序从文件夹中获取文件并到达每个图像以获取条形码的项目。当它读取条形码时,它会将所有非条形码文件推送到数组中,并且该文件数组将与目的地中具有唯一名称的多页单 tiff 图像合并。我所做的一切和它的工作,但我想使用线程让它快速。我有这样的功能 -
- 读取图像文件直到达到条形码。
- 在目标文件夹中创建一个唯一的名称
- 制作多页单tiff图像
- 将其保存在目标文件夹中。
阅读条形码我使用简单的条形码阅读器,我得到图像有条形码或没有条形码。我在 foreach 循环中处理数组。一些代码在这里
foreach (string path in filenames_1)
{
Image bmp = Bitmap.FromFile(path);
Bitmap bn = (Bitmap)bmp;
readimage(bn);
if (s == 1) //If it is Bookmarked Content Found Then s=1 else its s=0
{
if (z == 0) // i used z coz in my process first file in directory is barcode image so first time have to skip it so i set z=1 at begining and second time it become 0 and process continues
{
j = 3; continue;
MakeUnique("c:\\sachin.tiff");
ConvertToMultiPageTiff(fileNames, fnamem);
fileNames.Clear();
}
fileNames.Add(path);
j = 1;
if (z == 0)
{
j = 3;
}
else
{
}
}
else
{
if (j == 1) // j==1 means its regular tiff file wher i make them add to string array
{
fileNames.Add(path); // string array with files to be made multiple tiff image become single mulipage tiff image
j = 1;
z = 0;
}
if (j == 3)
{
z = 1;
j = 1;
fileNames.Add(path);
MakeUnique("c:\\sachin.tiff");
ConvertToMultiPageTiff(fileNames, fnamem); // this function converts all the added files in filearray of single tiff image to multiple page single tiff image
fileNames.Clear();
}
else
{
}
}
}
}
MakeUnique("c:\\sachin.tiff");
ConvertToMultiPageTiff(fileNames, fnamem);
fileNames.Clear();
}