Added Fanuc fileList

This commit is contained in:
Lucio Maranta
2018-10-24 15:46:16 +00:00
parent 89b1ead2d4
commit 4cac0d226c
3 changed files with 81 additions and 4 deletions
+2 -2
View File
@@ -139,8 +139,8 @@ namespace CMS_CORE_Application
Stopwatch st = new Stopwatch();
sw.Restart();
ActiveProgramDataModel a = new ActiveProgramDataModel();
cmsError = N.FILES_RActiveProgramData(1, ref a);
List<PreviewFileModel> p = new List<PreviewFileModel>();
cmsError = N.FILES_RGetFileList("", ref p);
OffsetModel offset = new OffsetModel();
N.TOOLS_ROffset(1, ref offset);
+78
View File
@@ -2000,6 +2000,84 @@ namespace CMS_CORE_Library.Fanuc
public override CmsError FILES_RGetFileList(string path, ref List<PreviewFileModel> files)
{
try
{
ODBPDFDRV baseDir = new ODBPDFDRV();
short nReturn = cnc_rdpdf_drive(nLibHandle[0], baseDir);
path = "//" + baseDir.drive1 + "/USER/PATH1/";
ODBPDFNFIL dataNum = new ODBPDFNFIL();
nReturn = Focas1.cnc_rdpdf_subdirn(nLibHandle[0], path, dataNum);
if (nReturn != 0)
return GetNcError(nReturn);
IDBPDFSDIR currDirInput = new IDBPDFSDIR();
ODBPDFSDIR currDirOutData = new ODBPDFSDIR();
short maxDir = 1;
// Read directories names
if (dataNum.dir_num > 0)
{
// Setup input data
currDirInput.dummy = 0;
currDirInput.path = path;
for(short i = 0; i < dataNum.dir_num; i++)
{
// Update index
currDirInput.req_num = i;
// Read directory data
nReturn = cnc_rdpdf_subdir(nLibHandle[0], ref maxDir, currDirInput, currDirOutData);
if (nReturn != 0)
return GetNcError(nReturn);
// Add to list read data
files.Add(new PreviewFileModel()
{
AbsolutePath = path + currDirOutData.d_f,
IsDirectory = true,
Name = Path.GetDirectoryName(currDirOutData.d_f),
Path = path
});
}
}
// Read files names
if(dataNum.file_num > 0)
{
IDBPDFADIR funcInput = new IDBPDFADIR();
ODBPDFADIR fileData = new ODBPDFADIR();
// Setup input data
funcInput.path = path;
funcInput.type = 1;
funcInput.size_kind = 1;
funcInput.dummy = 0;
for (short i = 0; i < dataNum.file_num; i++)
{
funcInput.req_num = i; // Update file index
// Read file data
nReturn = Focas1.cnc_rdpdf_alldir(nLibHandle[0], ref maxDir, funcInput, fileData);
if (nReturn != 0)
return GetNcError(nReturn);
// Add to list read data
files.Add(new PreviewFileModel()
{
AbsolutePath = path + fileData.d_f,
IsDirectory = false,
Name = fileData.d_f,
Path = path
});
}
}
}
catch(Exception ex)
{
}
return NO_ERROR;
}
+1 -2
View File
@@ -1912,7 +1912,6 @@ namespace CMS_CORE_Library.Osai
{
ushort nReturn;
string temppath;
uint findHandler;
bool found;
FILEFINDDATA filesearch = new FILEFINDDATA();
@@ -1924,7 +1923,7 @@ namespace CMS_CORE_Library.Osai
temppath = path;
temppath = temppath.TrimStart('\\');
nReturn = OpenNC.LogFSFindFirst(NC_PROGRAM_PATH + temppath + "\\*", out filesearch, out findHandler, out uint errorClass, out uint errorNum);
nReturn = OpenNC.LogFSFindFirst(NC_PROGRAM_PATH + temppath + "\\*", out filesearch, out uint findHandler, out uint errorClass, out uint errorNum);
//If there's an error
if (errorClass != 0 || errorNum != 0 || nReturn == 0)