Exemple #1
0
        /// <summary>
        /// Validates the filename extensions. Makes sure each one starts with a '.' and does not contain invalid characters
        /// </summary>
        private void ValidateFilenameExtensions()
        {
            var extensions   = FilenameExtension.Split(new[] { DependencyManagerSettings.FileExtensionSeparator }, StringSplitOptions.RemoveEmptyEntries);
            var invalidChars = System.IO.Path.GetInvalidFileNameChars();

            if (extensions.Any(x => x.IndexOfAny(invalidChars) != -1 || !x.StartsWith(".")))
            {
                SetError(() => FilenameExtension, "Extensions must begin with '.' and must not contain illegal characters");
            }
            else
            {
                RemoveError(() => FilenameExtension);
            }
        }
Exemple #2
0
        /// <summary>
        /// Save settings to team foundation registry
        /// </summary>
        private void Save()
        {
            _settings.FetchDependenciesOnLocalSolutionBuild  = FetchDependenciesOnLocalSolutionBuild;
            _settings.ValidDependencyDefinitionFileExtension = FilenameExtension.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            _settings.RelativeOutputPath          = RelativeOutputPath;
            _settings.BinaryRepositoryTeamProject = BinaryRepositoryTeamProject;
            _settings.IsBinaryRepositoryComponentSettingsEnabled = IsBinaryRepositoryComponentSettingsEnabled;
            _settings.BinaryRepositoryTeamProjectCollectionUrl   = BinaryRepositoryTeamProjectCollectionUri;
            _settings.BinaryRepositoryFilterComponentList        = BinaryRepositoryFilterComponentList;
            _settings.IsZippedDependencyAllowed = IsZippedDependencyAllowed;
            _settings.IsMultiSiteAllowed        = IsMultiSiteAllowed;
            _settings.MultiSiteList             = Sites.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            // create a comma separated list of disabled resolvers
            _settings.DisabledResolvers = string.Join(",", ResolverTypes.Where(x => x.IsEnabled == false).Select(x => x.ReferenceName));

            try
            {
                _settings.Save();
                SaveSettingsFailed = false;
                RaiseNotifyPropertyChanged(() => SaveSettingsFailed);
            }
            catch (AccessCheckException)
            {
                Logger.Instance().Log(TraceLevel.Error, "You don't have permission to save to the registry.");
                SaveSettingsFailed = true;
                RaiseNotifyPropertyChanged(() => SaveSettingsFailed);
            }
            catch (Exception exception)
            {
                UserMessageService.ShowError("Failed to save settings to team foundation server registry.");
                Logger.Instance().Log(TraceLevel.Error, "Failed to save settings to team foundation server registry. Error was {0}", exception.ToString());
            }
            finally
            {
                LoadSettings();
            }
        }