Пример #1
0
        static uSyncSettings()
        {
            try
            {
                ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
                fileMap.ExeConfigFilename = IOHelper.MapPath(string.Format("~/config/{0}", _settingfile));

                if (System.IO.File.Exists(fileMap.ExeConfigFilename))
                {
                    // load the settings file
                    config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);

                    if (config != null)
                    {
                        _settings = (uSyncSettingsSection)config.GetSection("usync");
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Info <uSyncSettings>("Error loading settings file {0}", () => ex.ToString());
            }
            finally
            {
                if (_settings == null)
                {
                    LogHelper.Info <uSyncSettings>("WARNING: Working with no config file");
                    _settings = new uSyncSettingsSection(); // default config - won't be savable mind?
                }
            }
        }
Пример #2
0
        static uSyncSettings()
        {
            try
            {
                ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
                fileMap.ExeConfigFilename = IOHelper.MapPath(string.Format("~/config/{0}", _settingfile));

                // load the settings file
                Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
                
                _settings = (uSyncSettingsSection)config.GetSection("usync");
            }
            catch (Exception ex)
            {
                LogHelper.Info<uSyncSettings>("Settings Path [{0}]", ()=> _settingfile);
                LogHelper.Error<uSyncSettings>("Error loading settings file", ex);
            }
        }
        static uSyncSettings()
        {
            try
            {
                ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
                fileMap.ExeConfigFilename = IOHelper.MapPath(string.Format("~/config/{0}", _settingfile));

                // load the settings file
                Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
                
                _settings = (uSyncSettingsSection)config.GetSection("usync");
            }
            catch (Exception ex)
            {
                Log.Add(LogTypes.Error, 0, string.Format("Error loading settings file {0}", ex.ToString()));
            }
        }