Example #1
0
        public static void ApplyConfig()
        {
            string pathRMExeConfig       = Path.Combine(Ambiente.Selected.pathRmnet, "RM.exe.config");
            string pathHostServiceConfig = Path.Combine(Ambiente.Selected.pathRmnet, "RM.Host.Service.exe.config");
            string pathHostAppConfig     = Path.Combine(Ambiente.Selected.pathRmnet, "RM.Host.exe.config");

            _actionsPath.Value               = ActionsPath;
            _apiPort.Value                   = ApiPort;
            _enableCompression.Value         = EnableCompression.ToString();
            _enableDynamicLocalization.Value = EnableDynamicLocalization.ToString();
            _host.Value                = Host;
            _httpPort.Value            = HttpPort;
            _jobServer3Camadas.Value   = JobServer3Camadas.ToString();
            _libPath.Value             = LibPath;
            _localizationLaguage.Value = LocalizationLaguage;
            _port.Value                = Port;
            _traceFileHost.Value       = TraceFileHost.ToString();
            _traceFileRMExe.Value      = TraceFileRMExe.ToString();
            _traceLs.Value             = TraceLs.ToString();
            _configPath.Value          = ConfigPath;
            _defaultDb.Value           = DefaultDb;
            _updateServer.Value        = UpdateServer;
            _updateServerEnabled.Value = UpdateServerEnabled.ToString();
            _fileServerPath.Value      = FileServerPath.ToString();

            ConfigAction.UpdateAll(_actionsPath, Ambiente.Selected.pathRmnet);
            ConfigAction.Update(_apiPort, pathHostServiceConfig);
            ConfigAction.Update(_apiPort, pathHostAppConfig);
            ConfigAction.UpdateAll(_enableCompression, Ambiente.Selected.pathRmnet);
            ConfigAction.UpdateAll(_enableDynamicLocalization, Ambiente.Selected.pathRmnet);
            ConfigAction.Update(_host, pathRMExeConfig);
            ConfigAction.Update(_httpPort, pathHostServiceConfig);
            ConfigAction.Update(_httpPort, pathHostAppConfig);
            ConfigAction.UpdateAll(_jobServer3Camadas, Ambiente.Selected.pathRmnet);
            ConfigAction.UpdateAll(_libPath, Ambiente.Selected.pathRmnet);
            ConfigAction.UpdateAll(_localizationLaguage, Ambiente.Selected.pathRmnet);
            ConfigAction.UpdateAll(_port, Ambiente.Selected.pathRmnet);
            ConfigAction.Update(_defaultDb, pathHostServiceConfig);
            ConfigAction.Update(_defaultDb, pathHostAppConfig);

            if (_jobServer3Camadas.Value.ToLower() == "true")
            {
                ConfigAction.Add(_fileServerPath, pathHostAppConfig);
                ConfigAction.Add(_fileServerPath, pathHostServiceConfig);
            }
            else
            {
                ConfigAction.Remove(_fileServerPath, pathHostAppConfig);
                ConfigAction.Remove(_fileServerPath, pathHostServiceConfig);
            }

            if (_updateServerEnabled.Value.ToLower() == "true")
            {
                ConfigAction.Remove(_updateServer, pathRMExeConfig);
                ConfigAction.Remove(_updateServerEnabled, pathHostAppConfig);
                ConfigAction.Remove(_updateServerEnabled, pathHostServiceConfig);

                ConfigAction.Add(_updateServer, pathRMExeConfig);
                ConfigAction.Add(_updateServerEnabled, pathHostAppConfig);
                ConfigAction.Add(_updateServerEnabled, pathHostServiceConfig);
            }
            else if (_updateServer.Value != "0" && _updateServer.Value != "")
            {
                ConfigAction.Remove(_updateServer, pathRMExeConfig);
                ConfigAction.Remove(_updateServerEnabled, pathHostAppConfig);
                ConfigAction.Remove(_updateServerEnabled, pathHostServiceConfig);

                ConfigAction.Add(_updateServer, pathRMExeConfig);
            }
            else
            {
                ConfigAction.Remove(_updateServer, pathRMExeConfig);
                ConfigAction.Remove(_updateServerEnabled, pathHostAppConfig);
                ConfigAction.Remove(_updateServerEnabled, pathHostServiceConfig);
            }


            if (_traceFileHost.Value.ToLower() == "true")
            {
                ConfigAction.Remove(_traceFileHost, pathHostServiceConfig);
                ConfigAction.Remove(_traceFileHost, pathHostAppConfig);

                ConfigAction.Add(_traceFileHost, pathHostServiceConfig);
                ConfigAction.Add(_traceFileHost, pathHostAppConfig);
            }
            else
            {
                ConfigAction.Remove(_traceFileHost, pathHostServiceConfig);
                ConfigAction.Remove(_traceFileHost, pathHostAppConfig);
            }
            if (_traceFileRMExe.Value.ToLower() == "true")
            {
                ConfigAction.Remove(_traceFileRMExe, pathRMExeConfig);
                ConfigAction.Add(_traceFileRMExe, pathRMExeConfig);
            }
            else
            {
                ConfigAction.Remove(_traceFileRMExe, pathRMExeConfig);
            }

            if (_traceLs.Value.ToLower() == "true")
            {
                ConfigAction.Remove(_traceLs, pathHostServiceConfig);
                ConfigAction.Remove(_traceLs, pathHostAppConfig);

                ConfigAction.Add(_traceLs, pathHostServiceConfig);
                ConfigAction.Add(_traceLs, pathHostAppConfig);
            }
            else
            {
                ConfigAction.Remove(_traceLs, pathHostServiceConfig);
                ConfigAction.Remove(_traceLs, pathHostAppConfig);
            }
        }