当前位置: 首页>>代码示例>>C#>>正文


C# SubtitleFormats.SubtitleFormat类代码示例

本文整理汇总了C#中Nikse.SubtitleEdit.Core.SubtitleFormats.SubtitleFormat的典型用法代码示例。如果您正苦于以下问题:C# SubtitleFormat类的具体用法?C# SubtitleFormat怎么用?C# SubtitleFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SubtitleFormat类属于Nikse.SubtitleEdit.Core.SubtitleFormats命名空间,在下文中一共展示了SubtitleFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        public void Initialize(Subtitle subtitle, string fileName, SubtitleFormat format)
        {
            ShowBasic = false;
            _subtitle = subtitle;
            if (string.IsNullOrEmpty(fileName))
                textBoxFileName.Text = Configuration.Settings.Language.SplitSubtitle.Untitled;
            else
                textBoxFileName.Text = fileName;
            _fileName = fileName;
            foreach (Paragraph p in _subtitle.Paragraphs)
                _totalNumberOfCharacters += p.Text.Length;
            labelLines.Text = string.Format(Configuration.Settings.Language.Split.NumberOfLinesX, _subtitle.Paragraphs.Count);
            labelCharacters.Text = string.Format(Configuration.Settings.Language.Split.NumberOfCharactersX, _totalNumberOfCharacters);

            try
            {
                numericUpDownParts.Value = Configuration.Settings.Tools.SplitNumberOfParts;
            }
            catch
            {
            }

            if (Configuration.Settings.Tools.SplitVia.Trim().Equals("lines", StringComparison.OrdinalIgnoreCase))
                RadioButtonLines.Checked = true;
            else
                radioButtonCharacters.Checked = true;

            foreach (SubtitleFormat f in SubtitleFormat.AllSubtitleFormats)
            {
                if (!f.IsVobSubIndexFile)
                    comboBoxSubtitleFormats.Items.Add(f.FriendlyName);
                if (f.FriendlyName == format.FriendlyName)
                    comboBoxSubtitleFormats.SelectedIndex = comboBoxSubtitleFormats.Items.Count - 1;
            }

            comboBoxEncoding.Items.Clear();
            int encodingSelectedIndex = 0;
            comboBoxEncoding.Items.Add(Encoding.UTF8.EncodingName);
            foreach (EncodingInfo ei in Encoding.GetEncodings())
            {
                if (ei.Name != Encoding.UTF8.BodyName && ei.CodePage >= 949 && !ei.DisplayName.Contains("EBCDIC") && ei.CodePage != 1047)
                {
                    comboBoxEncoding.Items.Add(ei.CodePage + ": " + ei.DisplayName);
                    if (ei.Name == Configuration.Settings.General.DefaultEncoding)
                        encodingSelectedIndex = comboBoxEncoding.Items.Count - 1;
                }
            }
            comboBoxEncoding.SelectedIndex = encodingSelectedIndex;

            if (numericUpDownParts.Maximum > _subtitle.Paragraphs.Count)
                numericUpDownParts.Maximum = _subtitle.Paragraphs.Count / 2;

            if (!string.IsNullOrEmpty(_fileName))
                textBoxOutputFolder.Text = Path.GetDirectoryName(_fileName);
            else if (string.IsNullOrEmpty(Configuration.Settings.Tools.SplitOutputFolder) || !Directory.Exists(Configuration.Settings.Tools.SplitOutputFolder))
                textBoxOutputFolder.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            else
                textBoxOutputFolder.Text = Configuration.Settings.Tools.SplitOutputFolder;
        }
开发者ID:Gargamelll,项目名称:subtitleedit,代码行数:59,代码来源:Split.cs

示例2: Initialize

 public void Initialize(Subtitle subtitle, string fileName, SubtitleFormat format, Encoding encoding, double lengthInSeconds)
 {
     ShowAdvanced = false;
     _subtitle = subtitle;
     _fileName = fileName;
     _format = format;
     _encoding = encoding;
     splitTimeUpDownAdjust.TimeCode = TimeCode.FromSeconds(lengthInSeconds);
 }
开发者ID:mgziminsky,项目名称:subtitleedit,代码行数:9,代码来源:SplitSubtitle.cs

