Fix Osai problems

This commit is contained in:
Nicola Carminati
2018-08-30 14:51:48 +00:00
parent c0d9df06a8
commit c3053b58e1
3 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -395,7 +395,7 @@ namespace CMS_CORE_Library
public static readonly string[] VALID_PP_FORMATS = { ".txt", ".cnc", ".ini" };
public static readonly string[] VALID_IMAGE_FORMATS = { ".jpg", ".jpeg", ".png" };
public static readonly string IMAGES_PATH = @"C:/CMS/STEP/pp_img/";
public static readonly string IMAGES_PATH = @"C:\CMS\STEP\pp_img\";
public const int USER_SOFTKEYS_NUMBER = 128;
public const int NC_SOFTKEYS_NUMBER = 32;
+4 -3
View File
@@ -2006,7 +2006,8 @@ namespace CMS_CORE.Osai
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
return GetNCError(errorClass, errorNum);
fileInfo.PreviewBase64 = FindImageBase64String(IMAGES_PATH, fileInfo.Name);
fileInfo.Name = filesearch.FileName;
fileInfo.PreviewBase64 = FindImageBase64String(IMAGES_PATH, GetFilepathWithoutExt(filesearch.FileName));
nReturn = OpenNC.LogFSFindClose(findHandler, out errorClass, out errorNum);
@@ -2127,9 +2128,9 @@ namespace CMS_CORE.Osai
{
// Open file
FileStream fileStream = new FileStream(localPath + "\\" + name, FileMode.Open);
newFilePath = NC_PROGRAM_UPLOAD_PATH + "\\" + name;
newFilePath = NC_PROGRAM_UPLOAD_PATH + name;
// Transfer file on NC
CmsError cmsError = FILES_WProgramFromFile(NC_PROGRAM_UPLOAD_PATH + newFilePath, fileStream);
CmsError cmsError = FILES_WProgramFromFile(newFilePath, fileStream);
if (cmsError.IsError())
return cmsError;
+2 -2
View File
@@ -176,10 +176,10 @@ namespace CMS_CORE.Utils
{
foreach (string ext in VALID_IMAGE_FORMATS)
{
if (File.Exists(directoryPath + "/" + imageName + ext))
if (File.Exists(directoryPath + "\\" + imageName + ext))
{
// Convert image to a base 64 string
return "data:image/" + ext + ";base64," + Convert.ToBase64String(File.ReadAllBytes(directoryPath + "/" + imageName + ext));
return "data:image/" + ext + ";base64," + Convert.ToBase64String(File.ReadAllBytes(directoryPath + "\\" + imageName + ext));
}
}