From 382e417910bb13e95429b2e87d9ecb9d4da7409c Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 21 Dec 2018 16:27:59 +0100 Subject: [PATCH] Update x levare molte eccezioni --- SteamWareLib/memLayer.cs | 61 ++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/SteamWareLib/memLayer.cs b/SteamWareLib/memLayer.cs index 5effe1a..78913cd 100644 --- a/SteamWareLib/memLayer.cs +++ b/SteamWareLib/memLayer.cs @@ -260,14 +260,16 @@ namespace SteamWare resetAppConf(); } // provo a leggere da DICT - try + if (AppConf.ContainsKey(chiave)) { - answ = AppConf[chiave]; - } - catch (Exception exc) - { - logger.lg.scriviLog(string.Format("Errore in lettura AppConf[{0}] durante configDbVal{1}{2}", chiave, Environment.NewLine, exc), tipoLog.EXCEPTION); - + try + { + answ = AppConf[chiave]; + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in lettura AppConf[{0}] durante configDbVal{1}{2}", chiave, Environment.NewLine, exc), tipoLog.EXCEPTION); + } } } } @@ -290,13 +292,17 @@ namespace SteamWare public bool cdvb(string chiave) { bool answ = false; - try + string sVal = configDbVal(chiave); + if (sVal != "") { - answ = Convert.ToBoolean(configDbVal(chiave)); - } - catch (Exception exc) - { - logger.lg.scriviLog(string.Format("Errore in lettura chiave [{0}] durante cdvb{1}{2}", chiave, Environment.NewLine, exc), tipoLog.EXCEPTION); + try + { + answ = Convert.ToBoolean(configDbVal(chiave)); + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in lettura chiave [{0}] durante cdvb{1}{2}", chiave, Environment.NewLine, exc), tipoLog.EXCEPTION); + } } return answ; } @@ -308,13 +314,17 @@ namespace SteamWare public int cdvi(string chiave) { int answ = -1; - try + string sVal = configDbVal(chiave); + if (sVal != "") { - answ = Convert.ToInt32(configDbVal(chiave)); - } - catch (Exception exc) - { - logger.lg.scriviLog(string.Format("Errore in lettura chiave [{0}] durante cdvi{1}{2}", chiave, Environment.NewLine, exc), tipoLog.EXCEPTION); + try + { + answ = Convert.ToInt32(configDbVal(chiave)); + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in lettura chiave [{0}] durante cdvi{1}{2}", chiave, Environment.NewLine, exc), tipoLog.EXCEPTION); + } } return answ; } @@ -479,12 +489,15 @@ namespace SteamWare public string QSS(string nome) { string answ = ""; - try + if (HttpContext.Current.Request.QueryString[nome] != null) { - answ = HttpContext.Current.Request.QueryString[nome].ToString().Trim(); + try + { + answ = HttpContext.Current.Request.QueryString[nome].ToString().Trim(); + } + catch + { } } - catch - { } return answ; } /// @@ -1071,7 +1084,6 @@ namespace SteamWare /// svuota una variabile dalla Cache /// /// - /// public bool emptyCacheVal(string nomeVar) { bool _done = false; @@ -1164,6 +1176,7 @@ namespace SteamWare catch (Exception exc) { answ = new Dictionary(); + logger.lg.scriviLog(string.Format("Errore in tabelleInCache{0}{1}", Environment.NewLine, exc)); } return answ; }