Exemple #1
0
        private void UpdateTimePreview(object sender, EventArgs e)
        {
            var tb = sender as TextBox;

            if (tb == null)
            {
                return;
            }
            var parent = tb.Parent as FormSimplePrompt;

            if (parent == null)
            {
                return;
            }
            Label    lbInfo   = parent.lblDescription;
            Timecode parsedTC = null;

            try
            {
                parsedTC = Timecode.FromPositionString(tb.Text, RulerFormat.Unknown);
            }
            catch
            {
                lbInfo.Text = "";
            }
            if (parsedTC != null)
            {
                lbInfo.Text = parsedTC.ToPositionString(RulerFormat.Unknown);
            }
        }
Exemple #2
0
        private void tbInterval_TextChanged(object sender, EventArgs e)
        {
            var tb = sender as TextBox;

            if (tb == null)
            {
                return;
            }
            var parent = tb.Parent as FormMarkerCreate;

            if (parent == null)
            {
                return;
            }
            Label    lbInfo   = parent.lbTimecodePreview;
            Timecode parsedTC = null;

            try
            {
                parsedTC = Timecode.FromPositionString(tb.Text, RulerFormat.Unknown);
            }
            catch
            {
                lbInfo.Text = "";
            }
            if (parsedTC != null)
            {
                lbInfo.Text = parsedTC.ToPositionString(RulerFormat.Unknown);
            }
        }
        private Region Convert(TimeSpan start, TimeSpan end, string text)
        {
            Timecode position = Timecode.FromMilliseconds(start.TotalMilliseconds + 360);
            Timecode length   = Timecode.FromMilliseconds((end - start).TotalMilliseconds);

            TimeSpan _;

            if (!TimeSpan.TryParseExact(position.ToPositionString(), VEGAS_TIME_FORMAT, null, out _) &&
                !TimeSpan.TryParseExact(position.ToPositionString(), VEGAS_TIME_FORMAT_COMMA, null, out _))
            {
                throw new VegasException("Incorrect time format!", "Can't import subtitles because your time format is incorrect. Please change your time format to \"Time\" (hh:mm:ss.fff).");
            }

            if (length.ToMilliseconds() > 0 && !string.IsNullOrWhiteSpace(text))
            {
                return(new Region(position, length, text.Trim()));
            }
            else
            {
                return(null);
            }
        }