private static void saveAsTXT(StreamWriter streamWriter, Video video, Subtitle subtitle)
 {
     foreach (var item in subtitle.Items)
     {
         streamWriter.WriteLine("[{0}] {1}", TimeFormatUtil.GetHHMMSSOrMMSS(item.StartSeconds, item.IsOneHourExcessed), item.Text);
     }
 }
 public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     if (values == null || !(values[0] is bool) || !(values[1] is double))
     {
         return(TimeFormatUtil.INVALID_HHMMSS);
     }
     return(TimeFormatUtil.GetHHMMSSOrMMSS((double)values[1], (bool)values[0]));
 }
        private static void saveAsHTML(StreamWriter streamWriter, Video video, Subtitle subtitle)
        {
            streamWriter.WriteLine("<!DOCTYPE HTML>");
            streamWriter.WriteLine("<HTML>");
            streamWriter.WriteLine("<HEAD>");
            streamWriter.WriteLine("<TITLE>" + video.Title + "</TITLE>");
            streamWriter.WriteLine("</HEAD>");
            streamWriter.WriteLine("<BODY>");

            foreach (var item in subtitle.Items)
            {
                streamWriter.WriteLine("<P>[{0}] {1}</P>",
                                       TimeFormatUtil.GetHHMMSSOrMMSS(item.StartSeconds, item.IsOneHourExcessed),
                                       item.Text);
                streamWriter.WriteLine("\r\n");
            }

            streamWriter.WriteLine("</BODY>");
            streamWriter.WriteLine("</HTML>");
        }
        public void Execute(object parameter)
        {
            IEnumerable enumerable = parameter as IEnumerable;

            if (enumerable != null)
            {
                var subtitleItems = enumerable.OfType <SubtitleItem>().OrderBy(s => s.StartSeconds).ToList();

                var sb = new StringBuilder();
                foreach (var item in subtitleItems)
                {
                    sb.Append(TimeFormatUtil.GetHHMMSSOrMMSS(item.StartSeconds, item.IsOneHourExcessed));
                    sb.Append(' ');
                    sb.Append(item.Text);
                    sb.Append(Environment.NewLine);
                    sb.Append(Environment.NewLine);
                }
                sb.Length -= Environment.NewLine.Length;

                Clipboard.SetText(sb.ToString());
            }
        }