From a8d5f88f3dfc1e7bd71ba87f10a2252b843a3dfa Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 2 Apr 2026 18:02:44 +0200 Subject: [PATCH] cancellazione file inutilizzati x WebAPI (abbozzata) --- MP-IO/Controllers/WebAPI/CacheFilter.cs | 28 -------- MP-IO/Controllers/WebAPI/IOBController.cs | 88 ----------------------- MP-IO/MP-IO.csproj | 1 - 3 files changed, 117 deletions(-) delete mode 100644 MP-IO/Controllers/WebAPI/CacheFilter.cs delete mode 100644 MP-IO/Controllers/WebAPI/IOBController.cs diff --git a/MP-IO/Controllers/WebAPI/CacheFilter.cs b/MP-IO/Controllers/WebAPI/CacheFilter.cs deleted file mode 100644 index 7abef2a6..00000000 --- a/MP-IO/Controllers/WebAPI/CacheFilter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http.Headers; -using System.Web; -using System.Web.Http.Filters; - -namespace MP_IO.Controllers.WebAPI -{ - /// - /// Gestione cache x chaimate WebAPI - /// - /// rif: https://www.c-sharpcorner.com/article/implementing-caching-in-web-api/ - /// - public class CacheFilter : ActionFilterAttribute - { - public int TimeDuration { get; set; } - public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) - { - actionExecutedContext.Response.Headers.CacheControl = new CacheControlHeaderValue - { - MaxAge = TimeSpan.FromSeconds(TimeDuration), - MustRevalidate = true, - Public = true - }; - } - } -} \ No newline at end of file diff --git a/MP-IO/Controllers/WebAPI/IOBController.cs b/MP-IO/Controllers/WebAPI/IOBController.cs deleted file mode 100644 index e9ddb9f9..00000000 --- a/MP-IO/Controllers/WebAPI/IOBController.cs +++ /dev/null @@ -1,88 +0,0 @@ -using MapoDb; -using SteamWare; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; - -namespace MP_IO.Controllers.WebAPI -{ - public class IOBController : ApiController - { - /// - /// GET api/IOB - /// è un check alive del server - /// - /// - [CacheFilter(TimeDuration = 10)] - [HttpGet] - public string Get() - { - if (memLayer.ML.CRB("IOB_RedEnab")) - { - // conto la richiesta nel contatore REDIS - long nCall = memLayer.ML.setRCntI(DataLayer.mHash("COUNT:pCall:IOB_INDEX")); - //... se == nCall2Log scrivo su log e resetto - long nCall2Log = memLayer.ML.cdvi("nCall2Log"); - if (nCall >= nCall2Log) - { - // loggo - logger.lg.scriviLog(string.Format("IOB_INDEX: effettuate {0} call", nCall), tipoLog.INFO); - // resetto! - memLayer.ML.resetRCnt(DataLayer.mHash("COUNT:pCall:IOB_INDEX")); - } - } - return "OK"; - } - - /// - /// GET api/IOB/SIMUL_03 - /// Verifica stato enabled di un determinato IOB - /// - /// - /// - [CacheFilter(TimeDuration = 5)] - [HttpGet] - public string Get(string id) - { - string answ = "ND"; - // se id nullo --> KO! - if (id == null) - { - answ = "KO"; - } - else - { - try - { - DataLayer DataLayerObj = new DataLayer(); - // salvo risposta! - answ = DataLayerObj.insEnab(id) ? "OK" : "NO"; - } - catch (Exception exc) - { - logger.lg.scriviLog(string.Format("Errore in enabled{0}{1}", Environment.NewLine, exc)); - answ = "NO"; - } - } - return answ; - } - - // POST api/ - public void Post([FromBody]string value) - { - } - - // PUT api//5 - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api//5 - public void Delete(int id) - { - } - } -} \ No newline at end of file diff --git a/MP-IO/MP-IO.csproj b/MP-IO/MP-IO.csproj index 14f71033..10812394 100644 --- a/MP-IO/MP-IO.csproj +++ b/MP-IO/MP-IO.csproj @@ -416,7 +416,6 @@ -