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


C# SubtitleFormats.SubtitleFormat类代码示例

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


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

示例1: TimedTextStyles

        public TimedTextStyles(Subtitle subtitle, SubtitleFormat format)
        {
            InitializeComponent();

            _subtitle = subtitle;
            _format = format;
            _xml = new XmlDocument();
            try
            {
                _xml.LoadXml(subtitle.Header);
                var xnsmgr = new XmlNamespaceManager(_xml.NameTable);
                xnsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml");
                if (_xml.DocumentElement.SelectSingleNode("ttml:head", xnsmgr) == null)
                    _xml.LoadXml(new TimedText10().ToText(new Subtitle(), "tt")); // load default xml
            }
            catch
            {
                _xml.LoadXml(new TimedText10().ToText(new Subtitle(), "tt")); // load default xml
            }
            _nsmgr = new XmlNamespaceManager(_xml.NameTable);
            _nsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml");
            _xmlHead = _xml.DocumentElement.SelectSingleNode("ttml:head", _nsmgr);

            foreach (FontFamily ff in FontFamily.Families)
                comboBoxFontName.Items.Add(ff.Name.Substring(0, 1).ToLower() + ff.Name.Substring(1));

            InitializeListView();

            _previewTimer.Interval = 200;
            _previewTimer.Tick += RefreshTimerTick;
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:31,代码来源:TimedTextStyles.cs

示例2: 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:aisam97,项目名称:subtitleedit,代码行数:59,代码来源:Split.cs

示例3: 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:nguansak,项目名称:subtitleedit,代码行数:9,代码来源:SplitSubtitle.cs

示例4: 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:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:16,代码来源:BatchConvert.cs

示例5: Statistics

        /// <summary>
        /// Initializes a new instance of the <see cref="Statistics"/> class.
        /// </summary>
        /// <param name="subtitle">
        /// The subtitle.
        /// </param>
        /// <param name="fileName">
        /// The file name.
        /// </param>
        /// <param name="format">
        /// The format.
        /// </param>
        public Statistics(Subtitle subtitle, string fileName, SubtitleFormat format)
        {
            this.InitializeComponent();

            this._subtitle = subtitle;
            this._format = format;

            this._l = Configuration.Settings.Language.Statistics;
            if (string.IsNullOrEmpty(fileName))
            {
                this.Text = this._l.Title;
            }
            else
            {
                this.Text = string.Format(this._l.TitleWithFileName, fileName);
            }

            this.groupBoxGeneral.Text = this._l.GeneralStatistics;
            this.groupBoxMostUsed.Text = this._l.MostUsed;
            this.labelMostUsedWords.Text = this._l.MostUsedWords;
            this.labelMostUsedLines.Text = this._l.MostUsedLines;
            this.buttonExport.Text = this._l.Export;
            this.buttonOK.Text = Configuration.Settings.Language.General.Ok;
            Utilities.FixLargeFonts(this, this.buttonOK);

            this.CalculateGeneralStatistics();
            {
                this.textBoxGeneral.Text = this._general;
                this.textBoxGeneral.SelectionStart = 0;
                this.textBoxGeneral.SelectionLength = 0;
                this.textBoxGeneral.ScrollToCaret();
            }

            this.CalculateMostUsedWords();
            {
                this.textBoxMostUsedWords.Text = this._mostUsedWords;
            }

            this.CalculateMostUsedLines();
            {
                this.textBoxMostUsedLines.Text = this._mostUsedLines;
            }
        }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:55,代码来源:Statistics.cs

示例6: 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;
            buttonOK.Text = Configuration.Settings.Language.General.Ok;
            FixLargeFonts();

            CalculateGeneralStatistics();
            CalculateMostUsedWords();
            CalculateMostUsedLines();
        }
开发者ID:rragu,项目名称:subtitleedit,代码行数:23,代码来源:Statistics.cs

