Esempio n. 1
0
        public Tuple <string, string>[] GetConfigs(String session)//, ILog logFile)
        {
            const string LOCAL = _MOD + "GetConfigs(ILog)";

            Tuple <string, string>[] retVal = null;

            try
            {
                Logging.LogMessage(Logging.LogType.Info,
                                   string.Format("Session: {0} ", session) + string.Format(Constants.FMT_ENTERING, LOCAL));

                string path = ReturnPath(_CONFIGS);

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                string[] ret = Directory.GetFiles(path + @"\", "*.config");
                retVal = (from S in ret
                          //let config = ConfigHandler.DeserializeConfig(logFile, S)
                          let config = ConfigHandler.DeserializeConfig(S)
                                       select new Tuple <string, string>(config.Name, config.Description)).ToArray <Tuple <string, string> >();
            }
            catch (Exception ex)
            {
                Logging.LogMessage(Logging.LogType.Error,
                                   string.Format("Session: {0} ", session) + string.Format(Constants.FMT_ERROR_IN, LOCAL), ex);
                retVal = null;
            }
            return(retVal);
        }
Esempio n. 2
0
        public VPMobileSettings GetConfig(String session, string configName)//, ILog logFile)
        {
            const string LOCAL = _MOD + "AddConfig(string, ILog)";

            VPMobileSettings retVal = null;

            try
            {
                Logging.LogMessage(Logging.LogType.Info,
                                   string.Format("Session: {0} ", session) + string.Format(Constants.FMT_ENTERING, LOCAL) +
                                   string.Format("configName: {0}", configName));

                string path = ReturnPath(_CONFIGS, string.Format(_FMT_CONFIG, configName));

                //retVal = File.Exists(path) ? ConfigHandler.DeserializeConfig( logFile, path) : null;
                retVal = File.Exists(path) ? ConfigHandler.DeserializeConfig(path) : null;

                return(retVal);
            }
            catch (Exception ex)
            {
                Logging.LogMessage(Logging.LogType.Error,
                                   string.Format("Session: {0} ", session) + string.Format(Constants.FMT_ERROR_IN, LOCAL), ex);
                retVal = null;
            }
            return(retVal);
        }