Fix gestione traduzioni (mancava serializzazione in redis x flags)
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Newtonsoft.Json;
|
||||
using SteamWare;
|
||||
|
||||
namespace CMS_SC.WebUserControls
|
||||
@@ -20,13 +21,29 @@ namespace CMS_SC.WebUserControls
|
||||
// se trovo da cache restituisco...
|
||||
if (memLayer.ML.isInCacheObject("FlagList.map"))
|
||||
{
|
||||
answ = (Dictionary<string, string>)memLayer.ML.objCacheObj("FlagList.map");
|
||||
if (memLayer.ML.cacheOnRedis)
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<Dictionary<string, string>>(memLayer.ML.objCacheObj("FlagList.map").ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = (Dictionary<string, string>)memLayer.ML.objCacheObj("FlagList.map");
|
||||
}
|
||||
}
|
||||
// altrimenti rileggo....
|
||||
else
|
||||
{
|
||||
answ= getDictFromFile("FlagList.map");
|
||||
memLayer.ML.setCacheVal("FlagList.map", answ);
|
||||
answ = getDictFromFile("FlagList.map");
|
||||
// salvo serializzando se necessario
|
||||
if (memLayer.ML.cacheOnRedis)
|
||||
{
|
||||
string serVal = JsonConvert.SerializeObject(answ);
|
||||
memLayer.ML.setCacheVal("FlagList.map", serVal, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
memLayer.ML.setCacheVal("FlagList.map", answ, true);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -54,7 +71,7 @@ namespace CMS_SC.WebUserControls
|
||||
// se la linea non è commento e non è vuota...
|
||||
if (line.Length > 0 && line[0] != '#')
|
||||
{
|
||||
string[] tokens = line.Split(':');
|
||||
string[] tokens = line.Split('|');
|
||||
answ.Add(tokens[0], tokens[1]);
|
||||
}
|
||||
}
|
||||
@@ -130,7 +147,7 @@ namespace CMS_SC.WebUserControls
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
catch(Exception exc)
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(exc.ToString(), tipoLog.EXCEPTION);
|
||||
strLenght = 0;
|
||||
|
||||
Reference in New Issue
Block a user