private void MenuItem_Subtitle_Click(object sender, RoutedEventArgs e) { loadFileClass = new LoadFileClass(); //取得對話框訊息 OpenFileDialog fileDialog = loadFileClass.openFileDialog(); if (string.IsNullOrEmpty(fileDialog.FileName)) { return; } //取得完整路徑 sub_path = fileDialog.FileName; //取得檔名 sub_name = fileDialog.SafeFileName; srtModel = SrtHelper.ParseSrt(sub_path); int timeMiles = (int)main_Command.mediaTimePosition * 1000; string timeString = SrtHelper.GetTimeString(timeMiles); Subtitle_TextBlock.Text = timeString; }
private void subtitle_calculator() { if (srtModel != null) { int timeMiles = (int)main_Command.mediaTimePosition * 1000 + 800; string timeString = SrtHelper.GetTimeString(timeMiles); Subtitle_TextBlock.Text = timeString; } }
private async void btnSub2_Click(object sender, RoutedEventArgs e) { var path = await OpenSubtitle(); if (path != null) { var srtModel = SrtHelper.ParseSrt(path); var first = srtModel.FirstOrDefault(); var last = srtModel.LastOrDefault(); txtBeginTime2.Text = $"Begin Time: {first.BeginHour}:{first.BeginMintue}:{first.BeginSecond}:{first.BeginMSecond}"; txtEndTime2.Text = $"End Time: {last.EndHour}:{last.EndMintue}:{last.EndSecond}:{last.EndMSecond}"; after = File.ReadAllText(path); ShowDiff(); } }
private async void btnSub1_Click(object sender, RoutedEventArgs e) { var path = await OpenSubtitle(); if (path != null) { var srtModel = SrtHelper.ParseSrt(path); var first = srtModel.FirstOrDefault(); var last = srtModel.LastOrDefault(); txtBeginTime1.Text = $"Begin Time: {first.BeginHour}:{first.BeginMintue}:{first.BeginSecond}:{first.BeginMSecond}"; txtEndTime1.Text = $"End Time: {last.EndHour}:{last.EndMintue}:{last.EndSecond}:{last.EndMSecond}"; before = File.ReadAllText(path); if (!string.IsNullOrEmpty(before) && !string.IsNullOrEmpty(after)) { sidebySideDiff.RenderDiff(before, after, ElementTheme.Default); } } }