Exemplo n.º 1
0
        /// <summary>
        /// Open a file meant to populate an exclude or include only field.
        /// </summary>
        private string getIncludeExludeTextFromFile()
        {
            string         outStr     = "";
            OpenFileDialog openDialog = new OpenFileDialog();
            StreamReader   fileStream;

            openDialog.Filter           = "Text files (*.txt)|*.txt";
            openDialog.FilterIndex      = 1;
            openDialog.RestoreDirectory = true;
            openDialog.Multiselect      = false;

            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if ((fileStream = new StreamReader(openDialog.OpenFile())) != null)
                    {
                        string   fileText = fileStream.ReadToEnd().Trim();
                        string[] words    = fileText.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

                        outStr = UtilsCommon.makeSemiString(words);

                        fileStream.Close();
                    }
                }
                catch
                {
                    UtilsMsg.showErrMsg("Could not open file.");
                    return(null);
                }
            }

            return(outStr);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update GUI based on global settings.
        /// </summary>
        private void updateGUI()
        {
            try
            {
                textBoxSubs1IncludedWords.Text                 = UtilsCommon.makeSemiString(Settings.Instance.Subs[0].IncludedWords);
                textBoxSubs1ExcludedWords.Text                 = UtilsCommon.makeSemiString(Settings.Instance.Subs[0].ExcludedWords);
                checkBoxSubs1RemoveStyledLines.Checked         = Settings.Instance.Subs[0].RemoveStyledLines;
                checkBoxSubs1RemovedNoCounterpart.Checked      = Settings.Instance.Subs[0].RemoveNoCounterpart;
                checkBoxSubs1ExcludeDuplicateLines.Checked     = Settings.Instance.Subs[0].ExcludeDuplicateLinesEnabled;
                checkBoxSubs1ExcludeFewer.Checked              = Settings.Instance.Subs[0].ExcludeFewerEnabled;
                numericUpDownSubs1ExcludeFewer.Value           = (decimal)Settings.Instance.Subs[0].ExcludeFewerCount;
                checkBoxSubs1ExcludeShorterThanTime.Checked    = Settings.Instance.Subs[0].ExcludeShorterThanTimeEnabled;
                numericUpDownSubs1ExcludeShorterThanTime.Value = (decimal)Settings.Instance.Subs[0].ExcludeShorterThanTime;
                checkBoxSubs1ExcludeLongerThanTime.Checked     = Settings.Instance.Subs[0].ExcludeLongerThanTimeEnabled;
                numericUpDownSubs1ExcludeLongerThanTime.Value  = (decimal)Settings.Instance.Subs[0].ExcludeLongerThanTime;
                checkBoxSubs1JoinSentences.Checked             = Settings.Instance.Subs[0].JoinSentencesEnabled;
                textBoxSubs1JoinSentenceChars.Text             = Settings.Instance.Subs[0].JoinSentencesCharList;
                radioButtonSubs1Actor.Checked = Settings.Instance.Subs[0].ActorsEnabled;

                textBoxSubs2IncludedWords.Text                 = UtilsCommon.makeSemiString(Settings.Instance.Subs[1].IncludedWords);
                textBoxSubs2ExcludedWords.Text                 = UtilsCommon.makeSemiString(Settings.Instance.Subs[1].ExcludedWords);
                checkBoxSubs2RemoveNoCounterpart.Checked       = Settings.Instance.Subs[1].RemoveNoCounterpart;
                checkBoxSubs2RemoveStyledLines.Checked         = Settings.Instance.Subs[1].RemoveStyledLines;
                checkBoxSubs2ExcludeDuplicateLines.Checked     = Settings.Instance.Subs[1].ExcludeDuplicateLinesEnabled;
                checkBoxSubs2ExcludeFewer.Checked              = Settings.Instance.Subs[1].ExcludeFewerEnabled;
                numericUpDownSubs2ExcludeFewer.Value           = (decimal)Settings.Instance.Subs[1].ExcludeFewerCount;
                checkBoxSubs2ExcludeShorterThanTime.Checked    = Settings.Instance.Subs[1].ExcludeShorterThanTimeEnabled;
                numericUpDownSubs2ExcludeShorterThanTime.Value = Settings.Instance.Subs[1].ExcludeShorterThanTime;
                checkBoxSubs2ExcludeLongerThanTime.Checked     = Settings.Instance.Subs[1].ExcludeLongerThanTimeEnabled;
                numericUpDownSubs2ExcludeLongerThanTime.Value  = Settings.Instance.Subs[1].ExcludeLongerThanTime;
                checkBoxSubs2JoinSentences.Checked             = Settings.Instance.Subs[1].JoinSentencesEnabled;
                textBoxSubs2JoinSentenceChars.Text             = Settings.Instance.Subs[1].JoinSentencesCharList;
                radioButtonSubs2Actor.Checked = Settings.Instance.Subs[1].ActorsEnabled;

                numericUpDownContextLeading.Value        = (decimal)Settings.Instance.ContextLeadingCount;
                checkBoxLeadingIncludeAudioClips.Checked = Settings.Instance.ContextLeadingIncludeAudioClips;
                checkBoxLeadingIncludeSnapshots.Checked  = Settings.Instance.ContextLeadingIncludeSnapshots;
                checkBoxLeadingIncludeVideoClips.Checked = Settings.Instance.ContextLeadingIncludeVideoClips;
                numericUpDownLeadingRange.Value          = (decimal)Settings.Instance.ContextLeadingRange;

                numericUpDownContextTrailing.Value        = (decimal)Settings.Instance.ContextTrailingCount;
                checkBoxTrailingIncludeAudioClips.Checked = Settings.Instance.ContextTrailingIncludeAudioClips;
                checkBoxTrailingIncludeSnapshots.Checked  = Settings.Instance.ContextTrailingIncludeSnapshots;
                checkBoxTrailingIncludeVideoClips.Checked = Settings.Instance.ContextTrailingIncludeVideoClips;
                numericUpDownTrailingRange.Value          = (decimal)Settings.Instance.ContextTrailingRange;

                checkBoxJapKanjiOnly.Checked = Settings.Instance.LangaugeSpecific.KanjiLinesOnly;

                groupBoxCheckVobsubColors.Checked = Settings.Instance.VobSubColors.Enabled;
                panelColorBackground.BackColor    = Settings.Instance.VobSubColors.Colors[0];
                panelColorText.BackColor          = Settings.Instance.VobSubColors.Colors[1];
                panelColorOutline.BackColor       = Settings.Instance.VobSubColors.Colors[2];
                panelColorAntialias.BackColor     = Settings.Instance.VobSubColors.Colors[3];

                checkBoxColorBackground.Checked = Settings.Instance.VobSubColors.TransparencyEnabled[0];
                checkBoxColorText.Checked       = Settings.Instance.VobSubColors.TransparencyEnabled[1];
                checkBoxColorOutline.Checked    = Settings.Instance.VobSubColors.TransparencyEnabled[2];
                checkBoxColorAntialias.Checked  = Settings.Instance.VobSubColors.TransparencyEnabled[3];
            }
            catch (Exception e1)
            {
                UtilsMsg.showErrMsg("Could not completely fill in all settings for this dialog.\n"
                                    + "Did you load a file saved from a previous version?\n\n" + e1);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Dump the most important settings to the log.
        /// </summary>
        public void writeSettingsToLog()
        {
            if (!ConstantSettings.EnableLogging || !initalized)
            {
                return;
            }

            startSection("Settings");

            for (int i = 0; i < 2; i++)
            {
                info("Subs " + i + ":");
                var(new { Settings.Instance.Subs[i].ActorsEnabled });
                var(new { Settings.Instance.Subs[i].Encoding });

                string excludedWords = UtilsCommon.makeSemiString(Settings.Instance.Subs[i].ExcludedWords);
                var(new { excludedWords });

                var(new { Settings.Instance.Subs[i].RemoveNoCounterpart });
                var(new { Settings.Instance.Subs[i].RemoveStyledLines });
                var(new { Settings.Instance.Subs[i].ExcludeDuplicateLinesEnabled });
                var(new { Settings.Instance.Subs[i].ExcludeFewerCount });
                var(new { Settings.Instance.Subs[i].ExcludeFewerEnabled });
                var(new { Settings.Instance.Subs[i].ExcludeLongerThanTime });
                var(new { Settings.Instance.Subs[i].ExcludeLongerThanTimeEnabled });
                var(new { Settings.Instance.Subs[i].ExcludeShorterThanTime });
                var(new { Settings.Instance.Subs[i].ExcludeShorterThanTimeEnabled });
                var(new { Settings.Instance.Subs[i].FilePattern });

                foreach (string file in Settings.Instance.Subs[i].Files)
                {
                    Logger.Instance.var(new { file });
                }

                string includedWords = UtilsCommon.makeSemiString(Settings.Instance.Subs[i].IncludedWords);
                var(new { includedWords });

                var(new { Settings.Instance.Subs[i].TimeShift });
                var(new { Settings.Instance.Subs[i].TimingsEnabled });
                var(new { Settings.Instance.Subs[i].VobsubStream });
            }

            var(new { Settings.Instance.VideoClips.Enabled });
            var(new { Settings.Instance.VideoClips.FilePattern });

            foreach (string file in Settings.Instance.VideoClips.Files)
            {
                var(new { file });
            }

            info("Audio Clips:");
            var(new { Settings.Instance.AudioClips.Enabled });
            var(new { Settings.Instance.AudioClips.filePattern });

            foreach (string file in Settings.Instance.AudioClips.Files)
            {
                var(new { file });
            }

            var(new { Settings.Instance.AudioClips.Bitrate });
            var(new { Settings.Instance.AudioClips.PadEnabled });
            var(new { Settings.Instance.AudioClips.PadStart });
            var(new { Settings.Instance.AudioClips.PadEnd });
            var(new { Settings.Instance.AudioClips.UseAudioFromVideo });
            var(new { Settings.Instance.AudioClips.UseExistingAudio });
            var(new { Settings.Instance.AudioClips.Normalize });

            info("Snapshots:");
            var(new { Settings.Instance.Snapshots.Enabled });
            var(new { Settings.Instance.Snapshots.Crop.Bottom });
            var(new { Settings.Instance.Snapshots.Size.Width });
            var(new { Settings.Instance.Snapshots.Size.Height });

            info("Video Clips:");
            var(new { Settings.Instance.VideoClips.AudioStream });
            var(new { Settings.Instance.VideoClips.BitrateAudio });
            var(new { Settings.Instance.VideoClips.BitrateVideo });
            var(new { Settings.Instance.VideoClips.Crop.Bottom });
            var(new { Settings.Instance.VideoClips.IPodSupport });
            var(new { Settings.Instance.VideoClips.PadEnabled });
            var(new { Settings.Instance.VideoClips.PadStart });
            var(new { Settings.Instance.VideoClips.PadEnd });
            var(new { Settings.Instance.VideoClips.Size.Width });
            var(new { Settings.Instance.VideoClips.Size.Height });

            info("Other:");
            var(new { Settings.Instance.ContextLeadingCount });
            var(new { Settings.Instance.ContextLeadingIncludeAudioClips });
            var(new { Settings.Instance.ContextLeadingIncludeSnapshots });
            var(new { Settings.Instance.ContextLeadingIncludeVideoClips });
            var(new { Settings.Instance.ContextLeadingRange });

            var(new { Settings.Instance.ContextTrailingCount });
            var(new { Settings.Instance.ContextTrailingIncludeAudioClips });
            var(new { Settings.Instance.ContextTrailingIncludeSnapshots });
            var(new { Settings.Instance.ContextTrailingIncludeVideoClips });
            var(new { Settings.Instance.ContextTrailingRange });

            var(new { Settings.Instance.DeckName });
            var(new { Settings.Instance.EpisodeStartNumber });
            var(new { Settings.Instance.LangaugeSpecific.KanjiLinesOnly });
            var(new { Settings.Instance.OutputDir });
            var(new { Settings.Instance.TimeShiftEnabled });
            var(new { Settings.Instance.SpanEnabled });
            var(new { Settings.Instance.SpanEnd });
            var(new { Settings.Instance.SpanStart });
            var(new { Settings.Instance.VobSubColors.Enabled });

            string vobSubColors = Settings.Instance.VobSubColors.Colors[0].ToString();

            var(new { vobSubColors });

            endSection("Settings");

            startSection("Preferences");

            var(new { ConstantSettings.SaveExt });
            var(new { HelpFile = ConstantSettings.HelpPage });
            var(new { ConstantSettings.ExeFFmpeg });
            var(new { ConstantSettings.PathFFmpegExe });
            var(new { ConstantSettings.PathFFmpegFullExe });
            var(new { ConstantSettings.PathFFmpegPresetsFull });
            var(new { ConstantSettings.TempImageFilename });
            var(new { ConstantSettings.TempVideoFilename });
            var(new { ConstantSettings.TempAudioFilename });
            var(new { ConstantSettings.TempAudioPreviewFilename });
            var(new { ConstantSettings.TempPreviewDirName });
            var(new { ConstantSettings.TempMkvExtractSubs1Filename });
            var(new { ConstantSettings.TempMkvExtractSubs2Filename });
            var(new { ConstantSettings.NormalizeAudioExe });
            var(new { ConstantSettings.PathNormalizeAudioExeRel });
            var(new { ConstantSettings.PathNormalizeAudioExeFull });
            var(new { ConstantSettings.PathSubsReTimerFull });
            var(new { ConstantSettings.PathMkvDirRel });
            var(new { ConstantSettings.PathMkvDirFull });
            var(new { ConstantSettings.PathMkvInfoExeRel });
            var(new { ConstantSettings.PathMkvInfoExeFull });
            var(new { ConstantSettings.PathMkvExtractExeRel });
            var(new { ConstantSettings.PathMkvExtractExeFull });

            string tempDirectory = Path.GetTempPath();

            var(new { tempDirectory });

            var(new { ConstantSettings.SettingsFilename });
            var(new { ConstantSettings.MainWindowWidth });
            var(new { ConstantSettings.MainWindowHeight });
            var(new { ConstantSettings.DefaultEnableAudioClipGeneration });
            var(new { ConstantSettings.DefaultEnableSnapshotsGeneration });
            var(new { ConstantSettings.DefaultEnableVideoClipsGeneration });
            var(new { ConstantSettings.VideoPlayer });
            var(new { ConstantSettings.VideoPlayerArgs });
            var(new { ConstantSettings.ReencodeBeforeSplittingAudio });
            var(new { ConstantSettings.EnableLogging });
            var(new { ConstantSettings.AudioNormalizeArgs });
            var(new { ConstantSettings.LongClipWarningSeconds });
            var(new { ConstantSettings.DefaultAudioClipBitrate });
            var(new { ConstantSettings.DefaultAudioNormalize });
            var(new { ConstantSettings.DefaultVideoClipVideoBitrate });
            var(new { ConstantSettings.DefaultVideoClipAudioBitrate });
            var(new { DefaultIphoneSupport = ConstantSettings.DefaultIphoneSupport });
            var(new { ConstantSettings.DefaultEncodingSubs1 });
            var(new { ConstantSettings.DefaultEncodingSubs2 });
            var(new { ConstantSettings.DefaultContextNumLeading });
            var(new { ConstantSettings.DefaultContextNumTrailing });
            var(new { ConstantSettings.DefaultFileBrowserStartDir });
            var(new { ConstantSettings.DefaultRemoveStyledLinesSubs1 });
            var(new { ConstantSettings.DefaultRemoveStyledLinesSubs2 });
            var(new { ConstantSettings.DefaultRemoveNoCounterpartSubs1 });
            var(new { ConstantSettings.DefaultRemoveNoCounterpartSubs2 });
            var(new { ConstantSettings.DefaultIncludeTextSubs1 });
            var(new { ConstantSettings.DefaultIncludeTextSubs2 });
            var(new { ConstantSettings.DefaultExcludeTextSubs1 });
            var(new { ConstantSettings.DefaultExcludeTextSubs2 });
            var(new { ConstantSettings.DefaultExcludeDuplicateLinesSubs1 });
            var(new { ConstantSettings.DefaultExcludeDuplicateLinesSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesFewerThanCharsSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesFewerThanCharsSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesFewerThanCharsNumSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesFewerThanCharsNumSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesShorterThanMsSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesShorterThanMsSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesShorterThanMsNumSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesShorterThanMsNumSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesLongerThanMsSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesLongerThanMsSubs2 });
            var(new { ConstantSettings.DefaultExcludeLinesLongerThanMsNumSubs1 });
            var(new { ConstantSettings.DefaultExcludeLinesLongerThanMsNumSubs2 });
            var(new { ConstantSettings.SrsFilenameFormat });
            var(new { ConstantSettings.SrsDelimiter });
            var(new { ConstantSettings.SrsTagFormat });
            var(new { ConstantSettings.SrsSequenceMarkerFormat });
            var(new { ConstantSettings.SrsAudioFilenamePrefix });
            var(new { ConstantSettings.SrsAudioFilenameSuffix });
            var(new { ConstantSettings.SrsSnapshotFilenamePrefix });
            var(new { ConstantSettings.SrsSnapshotFilenameSuffix });
            var(new { ConstantSettings.SrsVideoFilenamePrefix });
            var(new { ConstantSettings.SrsVideoFilenameSuffix });
            var(new { ConstantSettings.SrsSubs1Format });
            var(new { ConstantSettings.SrsSubs2Format });
            var(new { ConstantSettings.SrsVobsubFilenamePrefix });
            var(new { ConstantSettings.SrsVobsubFilenameSuffix });
            var(new { ConstantSettings.AudioFilenameFormat });
            var(new { ConstantSettings.SnapshotFilenameFormat });
            var(new { ConstantSettings.VideoFilenameFormat });
            var(new { ConstantSettings.VobsubFilenameFormat });
            var(new { ConstantSettings.AudioId3Artist });
            var(new { ConstantSettings.AudioId3Album });
            var(new { ConstantSettings.AudioId3Title });
            var(new { ConstantSettings.AudioId3Genre });
            var(new { ConstantSettings.AudioId3Lyrics });
            var(new { ConstantSettings.ExtractMediaAudioFilenameFormat });
            var(new { ConstantSettings.ExtractMediaLyricsSubs1Format });
            var(new { ConstantSettings.ExtractMediaLyricsSubs2Format });
            var(new { ConstantSettings.DuelingSubtitleFilenameFormat });
            var(new { ConstantSettings.DuelingQuickRefFilenameFormat });
            var(new { ConstantSettings.DuelingQuickRefSubs1Format });
            var(new { ConstantSettings.DuelingQuickRefSubs2Format });

            endSection("Preferences");

            flush();
        }