示例7: LoadMatroskaSSa

        public static Subtitle LoadMatroskaSSa(MatroskaSubtitleInfo matroskaSubtitleInfo, string fileName, SubtitleFormat format, List<SubtitleSequence> sub)
        {
            Subtitle subtitle = new Subtitle();
            subtitle.Header = matroskaSubtitleInfo.CodecPrivate;
            var lines = new List<string>();
            foreach (string l in subtitle.Header.Trim().Replace(Environment.NewLine, "\n").Split('\n'))
                lines.Add(l);
            StringBuilder footer = new StringBuilder();
            Subtitle comments = new Subtitle();
            if (!string.IsNullOrEmpty(matroskaSubtitleInfo.CodecPrivate))
            {
                bool footerOn = false;
                foreach (string line in lines)
                {
                    if (footerOn)
                    {
                        footer.AppendLine(line);
                    }
                    else if (line.Trim() == "[Events]")
                    {
                        footerOn = false;
                    }
                    else if (line.Trim() == "[Fonts]" || line.Trim() == "[Graphics]")
                    {
                        footerOn = true;
                        footer.AppendLine();
                        footer.AppendLine();
                        footer.AppendLine(line);
                    }
                    else if (line.StartsWith("Comment:"))
                    {
                        var arr = line.Split(',');
                        if (arr.Length > 3)
                        {
                            arr = arr[1].Split(":.".ToCharArray());
                            if (arr.Length == 4)
                            {
                                int hour;
                                int min;
                                int sec;
                                int ms;
                                if (int.TryParse(arr[0], out hour) && int.TryParse(arr[1], out min) &&
                                    int.TryParse(arr[2], out sec) && int.TryParse(arr[3], out ms))
                                {
                                    comments.Paragraphs.Add(new Paragraph(new TimeCode(hour, min, sec, ms * 10), new TimeCode(0, 0, 0, 0), line));
                                }
                            }
                        }
                    }
                }
            }

            if (!subtitle.Header.Contains("[Events]"))
            {
                subtitle.Header = subtitle.Header.Trim() + Environment.NewLine +
                                   Environment.NewLine +
                                   "[Events]" + Environment.NewLine +
                                   "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text" + Environment.NewLine;
            }
            else
            {
                subtitle.Header = subtitle.Header.Remove(subtitle.Header.IndexOf("[Events]"));
                subtitle.Header = subtitle.Header.Trim() + Environment.NewLine +
                                   Environment.NewLine +
                                   "[Events]" + Environment.NewLine +
                                   "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text" + Environment.NewLine;
            }
            lines = new List<string>();
            foreach (string l in subtitle.Header.Trim().Replace(Environment.NewLine, "\n").Split('\n'))
                lines.Add(l);

            const string timeCodeFormat = "{0}:{1:00}:{2:00}.{3:00}"; // h:mm:ss.cc
            foreach (SubtitleSequence mp in sub)
            {
                Paragraph p = new Paragraph(string.Empty, mp.StartMilliseconds, mp.EndMilliseconds);
                string start = string.Format(timeCodeFormat, p.StartTime.Hours, p.StartTime.Minutes, p.StartTime.Seconds, p.StartTime.Milliseconds / 10);
                string end = string.Format(timeCodeFormat, p.EndTime.Hours, p.EndTime.Minutes, p.EndTime.Seconds, p.EndTime.Milliseconds / 10);

                //MKS contains this: ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect, Text

                for (int commentIndex = 0; commentIndex < comments.Paragraphs.Count; commentIndex++)
                {
                    var cp = comments.Paragraphs[commentIndex];
                    if (cp.StartTime.TotalMilliseconds <= p.StartTime.TotalMilliseconds)
                        lines.Add(cp.Text);
                }
                for (int commentIndex = comments.Paragraphs.Count - 1; commentIndex >= 0; commentIndex--)
                {
                    var cp = comments.Paragraphs[commentIndex];
                    if (cp.StartTime.TotalMilliseconds <= p.StartTime.TotalMilliseconds)
                        comments.Paragraphs.RemoveAt(commentIndex);
                }

                string text = mp.Text;
                int idx = text.IndexOf(',') + 1;
                if (idx > 0 && idx < text.Length)
                {
                    text = text.Remove(0, idx); // remove ReadOrder
                    idx = text.IndexOf(',');
                    text = text.Insert(idx, "," + start + "," + end);
//.........这里部分代码省略.........
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:101,代码来源:Main.cs

示例8: ComboBoxSubtitleFormatsEnter

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

示例9: ComboBoxSubtitleFormatsSelectedIndexChanged

        private void ComboBoxSubtitleFormatsSelectedIndexChanged(object sender, EventArgs e)
        {
            _converted = true;
            if (_oldSubtitleFormat == null)
            {
                if (!_loading)
                    MakeHistoryForUndo(string.Format(_language.BeforeConvertingToX, GetCurrentSubtitleFormat().FriendlyName));
            }
            else
            {
                _subtitle.MakeHistoryForUndo(string.Format(_language.BeforeConvertingToX, GetCurrentSubtitleFormat().FriendlyName), _oldSubtitleFormat, _fileDateTime, _subtitleAlternate, _subtitleAlternateFileName, _subtitleListViewIndex, textBoxListViewText.SelectionStart, textBoxListViewTextAlternate.SelectionStart);
                _oldSubtitleFormat.RemoveNativeFormatting(_subtitle, GetCurrentSubtitleFormat());
                SaveSubtitleListviewIndexes();
                SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
                RestoreSubtitleListviewIndexes();

                if (_oldSubtitleFormat.HasStyleSupport && _networkSession == null)
                {
                    SubtitleListview1.HideExtraColumn();
                }
            }
            SubtitleFormat format = GetCurrentSubtitleFormat();
            if (_oldSubtitleFormat != null && !_oldSubtitleFormat.IsFrameBased && format.IsFrameBased)
                _subtitle.CalculateFrameNumbersFromTimeCodesNoCheck(CurrentFrameRate);
            else if (_oldSubtitleFormat != null && _oldSubtitleFormat.IsFrameBased && !format.IsFrameBased)
                _subtitle.CalculateTimeCodesFromFrameNumbers(CurrentFrameRate);
            ShowSource();
            SubtitleListview1.DisplayExtraFromExtra = false;
            if (format != null)
            {
                ShowStatus(string.Format(_language.ConvertedToX, format.FriendlyName));
                _oldSubtitleFormat = format;

                if (format.HasStyleSupport && _networkSession == null)
                {
                    List<string> styles = new List<string>();
                    if (format.GetType() == typeof(AdvancedSubStationAlpha) || format.GetType() == typeof(SubStationAlpha))
                        styles = AdvancedSubStationAlpha.GetStylesFromHeader(_subtitle.Header);
                    else if (format.GetType() == typeof(TimedText10) || format.GetType() == typeof(ItunesTimedText))
                        styles = TimedText10.GetStylesFromHeader(_subtitle.Header);
                    else if (format.GetType() == typeof(Sami) || format.GetType() == typeof(SamiModern))
                        styles = Sami.GetStylesFromHeader(_subtitle.Header);
                    else if (format.Name == "Nuendo")
                        styles = GetNuendoStyles();

                    foreach (Paragraph p in _subtitle.Paragraphs)
                    {
                        if (string.IsNullOrEmpty(p.Extra) && styles.Count > 0)
                            p.Extra = styles[0];
                    }

                    if (format.GetType() == typeof(Sami) || format.GetType() == typeof(SamiModern))
                        SubtitleListview1.ShowExtraColumn(Configuration.Settings.Language.General.Class);
                    else if (format.GetType() == typeof(TimedText10) || format.GetType() == typeof(ItunesTimedText))
                        SubtitleListview1.ShowExtraColumn("Style / Language");
                    else if (format.Name == "Nuendo")
                        SubtitleListview1.ShowExtraColumn("Character"); //TODO: Put in language xml file
                    else
                        SubtitleListview1.ShowExtraColumn(Configuration.Settings.Language.General.Style);
                    SubtitleListview1.DisplayExtraFromExtra = true;
                    SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
                }
            }
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:64,代码来源:Main.cs

示例10: OpenSubtitle


//.........这里部分代码省略.........
                        this.ImportAndOcrBluRaySup(fileName, this._loading);
                        return;
                    }

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

                        return;
                    }

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

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

                bool change = this._changeSubtitleToString != SerializeSubtitle(this._subtitle);
                if (change)
                {
                    change = this._lastDoNotPrompt != SerializeSubtitle(this._subtitle);
                }

                SubtitleFormat format = this._subtitle.LoadSubtitle(fileName, out encoding, encoding);
                if (!change)
                {
                    this._changeSubtitleToString = SerializeSubtitle(this._subtitle);
                }

                this.ShowHideTextBasedFeatures(format);

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

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

示例11: RunBatchSettings

        public void RunBatchSettings(Subtitle subtitle, SubtitleFormat format, Encoding encoding, string language)
        {
            _autoDetectGoogleLanguage = language;
            var ci = CultureInfo.GetCultureInfo(_autoDetectGoogleLanguage);
            string threeLetterISOLanguageName = ci.ThreeLetterISOLanguageName;

            comboBoxLanguage.Items.Clear();
            foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
                comboBoxLanguage.Items.Add(x);
            comboBoxLanguage.Sorted = true;
            int languageIndex = 0;
            int j = 0;
            foreach (var x in comboBoxLanguage.Items)
            {
                var xci = (CultureInfo)x;
                if (xci.TwoLetterISOLanguageName == ci.TwoLetterISOLanguageName)
                {
                    languageIndex = j;
                    break;
                }
                else if (xci.TwoLetterISOLanguageName == "en")
                {
                    languageIndex = j;
                }
                j++;
            }
            comboBoxLanguage.SelectedIndex = languageIndex;
            AddFixActions(subtitle, threeLetterISOLanguageName);
            _originalSubtitle = new Subtitle(subtitle); // copy constructor
            _subtitle = new Subtitle(subtitle); // copy constructor
            _format = format;
            _encoding = encoding;
            _onlyListFixes = false;
            InitUI();
            groupBoxStep1.Text = string.Empty;
            buttonBack.Visible = false;
            buttonNextFinish.Visible = false;
            buttonCancel.Text = Configuration.Settings.Language.General.OK;
        }
开发者ID:nguansak,项目名称:subtitleedit,代码行数:39,代码来源:FixCommonErrors.cs

示例12: Initialize

        public void Initialize(Subtitle subtitle, SubtitleFormat format, Encoding encoding)
        {
            _autoDetectGoogleLanguage = Utilities.AutoDetectGoogleLanguage(encoding); // Guess language via encoding
            if (string.IsNullOrEmpty(_autoDetectGoogleLanguage))
                _autoDetectGoogleLanguage = Utilities.AutoDetectGoogleLanguage(subtitle); // Guess language based on subtitle contents
            if (_autoDetectGoogleLanguage.ToLower() == "zh")
                _autoDetectGoogleLanguage = "zh-CHS"; // Note that "zh-CHS" (Simplified Chinese) and "zh-CHT" (Traditional Chinese) are neutral cultures
            CultureInfo ci = CultureInfo.GetCultureInfo(_autoDetectGoogleLanguage);
            string threeLetterISOLanguageName = ci.ThreeLetterISOLanguageName;

            comboBoxLanguage.Items.Clear();
            foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
                comboBoxLanguage.Items.Add(x);
            comboBoxLanguage.Sorted = true;
            int languageIndex = 0;
            int j = 0;
            foreach (var x in comboBoxLanguage.Items)
            {
                var xci = (CultureInfo)x;
                if (xci.TwoLetterISOLanguageName == ci.TwoLetterISOLanguageName)
                {
                    languageIndex = j;
                    break;
                }
                else if (xci.TwoLetterISOLanguageName == "en")
                {
                    languageIndex = j;
                }
                j++;
            }
            comboBoxLanguage.SelectedIndex = languageIndex;

            AddFixActions(subtitle, threeLetterISOLanguageName);

            _originalSubtitle = new Subtitle(subtitle); // copy constructor
            _subtitle = new Subtitle(subtitle); // copy constructor
            _format = format;
            _encoding = encoding;
            InitUI();
        }
开发者ID:nguansak,项目名称:subtitleedit,代码行数:40,代码来源:FixCommonErrors.cs

示例13: Initialize

        /// <summary>
        /// The initialize.
        /// </summary>
        /// <param name="subtitle">
        /// The subtitle.
        /// </param>
        /// <param name="format">
        /// The format.
        /// </param>
        /// <param name="exportType">
        /// The export type.
        /// </param>
        /// <param name="fileName">
        /// The file name.
        /// </param>
        /// <param name="videoInfo">
        /// The video info.
        /// </param>
        /// <param name="videoFileName">
        /// The video file name.
        /// </param>
        internal void Initialize(Subtitle subtitle, SubtitleFormat format, string exportType, string fileName, VideoInfo videoInfo, string videoFileName)
        {
            this._exportType = exportType;
            this._fileName = fileName;
            this._format = format;
            this._videoFileName = videoFileName;
            if (exportType == "BLURAYSUP")
            {
                this.Text = "Blu-ray SUP";
            }
            else if (exportType == "VOBSUB")
            {
                this.Text = "VobSub (sub/idx)";
            }
            else if (exportType == "FAB")
            {
                this.Text = "FAB Image Script";
            }
            else if (exportType == "IMAGE/FRAME")
            {
                this.Text = "Image per frame";
            }
            else if (exportType == "STL")
            {
                this.Text = "DVD Studio Pro STL";
            }
            else if (exportType == "FCP")
            {
                this.Text = "Final Cut Pro";
            }
            else if (exportType == "DOST")
            {
                this.Text = "DOST";
            }
            else if (exportType == "EDL")
            {
                this.Text = "EDL";
            }
            else if (exportType == "DCINEMA_INTEROP")
            {
                this.Text = "DCinema interop/png";
            }
            else
            {
                this.Text = Configuration.Settings.Language.ExportPngXml.Title;
            }

            if (this._exportType == "VOBSUB" && !string.IsNullOrEmpty(Configuration.Settings.Tools.ExportVobSubFontName))
            {
                this._subtitleFontName = Configuration.Settings.Tools.ExportVobSubFontName;
            }
            else if ((this._exportType == "BLURAYSUP" || this._exportType == "DOST") && !string.IsNullOrEmpty(Configuration.Settings.Tools.ExportBluRayFontName))
            {
                this._subtitleFontName = Configuration.Settings.Tools.ExportBluRayFontName;
            }
            else if (this._exportType == "FCP" && !string.IsNullOrEmpty(Configuration.Settings.Tools.ExportFcpFontName))
            {
                this._subtitleFontName = Configuration.Settings.Tools.ExportFcpFontName;
            }
            else if (!string.IsNullOrEmpty(Configuration.Settings.Tools.ExportFontNameOther))
            {
                this._subtitleFontName = Configuration.Settings.Tools.ExportFontNameOther;
            }

            if (this._exportType == "VOBSUB" && Configuration.Settings.Tools.ExportVobSubFontSize > 0)
            {
                this._subtitleFontSize = Configuration.Settings.Tools.ExportVobSubFontSize;
            }
            else if ((this._exportType == "BLURAYSUP" || this._exportType == "DOST") && Configuration.Settings.Tools.ExportBluRayFontSize > 0)
            {
                this._subtitleFontSize = Configuration.Settings.Tools.ExportBluRayFontSize;
            }
            else if (this._exportType == "FCP" && Configuration.Settings.Tools.ExportFcpFontSize > 0)
            {
                this._subtitleFontSize = Configuration.Settings.Tools.ExportFcpFontSize;
            }
            else if (Configuration.Settings.Tools.ExportLastFontSize > 0)
            {
                this._subtitleFontSize = Configuration.Settings.Tools.ExportLastFontSize;
//.........这里部分代码省略.........
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:101,代码来源:ExportPngXml.cs

示例14: OpenSubtitle


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

                    // retry bluray sup (file with wrong extension)
                    if (IsBluRaySupFile(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;
                    }


                    if (MessageBox.Show(this, string.Format(_language.FileXIsLargerThan10Mb + Environment.NewLine +
                                                      Environment.NewLine +
                                                      _language.ContinueAnyway,
                                                      fileName), 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 != SerializeSubtitle(_subtitle);
                if (change)
                    change = _lastDoNotPrompt != SerializeSubtitle(_subtitle);

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

                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;
                        format = GetCurrentSubtitleFormat();
                    }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:67,代码来源:Main.cs

示例15: SetCurrentFormat

        public void SetCurrentFormat(SubtitleFormat format)
        {
            if (format.IsVobSubIndexFile)
            {
                comboBoxSubtitleFormats.Items.Clear();
                comboBoxSubtitleFormats.Items.Add(format.FriendlyName);

                SubtitleListview1.HideNonVobSubColumns();
            }
            else if (comboBoxSubtitleFormats.Items.Count == 1)
            {
                SetFormatToSubRip();
                SubtitleListview1.ShowAllColumns();
            }

            int i = 0;
            foreach (object obj in comboBoxSubtitleFormats.Items)
            {
                if (obj.ToString() == format.FriendlyName)
                    comboBoxSubtitleFormats.SelectedIndex = i;
                i++;
            }
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:23,代码来源:Main.cs


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