示例3: ThreadDoWorkParameter

 public ThreadDoWorkParameter(bool fixCommonErrors, bool multipleReplace, bool splitLongLinesActive, bool autoBalance, bool setMinDisplayTimeBetweenSubtitles, ListViewItem item, Subtitle subtitle, SubtitleFormat format, Encoding encoding, string language, string fileName, string toFormat, SubtitleFormat sourceFormat)
 {
     FixCommonErrors = fixCommonErrors;
     MultipleReplaceActive = multipleReplace;
     SplitLongLinesActive = splitLongLinesActive;
     AutoBalanceActive = autoBalance;
     SetMinDisplayTimeBetweenSubtitles = setMinDisplayTimeBetweenSubtitles;
     Item = item;
     Subtitle = subtitle;
     Format = format;
     Encoding = encoding;
     Language = language;
     FileName = fileName;
     ToFormat = toFormat;
     SourceFormat = sourceFormat;
 }
开发者ID:YangEunYong,项目名称:subtitleedit,代码行数:16,代码来源:BatchConvert.cs

示例4: Initialize

        public void Initialize(Subtitle subtitle, string fileName, SubtitleFormat format)
        {
            ShowBasic = false;
            _subtitle = subtitle;
            if (string.IsNullOrEmpty(fileName))
                textBoxFileName.Text = Configuration.Settings.Language.SplitSubtitle.Untitled;
            else
                textBoxFileName.Text = fileName;
            _fileName = fileName;
            foreach (Paragraph p in _subtitle.Paragraphs)
                _totalNumberOfCharacters += p.Text.Length;
            labelLines.Text = string.Format(Configuration.Settings.Language.Split.NumberOfLinesX, _subtitle.Paragraphs.Count);
            labelCharacters.Text = string.Format(Configuration.Settings.Language.Split.NumberOfCharactersX, _totalNumberOfCharacters);

            try
            {
                numericUpDownParts.Value = Configuration.Settings.Tools.SplitNumberOfParts;
            }
            catch
            {
            }

            if (Configuration.Settings.Tools.SplitVia.Trim().Equals("lines", StringComparison.OrdinalIgnoreCase))
                RadioButtonLines.Checked = true;
            else
                radioButtonCharacters.Checked = true;

            UiUtil.InitializeSubtitleFormatComboBox(comboBoxSubtitleFormats, format.FriendlyName);

            UiUtil.InitializeTextEncodingComboBox(comboBoxEncoding);

            if (numericUpDownParts.Maximum > _subtitle.Paragraphs.Count)
                numericUpDownParts.Maximum = _subtitle.Paragraphs.Count / 2;

            if (!string.IsNullOrEmpty(_fileName))
                textBoxOutputFolder.Text = Path.GetDirectoryName(_fileName);
            else if (string.IsNullOrEmpty(Configuration.Settings.Tools.SplitOutputFolder) || !Directory.Exists(Configuration.Settings.Tools.SplitOutputFolder))
                textBoxOutputFolder.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            else
                textBoxOutputFolder.Text = Configuration.Settings.Tools.SplitOutputFolder;
        }
开发者ID:LeonCheung,项目名称:subtitleedit,代码行数:41,代码来源:Split.cs

示例5: Statistics

        public Statistics(Subtitle subtitle, string fileName, SubtitleFormat format)
        {
            InitializeComponent();

            _subtitle = subtitle;
            _format = format;

            _l = Configuration.Settings.Language.Statistics;
            if (string.IsNullOrEmpty(fileName))
                Text = _l.Title;
            else
                Text = string.Format(_l.TitleWithFileName, fileName);
            groupBoxGeneral.Text = _l.GeneralStatistics;
            groupBoxMostUsed.Text = _l.MostUsed;
            labelMostUsedWords.Text = _l.MostUsedWords;
            labelMostUsedLines.Text = _l.MostUsedLines;
            buttonExport.Text = _l.Export;
            buttonOK.Text = Configuration.Settings.Language.General.Ok;
            UiUtil.FixLargeFonts(this, buttonOK);

            CalculateGeneralStatistics();
            {
                textBoxGeneral.Text = _general;
                textBoxGeneral.SelectionStart = 0;
                textBoxGeneral.SelectionLength = 0;
                textBoxGeneral.ScrollToCaret();
            }
            CalculateMostUsedWords();
            {
                textBoxMostUsedWords.Text = _mostUsedWords;
            }
            CalculateMostUsedLines();
            {
                textBoxMostUsedLines.Text = _mostUsedLines;
            }
        }
