コード例 #1
0
        private void readConfiguration(AppConfigurationWrapper someConfiguration)
        {
            txtReplaceInvalidFilenameCharsWith.Text = someConfiguration.getInvalidCharReplaceWith();
            txtDefaultDestinationDir.Text = someConfiguration.getDestinationDirectory();

            txtEmptyFolderCheckIgnoredFiletypes.Text = StringUtils.buildMultilineText(someConfiguration.getEmptyFolderIgnoredFiletypes());
            txtVideoFileExtensions.Text = StringUtils.buildMultilineText(someConfiguration.getVideoFileExtensions());
            txtSubtitleFileExtensions.Text = StringUtils.buildMultilineText(someConfiguration.getSubtitleFileExtensions(), true);
            txtEpisodeIdentifierPatterns.Text = StringUtils.buildMultilineText(someConfiguration.getEpisodeIdentifierPatterns());
            txtReplacementsWhenRenaming.Text = StringUtils.buildMultilineText(someConfiguration.getCustomReplaceRegexes());
            txtRemovedMovieTags.Text = StringUtils.buildMultilineText(someConfiguration.getMovieTagsToRemove());
            txtSeasonNrExtractionPatterns.Text = StringUtils.buildMultilineText(someConfiguration.getSeasonNrExtractionPatterns());

            cbDiacriticStrategy.SelectedIndex = (int)someConfiguration.getDiacriticStrategy() - 1;
            cbLetterCaseStrategy.SelectedIndex = (int)someConfiguration.getLetterCaseStrategy() - 1;

            // FIXME: wohl eher int
            nudSearchDepth.Text = someConfiguration.getMaxSearchDepth().ToString(CultureInfo.InvariantCulture);
            nudConnectionTimeout.Value = (decimal)someConfiguration.getConnectionTimeout();

            chkCreateDirectoryStructure.Checked = someConfiguration.getCreateDirectoryStructure();
            chkDeleteEmptiedFolders.Checked = someConfiguration.getDeleteEmptiedFolders();
            chkDeleteAllEmptyFolders.Checked = someConfiguration.getDeleteAllEmptyFolders();
            chkCreateSeasonSubdir.Checked = someConfiguration.getCreateSeasonSubfolders();
            chkAutoResizeColumns.Checked = someConfiguration.getAutoResizeColumns();
            chkReportMissingEpisodes.Checked = someConfiguration.getReportMissingEpisodes();
            chkDeleteSampleFiles.Checked = someConfiguration.getDeleteSampleFiles();

            List<string> prioritizedLanguages = someConfiguration.getPreferredLanguages();
            foreach (string prioritizedLanguage in prioritizedLanguages) {
                string englishLanguageName =
                    prioritizedLanguage.Substring(0, prioritizedLanguage.IndexOf("|", StringComparison.Ordinal));
                cbPreferredLanguage.Items.Add(englishLanguageName);
            }
            if (prioritizedLanguages.Count > 0) {
                cbPreferredLanguage.SelectedIndex = 0;
            }

            string lastProvider = someConfiguration.getLastUsedTvShowProvider() ?? "";
            cbDefaultTitleProvider.Items.AddRange(TvShowInfoProviderManager.getTvShowInfoProviderNames().ToArray());
            cbDefaultTitleProvider.SelectedIndex = Math.Max(0, cbDefaultTitleProvider.Items.IndexOf(lastProvider));
        }