diff --git a/Libs/CMS_CORE_Library.dll b/Libs/CMS_CORE_Library.dll index 9ebad76b..532637c8 100644 Binary files a/Libs/CMS_CORE_Library.dll and b/Libs/CMS_CORE_Library.dll differ diff --git a/Step.NC/NcHandler.cs b/Step.NC/NcHandler.cs index 26015025..88dbd310 100644 --- a/Step.NC/NcHandler.cs +++ b/Step.NC/NcHandler.cs @@ -3,6 +3,7 @@ using CMS_CORE.Demo; using CMS_CORE.Fanuc; using CMS_CORE.Osai; using CMS_CORE.Siemens; +using CMS_CORE_Library; using Step.Database.Controllers; using Step.Model.DatabaseModels; using Step.Model.DTOModels; @@ -63,6 +64,22 @@ namespace Step.NC return null; } + #region File manager + + public CmsError GetFileList(string path, out List fileList) + { + fileList = new List(); + return numericalControl.FILES_RGetFileList(path, ref fileList); + } + + public CmsError GetFileInfo(string path, out InfoFile fileInfo) + { + fileInfo = new InfoFile(); + return numericalControl.FILES_RGetFileInfo(path, ref fileInfo); + } + + #endregion + #region Read Data public CmsError GetNcGenericData(out DTONcGenericDataModel genericData) @@ -1036,6 +1053,11 @@ namespace Step.NC return numericalControl.TOOLS_WUnloadToolFromShank(shankId, positionId); } + public CmsError GetFileList(string filePath, out PreviewFileModel fileList) + { + throw new NotImplementedException(); + } + #endregion #endregion Write data } diff --git a/Step/Controllers/WebApi/NcFileController.cs b/Step/Controllers/WebApi/NcFileController.cs new file mode 100644 index 00000000..901b622c --- /dev/null +++ b/Step/Controllers/WebApi/NcFileController.cs @@ -0,0 +1,49 @@ +using Step.NC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; +using static CMS_CORE_Library.DataStructures; + +namespace Step.Controllers.WebApi +{ + + [RoutePrefix("api/file_manager")] + + public class NcFileController : ApiController + { + + [Route("files"), HttpGet] + public IHttpActionResult GetFileList(string filePath = "") + { + using (NcHandler ncHandler = new NcHandler()) + { + ncHandler.Connect(); + + CmsError cmsError = ncHandler.GetFileList(filePath, out List fileList); + if (cmsError.IsError()) + return BadRequest(cmsError.localizationKey); + + return Ok(fileList); + } + } + + + [Route("file/info/{*filePath}"), HttpGet] + public IHttpActionResult GetFileInfo(string filePath) + { + using (NcHandler ncHandler = new NcHandler()) + { + ncHandler.Connect(); + + CmsError cmsError = ncHandler.GetFileInfo(filePath, out InfoFile fileInfo); + if (cmsError.IsError()) + return BadRequest(cmsError.localizationKey); + + return Ok(fileInfo); + } + } + } +} diff --git a/Step/Step.csproj b/Step/Step.csproj index 665c8111..66139d96 100644 --- a/Step/Step.csproj +++ b/Step/Step.csproj @@ -175,6 +175,7 @@ +