示例#1
0
        private bool SaveConfigurationValues(
            ConfigurationParameters parameters,
            AppSettings settings)
        {
            bool configurationChanged = false;

            if (parameters.DefaultProject != null)
            {
                settings.DefaultProject = parameters.DefaultProject;
                configurationChanged    = true;
            }
            if (parameters.Token != null)
            {
                settings.GitLabAccessToken = parameters.Token;
                configurationChanged       = true;
            }
            if (parameters.Host != null)
            {
                settings.GitLabHostUrl = parameters.Host;
                configurationChanged   = true;
            }
            if (parameters.Username != null)
            {
                settings.GitLabUserName = parameters.Username;
                configurationChanged    = true;
            }
            if (parameters.Password != null)
            {
                settings.GitLabPassword = parameters.Password;
                configurationChanged    = true;
            }
            if (parameters.DefaultIssuesProject != null)
            {
                settings.DefaultIssuesProject = parameters.DefaultIssuesProject;
                configurationChanged          = true;
            }
            if (parameters.DefaultMergesProject != null)
            {
                settings.DefaultMergesProject = parameters.DefaultMergesProject;
                configurationChanged          = true;
            }
            if (parameters.DefaulIssuesLabel != null)
            {
                settings.DefaulIssuesLabel = parameters.DefaulIssuesLabel;
                configurationChanged       = true;
            }

            if (configurationChanged)
            {
                _storage.Save(settings);
            }

            return(configurationChanged);
        }
示例#2
0
        public void StoreConfiguration(ConfigurationParameters parameters)
        {
            var settings = _storage.Load();

            if (SaveConfigurationValues(parameters, settings))
            {
                _outputPresenter.ShowMessage("Configuration saved successfully.");
            }

            var encryptedSettings = _storage.LoadWithSensitiveDataEncrypted();

            ShowConfiguration(encryptedSettings);
        }