开发者ID:ItsJustSean,项目名称:subtitleedit,代码行数:36,代码来源:Statistics.cs

示例6: ComboBoxSubtitleFormatsEnter

 private void ComboBoxSubtitleFormatsEnter(object sender, EventArgs e)
 {
     SubtitleFormat format = GetCurrentSubtitleFormat();
     if (format != null)
         _oldSubtitleFormat = format;
 }
开发者ID:m1croN,项目名称:subtitleedit,代码行数:6,代码来源:Main.cs

示例7: ResetSubtitle

        private void ResetSubtitle()
        {
            SetCurrentFormat(Configuration.Settings.General.DefaultSubtitleFormat);

            labelStartTimeWarning.Text = string.Empty;
            labelDurationWarning.Text = string.Empty;

            _subtitle = new Subtitle(_subtitle.HistoryItems);
            _changeAlternateSubtitleToString = string.Empty;
            _changeSubtitleToString = string.Empty;
            _subtitleAlternateFileName = null;
            textBoxSource.Text = string.Empty;
            SubtitleListview1.Items.Clear();
            _fileName = string.Empty;
            _fileDateTime = new DateTime();
            Text = Title;
            _oldSubtitleFormat = null;
            labelSingleLine.Text = string.Empty;
            RemoveAlternate(true);
            _splitDualSami = false;

            SubtitleListview1.HideExtraColumn();
            SubtitleListview1.DisplayExtraFromExtra = false;

            ComboBoxSubtitleFormatsSelectedIndexChanged(null, null);

            toolStripComboBoxFrameRate.Text = Configuration.Settings.General.DefaultFrameRate.ToString();

            SetEncoding(Configuration.Settings.General.DefaultEncoding);

            toolStripComboBoxFrameRate.Text = Configuration.Settings.General.DefaultFrameRate.ToString();
            _findHelper = null;
            _spellCheckForm = null;
            _videoFileName = null;
            _videoInfo = null;
            _videoAudioTrackNumber = -1;
            labelVideoInfo.Text = _languageGeneral.NoVideoLoaded;
            audioVisualizer.WavePeaks = null;
            audioVisualizer.Spectrogram = null;

            _sourceViewChange = false;

            _subtitleListViewIndex = -1;
            textBoxListViewText.Text = string.Empty;
            textBoxListViewTextAlternate.Text = string.Empty;
            textBoxListViewText.Enabled = false;
            labelTextLineLengths.Text = string.Empty;
            labelCharactersPerSecond.Text = string.Empty;
            labelTextLineTotal.Text = string.Empty;

            _listViewTextUndoLast = null;
            _listViewAlternateTextUndoLast = null;
            _listViewTextUndoIndex = -1;

            if (mediaPlayer.VideoPlayer != null)
            {
                mediaPlayer.VideoPlayer.DisposeVideoPlayer();
                mediaPlayer.VideoPlayer = null;
            }

            _changeSubtitleToString = _subtitle.GetFastHashCode();
            _converted = false;

            SetUndockedWindowsTitle();
            mediaPlayer.SubtitleText = string.Empty;
            ShowStatus(_language.New);

            ResetShowEarlierOrLater();
        }
开发者ID:m1croN,项目名称:subtitleedit,代码行数:69,代码来源:Main.cs

