Exemplo n.º 1
0
        private void UserConfig_configChanged(object sender, UserConfig.ConfigChangeInfo configChangeType)
        {
            switch (configChangeType.changeType)
            {
            case ConfigChangeType.localFolder:
                _monitorPath = configChangeType.changInfo;
                IniFileOperator.setKeyValue(ConfigChangeType.localFolder.ToString(), _monitorPath, _configFileName);
                fileWachter.startWatchProcess(_monitorPath);
                break;

            case ConfigChangeType.serverAddress:
                if (_serverAddress != configChangeType.changInfo)
                {
                    _serverAddress = configChangeType.changInfo;
                    IniFileOperator.setKeyValue(ConfigChangeType.serverAddress.ToString(), _serverAddress, _configFileName);
                }
                break;

            case ConfigChangeType.userName:
                if (_userName != configChangeType.changInfo)
                {
                    _userName            = configChangeType.changInfo;
                    connectInfoIsChanged = true;
                    IniFileOperator.setKeyValue(ConfigChangeType.userName.ToString(), _userName, _configFileName);
                }
                break;

            case ConfigChangeType.passWord:
                if (_userPassWd != configChangeType.changInfo)
                {
                    _userPassWd          = configChangeType.changInfo;
                    connectInfoIsChanged = true;
                    IniFileOperator.setKeyValue(ConfigChangeType.passWord.ToString(), _userPassWd, _configFileName);
                }
                break;

            case ConfigChangeType.remoteFolder:
                _remotePath = configChangeType.changInfo;
                IniFileOperator.setKeyValue(ConfigChangeType.remoteFolder.ToString(), _remotePath, _configFileName);
                break;

            case ConfigChangeType.fileFilter:
                string[] splitchar = new string[] { ";" };
                _fileFilter = configChangeType.changInfo.Split(splitchar, StringSplitOptions.RemoveEmptyEntries);
                IniFileOperator.setKeyValue(ConfigChangeType.fileFilter.ToString(), configChangeType.changInfo, _configFileName);
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        private void configLoad()
        {
            _monitorPath = IniFileOperator.getKeyValue(ConfigChangeType.localFolder.ToString(), _configFileName);
            if (_monitorPath.Length > 0)
            {
                fileWachter.startWatchProcess(_monitorPath);
            }
            _serverAddress = IniFileOperator.getKeyValue(ConfigChangeType.serverAddress.ToString(), _configFileName);
            _userName      = IniFileOperator.getKeyValue(ConfigChangeType.userName.ToString(), _configFileName);
            _userPassWd    = IniFileOperator.getKeyValue(ConfigChangeType.passWord.ToString(), _configFileName);
            _remotePath    = IniFileOperator.getKeyValue(ConfigChangeType.remoteFolder.ToString(), _configFileName);
            string fileFilters = IniFileOperator.getKeyValue(ConfigChangeType.fileFilter.ToString(), _configFileName);

            string[] splitchar = new string[] { ";" };
            _fileFilter = fileFilters.Split(splitchar, StringSplitOptions.RemoveEmptyEntries);
            userConfig.textBox_fileFilter.Text    = fileFilters;
            userConfig.textBox_serverAddress.Text = _serverAddress;
            userConfig.textBox_localFolder.Text   = _monitorPath;
            userConfig.textBox_passWord.Text      = _userPassWd;
            userConfig.textBox_userName.Text      = _userName;
            userConfig.textBox_remoteFolder.Text  = _remotePath;
        }