Prompt to download ffmpeg.exe if not exist

Screencasting can happen soon after but process is being used.
This commit is contained in:
McoreD 2014-05-10 09:52:09 +08:00
parent 3b255970f6
commit 380d4be6ec
7 changed files with 55 additions and 32 deletions

View file

@ -290,4 +290,23 @@ public enum ColorFormat
{
RGB, RGBA, ARGB
}
public enum ProxyMethod
{
None,
Manual,
Automatic
}
public enum ProxyType
{
[Description("HTTP proxy")]
HTTP,
[Description("SOCKS v4 proxy")]
SOCKS4,
[Description("SOCKS v4a proxy")]
SOCKS4a,
[Description("SOCKS v5 proxy")]
SOCKS5
}
}

View file

@ -59,6 +59,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Starksoft.Net.Proxy">
<HintPath>..\Lib\Starksoft.Net.Proxy.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
@ -104,6 +107,7 @@
<Compile Include="Native\NativeConstants.cs" />
<Compile Include="PingHelper.cs" />
<Compile Include="PingResult.cs" />
<Compile Include="ProxyInfo.cs" />
<Compile Include="UITypeEditors\EnumDescriptionConverter.cs" />
<Compile Include="UITypeEditors\DirectoryNameEditor.cs" />
<Compile Include="UITypeEditors\MyColorConverter.cs" />

View file

@ -29,7 +29,7 @@ You should have received a copy of the GNU General Public License
using System.Net;
using System.Reflection;
namespace UploadersLib
namespace HelpersLib
{
public class ProxyInfo
{

View file

@ -42,16 +42,24 @@ public partial class FFmpegCLIOptionsForm : Form
{
private ScreencastOptions Options = null;
public FFmpegCLIOptionsForm()
{
InitializeComponent();
this.Text = string.Format("{0} - FFmpeg CLI Options", Application.ProductName);
this.Icon = ShareXResources.Icon;
}
public FFmpegCLIOptionsForm(ScreencastOptions options)
: this()
{
Options = options;
InitializeComponent();
this.Text = string.Format("{0} - FFmpeg CLI Options", Application.ProductName);
this.Icon = ShareXResources.Icon;
LoadSettings();
UpdateUI();
if (options != null)
{
LoadSettings();
UpdateUI();
}
}
private void LoadSettings()
@ -128,6 +136,11 @@ private void buttonFFmpegHelp_Click(object sender, EventArgs e)
}
private void btnDownload_Click(object sender, EventArgs e)
{
DownloadFFmpeg();
}
public void DownloadFFmpeg(bool showConfirmation = true)
{
string url;
@ -142,7 +155,7 @@ private void btnDownload_Click(object sender, EventArgs e)
using (DownloaderForm form = new DownloaderForm(url, "ffmpeg.7z"))
{
//form.Proxy =
form.Proxy = ProxyInfo.Current.GetWebProxy();
form.InstallType = InstallType.Event;
form.InstallRequested += form_InstallRequested;
form.ShowDialog();
@ -157,11 +170,11 @@ private void form_InstallRequested(string filePath)
if (result)
{
this.InvokeSafe(() => textBoxFFmpegPath.Text = "ffmpeg.exe");
MessageBox.Show("FFmpeg successfully downloaded.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("FFmpeg successfully downloaded.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Download of FFmpeg failed.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("Download of FFmpeg failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

View file

@ -26,6 +26,7 @@ You should have received a copy of the GNU General Public License
using HelpersLib;
using ScreenCaptureLib;
using ShareX.Properties;
using System;
using System.Drawing;
using System.IO;
using System.Threading;
@ -100,8 +101,14 @@ public async void StartRecording(TaskSettings TaskSettings)
if (TaskSettings.CaptureSettings.ScreenRecordOutput == ScreenRecordOutput.FFmpegCLI && !File.Exists(TaskSettings.CaptureSettings.FFmpegOptions.CLIPath))
{
MessageBox.Show("FFmpeg CLI file does not exist: " + TaskSettings.CaptureSettings.FFmpegOptions.CLIPath + "\r\nYou can automatically download it from FFmpeg options window.",
Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
if (MessageBox.Show("ffmpeg.exe does not exist." + Environment.NewLine + Environment.NewLine + "Would you like to automatically download it?",
Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
{
using (FFmpegCLIOptionsForm form = new FFmpegCLIOptionsForm())
{
form.DownloadFFmpeg();
}
}
}
SelectRegion();

View file

@ -162,25 +162,6 @@ public enum ResponseType
Headers
}
public enum ProxyMethod
{
None,
Manual,
Automatic
}
public enum ProxyType
{
[Description("HTTP proxy")]
HTTP,
[Description("SOCKS v4 proxy")]
SOCKS4,
[Description("SOCKS v4a proxy")]
SOCKS4a,
[Description("SOCKS v5 proxy")]
SOCKS5
}
public enum FTPProtocol
{
[Description("FTP")]

View file

@ -266,7 +266,6 @@
<Compile Include="ImageUploaders\Photobucket.cs" />
<Compile Include="SocialServices\Twitter.cs" />
<Compile Include="HelperClasses\ProgressManager.cs" />
<Compile Include="ProxyInfo.cs" />
<Compile Include="HelperClasses\TCPClient.cs" />
<Compile Include="ImageUploader.cs" />
<Compile Include="FileUploaders\CustomFileUploader.cs" />