示例8: SaveSubtitle

        private DialogResult SaveSubtitle(SubtitleFormat format)
        {
            if (string.IsNullOrEmpty(_fileName) || _converted)
                return FileSaveAs(false);

            try
            {
                if (format != null && !format.IsTextBased)
                {
                    if (format.GetType() == typeof(Ebu))
                    {
                        Ebu.Save(_fileName, _subtitle);
                    }
                    return DialogResult.OK;
                }

                string allText = _subtitle.ToText(format);

                // Seungki begin
                if (_splitDualSami && _subtitleAlternate != null)
                {
                    var s = new Subtitle(_subtitle);
                    foreach (var p in _subtitleAlternate.Paragraphs)
                        s.Paragraphs.Add(p);
                    allText = s.ToText(format);
                }
                // Seungki end

                var currentEncoding = GetCurrentEncoding();
                bool isUnicode = currentEncoding == Encoding.Unicode || currentEncoding == Encoding.UTF32 || currentEncoding == Encoding.UTF7 || currentEncoding == Encoding.UTF8;
                if (!isUnicode && (allText.Contains(new[] { '♪', '♫', '♥', '—', '―', '…' }))) // ANSI & music/unicode symbols
                {
                    if (MessageBox.Show(string.Format(_language.UnicodeMusicSymbolsAnsiWarning), Title, MessageBoxButtons.YesNo) == DialogResult.No)
                        return DialogResult.No;
                }

                if (!isUnicode)
                {
                    allText = NormalizeUnicode(allText);
                }

                bool containsNegativeTime = false;
                foreach (var p in _subtitle.Paragraphs)
                {
                    if (p.StartTime.TotalMilliseconds < 0 || p.EndTime.TotalMilliseconds < 0)
                    {
                        containsNegativeTime = true;
                        break;
                    }
                }
                if (containsNegativeTime)
                {
                    if (MessageBox.Show(_language.NegativeTimeWarning, Title, MessageBoxButtons.YesNo) == DialogResult.No)
                        return DialogResult.No;
                }

                if (File.Exists(_fileName))
                {
                    var fileInfo = new FileInfo(_fileName);
                    var fileOnDisk = fileInfo.LastWriteTime;
                    if (_fileDateTime != fileOnDisk && _fileDateTime != new DateTime())
                    {
                        if (MessageBox.Show(string.Format(_language.OverwriteModifiedFile,
                            _fileName, fileOnDisk.ToShortDateString(), fileOnDisk.ToString("HH:mm:ss"),
                            Environment.NewLine, _fileDateTime.ToShortDateString(), _fileDateTime.ToString("HH:mm:ss")),
                            Title + " - " + _language.FileOnDiskModified, MessageBoxButtons.YesNo) == DialogResult.No)
                            return DialogResult.No;
                    }
                    if (fileInfo.IsReadOnly)
                    {
                        MessageBox.Show(string.Format(_language.FileXIsReadOnly, _fileName));
                        return DialogResult.No;
                    }
                }

                if ((format.GetType() == typeof(WebVTT) || format.GetType() == typeof(WebVTTFileWithLineNumber)))
                {
                    SetEncoding(Encoding.UTF8);
                    currentEncoding = Encoding.UTF8;
                }

                if (ModifierKeys == (Keys.Control | Keys.Shift))
                    allText = allText.Replace("\r\n", "\n");

                if (format.GetType() == typeof(ItunesTimedText) || format.GetType() == typeof(ScenaristClosedCaptions) || format.GetType() == typeof(ScenaristClosedCaptionsDropFrame))
                {
                    var outputEnc = new UTF8Encoding(false); // create encoding with no BOM
                    using (var file = new StreamWriter(_fileName, false, outputEnc)) // open file with encoding
                    {
                        file.Write(allText);
                    }
                }
                else if (currentEncoding == Encoding.UTF8 && (format.GetType() == typeof(TmpegEncAW5) || format.GetType() == typeof(TmpegEncXml)))
                {
                    var outputEnc = new UTF8Encoding(false); // create encoding with no BOM
                    using (var file = new StreamWriter(_fileName, false, outputEnc)) // open file with encoding
                    {
                        file.Write(allText);
                    }
                }
//.........这里部分代码省略.........
开发者ID:m1croN,项目名称:subtitleedit,代码行数:101,代码来源:Main.cs

示例9: ShowHideTextBasedFeatures

 private void ShowHideTextBasedFeatures(SubtitleFormat format)
 {
     if (format != null && !format.IsTextBased)
     {
         textBoxSource.Enabled = false;
     }
     else
     {
         textBoxSource.Enabled = true;
     }
 }
开发者ID:m1croN,项目名称:subtitleedit,代码行数:11,代码来源:Main.cs

示例10: OpenSubtitle


//.........这里部分代码省略.........
                }

                if (file.Length > 1024 * 1024 * 10) // max 10 mb
                {
                    // retry Blu-ray sup (file with wrong extension)
                    if (FileUtil.IsBluRaySup(fileName))
                    {
                        ImportAndOcrBluRaySup(fileName, _loading);
                        return;
                    }

                    // retry vobsub (file with wrong extension)
                    if (IsVobSubFile(fileName, false))
                    {
                        if (MessageBox.Show(this, _language.ImportThisVobSubSubtitle, _title, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            ImportAndOcrVobSubSubtitleNew(fileName, _loading);
                        }
                        return;
                    }

                    var text = string.Format(_language.FileXIsLargerThan10MB + Environment.NewLine + Environment.NewLine + _language.ContinueAnyway, fileName);
                    if (MessageBox.Show(this, text, Title, MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
                        return;
                }

                if (_subtitle.HistoryItems.Count > 0 || _subtitle.Paragraphs.Count > 0)
                    MakeHistoryForUndo(string.Format(_language.BeforeLoadOf, Path.GetFileName(fileName)));

                bool change = _changeSubtitleToString != _subtitle.GetFastHashCode();
                if (change)
                    change = _lastDoNotPrompt != _subtitle.GetFastHashCode();

                SubtitleFormat format = _subtitle.LoadSubtitle(fileName, out encoding, encoding);
                if (!change)
                    _changeSubtitleToString = _subtitle.GetFastHashCode();

                ShowHideTextBasedFeatures(format);

                bool justConverted = false;
                if (format == null)
                {
                    var ebu = new Ebu();
                    if (ebu.IsMine(null, fileName))
                    {
                        ebu.LoadSubtitle(_subtitle, null, fileName);
                        _oldSubtitleFormat = ebu;
                        SetCurrentFormat(Configuration.Settings.General.DefaultSubtitleFormat);
                        SetEncoding(Configuration.Settings.General.DefaultEncoding);
                        encoding = GetCurrentEncoding();
                        justConverted = true;
                        format = GetCurrentSubtitleFormat();
                    }
                }

                if (format == null)
                {
                    var pac = new Pac();
                    if (pac.IsMine(null, fileName))
                    {
                        pac.LoadSubtitle(_subtitle, null, fileName);
                        _oldSubtitleFormat = pac;
                        SetCurrentFormat(Configuration.Settings.General.DefaultSubtitleFormat);
                        SetEncoding(Configuration.Settings.General.DefaultEncoding);
                        encoding = GetCurrentEncoding();
                        justConverted = true;
开发者ID:m1croN,项目名称:subtitleedit,代码行数:67,代码来源:Main.cs

示例11: RemoveNativeFormatting

        public override void RemoveNativeFormatting(Subtitle subtitle, SubtitleFormat newFormat)
        {
            if (newFormat != null && newFormat.Name == AdvancedSubStationAlpha.NameOfFormat)
            {
                // do we need any conversion?
            }
            else
            {
                foreach (Paragraph p in subtitle.Paragraphs)
                {
                    int indexOfBegin = p.Text.IndexOf('{');
                    string pre = string.Empty;
                    while (indexOfBegin >= 0 && p.Text.IndexOf('}') > indexOfBegin)
                    {
                        string s = p.Text.Substring(indexOfBegin);
                        if (s.StartsWith("{\\an1}", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an2}", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an3}", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an4}", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an5}", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an6}", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an7}", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an8}", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an9}", StringComparison.Ordinal))
                        {
                            pre = s.Substring(0, 6);
                        }
                        else if (s.StartsWith("{\\an1\\", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an2\\", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an3\\", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an4\\", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an5\\", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an6\\", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an7\\", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an8\\", StringComparison.Ordinal) ||
                            s.StartsWith("{\\an9\\", StringComparison.Ordinal))
                        {
                            pre = s.Substring(0, 5) + "}";
                        }
                        else if (s.StartsWith("{\\a1}", StringComparison.Ordinal) || s.StartsWith("{\\a1\\", StringComparison.Ordinal) ||
                                 s.StartsWith("{\\a3}", StringComparison.Ordinal) || s.StartsWith("{\\a3\\", StringComparison.Ordinal))
                        {
                            pre = s.Substring(0, 4) + "}";
                        }
                        else if (s.StartsWith("{\\a9}", StringComparison.Ordinal) || s.StartsWith("{\\a9\\", StringComparison.Ordinal))
                        {
                            pre = "{\\an4}";
                        }
                        else if (s.StartsWith("{\\a10}", StringComparison.Ordinal) || s.StartsWith("{\\a10\\", StringComparison.Ordinal))
                        {
                            pre = "{\\an5}";
                        }
                        else if (s.StartsWith("{\\a11}", StringComparison.Ordinal) || s.StartsWith("{\\a11\\", StringComparison.Ordinal))
                        {
                            pre = "{\\an6}";
                        }
                        else if (s.StartsWith("{\\a5}", StringComparison.Ordinal) || s.StartsWith("{\\a5\\", StringComparison.Ordinal))
                        {
                            pre = "{\\an7}";
                        }
                        else if (s.StartsWith("{\\a6}", StringComparison.Ordinal) || s.StartsWith("{\\a6\\", StringComparison.Ordinal))
                        {
                            pre = "{\\an8}";
                        }
                        else if (s.StartsWith("{\\a7}", StringComparison.Ordinal) || s.StartsWith("{\\a7\\", StringComparison.Ordinal))
                        {
                            pre = "{\\an9}";
                        }
                        int indexOfEnd = p.Text.IndexOf('}');
                        p.Text = p.Text.Remove(indexOfBegin, (indexOfEnd - indexOfBegin) + 1);

                        indexOfBegin = p.Text.IndexOf('{');
                    }
                    p.Text = pre + p.Text;
                }
            }
        }
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:77,代码来源:SubStationAlpha.cs

示例12: CheckSkipFilter

 private bool CheckSkipFilter(string fileName, SubtitleFormat format, Subtitle sub)
 {
     bool skip = false;
     if (comboBoxFilter.SelectedIndex == 1)
     {
         if (format != null && format.GetType() == typeof(SubRip) && FileUtil.HasUtf8Bom(fileName))
             skip = true;
     }
     else if (comboBoxFilter.SelectedIndex == 2)
     {
         skip = true;
         foreach (Paragraph p in sub.Paragraphs)
         {
             if (p.Text != null && Utilities.GetNumberOfLines(p.Text) > 2)
             {
                 skip = false;
                 break;
             }
         }
     }
     else if (comboBoxFilter.SelectedIndex == 3 && !string.IsNullOrWhiteSpace(textBoxFilter.Text))
     {
         skip = true;
         foreach (Paragraph p in sub.Paragraphs)
         {
             if (p.Text != null && p.Text.Contains(textBoxFilter.Text, StringComparison.Ordinal))
             {
                 skip = false;
                 break;
             }
         }
     }
     return skip;
 }
开发者ID:Gargamelll,项目名称:subtitleedit,代码行数:34,代码来源:BatchConvert.cs

示例13: SubStationAlphaStyles

        public SubStationAlphaStyles(Subtitle subtitle, SubtitleFormat format)
            : base(subtitle)
        {
            InitializeComponent();

            labelStatus.Text = string.Empty;
            _header = subtitle.Header;
            _format = format;
            _isSubStationAlpha = _format.Name == SubStationAlpha.NameOfFormat;
            if (_header == null || !_header.Contains("style:", StringComparison.OrdinalIgnoreCase))
                ResetHeader();

            comboBoxFontName.Items.Clear();
            foreach (var x in FontFamily.Families)
                comboBoxFontName.Items.Add(x.Name);

            var l = Configuration.Settings.Language.SubStationAlphaStyles;
            Text = l.Title;
            groupBoxStyles.Text = l.Styles;
            listViewStyles.Columns[0].Text = l.Name;
            listViewStyles.Columns[1].Text = l.FontName;
            listViewStyles.Columns[2].Text = l.FontSize;
            listViewStyles.Columns[3].Text = l.UseCount;
            listViewStyles.Columns[4].Text = l.Primary;
            listViewStyles.Columns[5].Text = l.Outline;
            groupBoxProperties.Text = l.Properties;
            labelStyleName.Text = l.Name;
            groupBoxFont.Text = l.Font;
            labelFontName.Text = l.FontName;
            labelFontSize.Text = l.FontSize;
            checkBoxFontItalic.Text = Configuration.Settings.Language.General.Italic;
            checkBoxFontBold.Text = Configuration.Settings.Language.General.Bold;
            checkBoxFontUnderline.Text = Configuration.Settings.Language.General.Underline;
            groupBoxAlignment.Text = l.Alignment;
            radioButtonTopLeft.Text = l.TopLeft;
            radioButtonTopCenter.Text = l.TopCenter;
            radioButtonTopRight.Text = l.TopRight;
            radioButtonMiddleLeft.Text = l.MiddleLeft;
            radioButtonMiddleCenter.Text = l.MiddleCenter;
            radioButtonMiddleRight.Text = l.MiddleRight;
            radioButtonBottomLeft.Text = l.BottomLeft;
            radioButtonBottomCenter.Text = l.BottomCenter;
            radioButtonBottomRight.Text = l.BottomRight;
            groupBoxColors.Text = l.Colors;
            buttonPrimaryColor.Text = l.Primary;
            buttonSecondaryColor.Text = l.Secondary;
            buttonOutlineColor.Text = l.Outline;
            buttonBackColor.Text = l.Shadow;
            groupBoxMargins.Text = l.Margins;
            labelMarginLeft.Text = l.MarginLeft;
            labelMarginRight.Text = l.MarginRight;
            labelMarginVertical.Text = l.MarginVertical;
            groupBoxBorder.Text = l.Border;
            radioButtonOutline.Text = l.Outline;
            labelShadow.Text = l.PlusShadow;
            radioButtonOpaqueBox.Text = l.OpaqueBox;
            buttonImport.Text = l.Import;
            buttonExport.Text = l.Export;
            buttonCopy.Text = l.Copy;
            buttonAdd.Text = l.New;
            buttonRemove.Text = l.Remove;
            buttonRemoveAll.Text = l.RemoveAll;
            groupBoxPreview.Text = Configuration.Settings.Language.General.Preview;

            if (_isSubStationAlpha)
            {
                Text = l.TitleSubstationAlpha;
                buttonOutlineColor.Text = l.Tertiary;
                buttonBackColor.Text = l.Back;
                listViewStyles.Columns[5].Text = l.Back;
                checkBoxFontUnderline.Visible = false;
            }

            buttonOK.Text = Configuration.Settings.Language.General.Ok;
            buttonCancel.Text = Configuration.Settings.Language.General.Cancel;

            InitializeListView();
            UiUtil.FixLargeFonts(this, buttonCancel);

            comboBoxFontName.Left = labelFontName.Left + labelFontName.Width + 10;
            numericUpDownFontSize.Left = labelFontSize.Left + labelFontSize.Width + 10;
            if (comboBoxFontName.Left > numericUpDownFontSize.Left)
                numericUpDownFontSize.Left = comboBoxFontName.Left;
            else
                comboBoxFontName.Left = numericUpDownFontSize.Left;

            numericUpDownOutline.Left = radioButtonOutline.Left + radioButtonOutline.Width + 5;
            labelShadow.Left = numericUpDownOutline.Left + numericUpDownOutline.Width + 5;
            numericUpDownShadowWidth.Left = labelShadow.Left + labelShadow.Width + 5;
            listViewStyles.Columns[5].Width = -2;
            checkBoxFontItalic.Left = checkBoxFontBold.Left + checkBoxFontBold.Width + 12;
            checkBoxFontUnderline.Left = checkBoxFontItalic.Left + checkBoxFontItalic.Width + 12;
        }
开发者ID:erasoni,项目名称:subtitleedit,代码行数:93,代码来源:SubStationAlphaStyles.cs

示例14: SubStationAlphaStylesBatchConvert

        public SubStationAlphaStylesBatchConvert(Subtitle subtitle, SubtitleFormat format)
            : base(subtitle)
        {
            InitializeComponent();

            comboBoxWrapStyle.SelectedIndex = 2;
            comboBoxCollision.SelectedIndex = 0;
            _header = subtitle.Header;
            _format = format;
            _isSubStationAlpha = _format.Name == SubStationAlpha.NameOfFormat;
            if (_header == null || !_header.Contains("style:", StringComparison.OrdinalIgnoreCase))
                ResetHeader();

            comboBoxFontName.Items.Clear();
            foreach (var x in FontFamily.Families)
                comboBoxFontName.Items.Add(x.Name);

            var l = Configuration.Settings.Language.SubStationAlphaStyles;
            Text = l.Title;
            // groupBoxStyles.Text = l.Styles;
            groupBoxProperties.Text = l.Properties;
            groupBoxFont.Text = l.Font;
            labelFontName.Text = l.FontName;
            labelFontSize.Text = l.FontSize;
            checkBoxFontItalic.Text = Configuration.Settings.Language.General.Italic;
            checkBoxFontBold.Text = Configuration.Settings.Language.General.Bold;
            checkBoxFontUnderline.Text = Configuration.Settings.Language.General.Underline;
            groupBoxAlignment.Text = l.Alignment;
            radioButtonTopLeft.Text = l.TopLeft;
            radioButtonTopCenter.Text = l.TopCenter;
            radioButtonTopRight.Text = l.TopRight;
            radioButtonMiddleLeft.Text = l.MiddleLeft;
            radioButtonMiddleCenter.Text = l.MiddleCenter;
            radioButtonMiddleRight.Text = l.MiddleRight;
            radioButtonBottomLeft.Text = l.BottomLeft;
            radioButtonBottomCenter.Text = l.BottomCenter;
            radioButtonBottomRight.Text = l.BottomRight;
            groupBoxColors.Text = l.Colors;
            buttonPrimaryColor.Text = l.Primary;
            buttonSecondaryColor.Text = l.Secondary;
            buttonOutlineColor.Text = l.Outline;
            buttonBackColor.Text = l.Shadow;
            groupBoxMargins.Text = l.Margins;
            labelMarginLeft.Text = l.MarginLeft;
            labelMarginRight.Text = l.MarginRight;
            labelMarginVertical.Text = l.MarginVertical;
            groupBoxBorder.Text = l.Border;
            radioButtonOutline.Text = l.Outline;
            labelShadow.Text = l.PlusShadow;
            radioButtonOpaqueBox.Text = l.OpaqueBox;
            //buttonExport.Text = l.Export;
            groupBoxPreview.Text = Configuration.Settings.Language.General.Preview;

            if (_isSubStationAlpha)
            {
                Text = l.TitleSubstationAlpha;
                buttonOutlineColor.Text = l.Tertiary;
                buttonBackColor.Text = l.Back;
                checkBoxFontUnderline.Visible = false;

                labelWrapStyle.Visible = false;
                comboBoxWrapStyle.Visible = false;
                checkBoxScaleBorderAndShadow.Visible = false;
            }

            buttonOK.Text = Configuration.Settings.Language.General.Ok;
            buttonCancel.Text = Configuration.Settings.Language.General.Cancel;

            UiUtil.FixLargeFonts(this, buttonCancel);

            comboBoxFontName.Left = labelFontName.Left + labelFontName.Width + 10;
            numericUpDownFontSize.Left = labelFontSize.Left + labelFontSize.Width + 10;
            if (comboBoxFontName.Left > numericUpDownFontSize.Left)
                numericUpDownFontSize.Left = comboBoxFontName.Left;
            else
                comboBoxFontName.Left = numericUpDownFontSize.Left;

            numericUpDownOutline.Left = radioButtonOutline.Left + radioButtonOutline.Width + 5;
            labelShadow.Left = numericUpDownOutline.Left + numericUpDownOutline.Width + 5;
            numericUpDownShadowWidth.Left = labelShadow.Left + labelShadow.Width + 5;
            checkBoxFontItalic.Left = checkBoxFontBold.Left + checkBoxFontBold.Width + 12;
            checkBoxFontUnderline.Left = checkBoxFontItalic.Left + checkBoxFontItalic.Width + 12;

            var l2 = Configuration.Settings.Language.SubStationAlphaProperties;
            groupBoxResolution.Text = l2.Resolution;
            labelVideoResolution.Text = l2.VideoResolution;
            groupBoxOptions.Text = l2.Options;
            labelCollision.Text = l2.Collision;
            labelWrapStyle.Text = l2.WrapStyle;
            checkBoxScaleBorderAndShadow.Text = l2.ScaleBorderAndShadow;
        }
开发者ID:YangEunYong,项目名称:subtitleedit,代码行数:91,代码来源:SubStationAlphaStylesBatchConvert.cs

示例15: SetSaveDialogFilter

 public static void SetSaveDialogFilter(SaveFileDialog saveFileDialog, SubtitleFormat currentFormat)
 {
     var sb = new StringBuilder();
     int index = 0;
     foreach (SubtitleFormat format in SubtitleFormat.AllSubtitleFormats)
     {
         sb.Append(format.Name + "|*" + format.Extension + "|");
         if (currentFormat.Name == format.Name)
             saveFileDialog.FilterIndex = index + 1;
         index++;
     }
     saveFileDialog.Filter = sb.ToString().TrimEnd('|');
 }
开发者ID:ItsJustSean,项目名称:subtitleedit,代码行数:13,代码来源:UiUtil.cs


注:本文中的Nikse.SubtitleEdit.Core.SubtitleFormats.SubtitleFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。