Skip to content

Commit

Permalink
Merge pull request #3 from fediachov/console_intercept
Browse files Browse the repository at this point in the history
Console intercept
  • Loading branch information
RadiumByte authored Apr 1, 2020
2 parents 2a3aa53 + e393a57 commit 2537675
Show file tree
Hide file tree
Showing 17 changed files with 787 additions and 616 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The language of the program interface is determined automatically depending on t

## Copyright, License

Seven Converter is copyright (c) 2013-2020 SevenBytes Software.
Seven Converter is copyright (c) 2013-2020 Sevenbytes Software.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Expand Down
13 changes: 9 additions & 4 deletions SevenConverter/Actions/ConvertAudio.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SevenConverter.Utils;
using SevenConverter.Forms;
using SevenConverter.Utils;
using System;
using System.IO;
using System.Text;
Expand Down Expand Up @@ -38,9 +39,13 @@ private bool ConvertAudio(string sourceFile, string destFile, bool quoted = true

command.AppendFormat(" -threads 0 \"{0}\"", destFile);

result = Execute.RunApp(
String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFmpeg_Exe_Name), "\""),
command.ToString());
using (RunForm runForm = new RunForm())
{
runForm.Command = String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFmpeg_Exe_Name), "\"");
runForm.Args = command.ToString();
runForm.ShowDialog();
result = !runForm.ErrorState;
}
}
else
MessageBox.Show(String.Format(Properties.strings.FolderDoesNotExistParam, dest_path));
Expand Down
14 changes: 9 additions & 5 deletions SevenConverter/Actions/ConvertVideo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SevenConverter.Utils;
using SevenConverter.Forms;
using SevenConverter.Utils;
using System;
using System.IO;
using System.Text;
Expand Down Expand Up @@ -140,10 +141,13 @@ private bool ConvertVideo(string sourceFile, string destFile, bool quoted = true
command.AppendFormat(" -stats -scodec copy -threads 0 \"{0}\"", destFile);

// run ffmpeg
result = Execute.RunApp(
String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFmpeg_Exe_Name), "\""),
command.ToString()
);
using (RunForm runForm = new RunForm())
{
runForm.Command = String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFmpeg_Exe_Name), "\"");
runForm.Args = command.ToString();
runForm.ShowDialog();
result = !runForm.ErrorState;
}
}
else
MessageBox.Show(String.Format(Properties.strings.FolderDoesNotExistParam, dest_path));
Expand Down
16 changes: 13 additions & 3 deletions SevenConverter/Actions/FileInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SevenConverter.Utils;
using SevenConverter.Forms;
using SevenConverter.Utils;
using System;
using System.IO;
using System.Windows.Forms;
Expand All @@ -12,8 +13,17 @@ public partial class Main : Form
private void FileInfo(string path)
{
if (File.Exists(path))
Execute.RunApp(String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFprobe_Exe_Name), "\""),
String.Concat(" -hide_banner -loglevel fatal -pretty -show_format -show_streams -show_entries stream=codec_type,r_frame_rate,width,height,sample_aspect_ratio:stream_disposition=:format_tags=timecode,company_name,product_name,product_version -i \"", path, "\""));
{
using (RunForm runForm = new RunForm())
{
runForm.Text = Properties.strings.FileInformation;
runForm.Pause = true;
runForm.Command = String.Concat("\"",
Path.Combine(ffmpeg_path, Files.FFprobe_Exe_Name), "\"");
runForm.Args = String.Concat(" -hide_banner -loglevel fatal -pretty -show_format -show_streams -show_entries stream=codec_type,r_frame_rate,width,height,sample_aspect_ratio:stream_disposition=:format_tags=timecode,company_name,product_name,product_version -i \"", path, "\"");
runForm.ShowDialog();
}
}
}

#endregion Private Methods
Expand Down
14 changes: 11 additions & 3 deletions SevenConverter/Actions/PlayFile.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SevenConverter.Utils;
using SevenConverter.Forms;
using SevenConverter.Utils;
using System;
using System.IO;
using System.Windows.Forms;
Expand All @@ -12,8 +13,15 @@ public partial class Main : Form
private void PlayFile(string path)
{
if (File.Exists(path))
Execute.RunApp(String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFplay_Exe_Name), "\""),
String.Concat(" -autoexit -i \"", path, "\""));
{
using (RunForm runForm = new RunForm())
{
runForm.Text = Properties.strings.Play;
runForm.Command = String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFplay_Exe_Name), "\"");
runForm.Args = String.Concat(" -autoexit -i \"", path, "\"");
runForm.ShowDialog();
}
}
}

#endregion Private Methods
Expand Down
12 changes: 1 addition & 11 deletions SevenConverter/Forms/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions SevenConverter/Forms/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public partial class Main : Form

public Main()
{
// for debug purposes
//Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("ru-RU");
// localization debug
//System.Threading.Thread.CurrentThread.CurrentUICulture =
// System.Globalization.CultureInfo.GetCultureInfo("ru-RU");
InitializeComponent();
}

Expand All @@ -32,7 +33,6 @@ public Main()
private string config_path;
private string ffmpeg_path, currentPath;

//private StringBuilder log;
private Settings settings;

private int videoPanelHeight;
Expand Down Expand Up @@ -64,6 +64,7 @@ private void BtnStart_Click(object sender, EventArgs e)
{
TurnOffPanels();
SaveConfig();

if (listSoruceFiles.Items.Count > 0)
{
if (!String.IsNullOrEmpty(tbDestFilePath.Text)
Expand All @@ -84,7 +85,6 @@ private void BtnStart_Click(object sender, EventArgs e)
&& Directory.Exists(tbDestFilePath.Text))
{
// Run
statusProgress.Visible = true;

// single output file (joined)
if (cbJoin.Checked)
Expand Down Expand Up @@ -116,7 +116,6 @@ private void BtnStart_Click(object sender, EventArgs e)
}

// done!
statusProgress.Visible = false;
SystemSounds.Exclamation.Play();
}
else
Expand Down Expand Up @@ -253,7 +252,15 @@ private void MenuItemInfo_Click(object sender, EventArgs e)
private void OpenFolder_Click(object sender, EventArgs e)
{
if (Directory.Exists(tbDestFilePath.Text))
Execute.RunApp("explorer.exe", tbDestFilePath.Text);
{
try
{
System.Diagnostics.Process.Start(tbDestFilePath.Text);
}
catch
{
}
}
}

private void PlayToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down
Loading

0 comments on commit 2537675

Please sign in to comment.