Update to 0.4.0.1.
Fix issue with allowing concurrent update.
This commit is contained in:
parent
e3841aa9ec
commit
8d08b0e1a1
@ -81,11 +81,22 @@ namespace com.captainalm.YTDLNetFrontEnd
|
||||
|
||||
private void backgroundWorkerMain_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
setEnableButtons(false);
|
||||
|
||||
if (theProcess != null)
|
||||
{
|
||||
if (((Control.ModifierKeys & Keys.Shift) == Keys.Shift)) theProcess.kill();
|
||||
theProcess.waitForExit();
|
||||
theProcess.close();
|
||||
}
|
||||
|
||||
switch ((BWArg)e.Argument)
|
||||
{
|
||||
case BWArg.Install:
|
||||
setEnableButtons(false);
|
||||
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
textBoxOutput.AppendText("Updating YT-DL BackEnd..." + Environment.NewLine);
|
||||
}));
|
||||
using (var locpro =
|
||||
YTDL.executeInstall((YTDL.getInstalled() != ApplicationType.Unavailable) ? YTDL.getInstalled() :
|
||||
(((Control.ModifierKeys & Keys.Shift) == Keys.Shift) ? ApplicationType.YoutubeDL : ApplicationType.YT_DLP),
|
||||
@ -120,15 +131,6 @@ namespace com.captainalm.YTDLNetFrontEnd
|
||||
setEnableButtons(true);
|
||||
break;
|
||||
case BWArg.Go:
|
||||
setEnableButtons(false);
|
||||
|
||||
if (theProcess != null)
|
||||
{
|
||||
if (((Control.ModifierKeys & Keys.Shift) == Keys.Shift)) theProcess.kill();
|
||||
theProcess.waitForExit();
|
||||
theProcess.close();
|
||||
}
|
||||
|
||||
var theTarget = "";
|
||||
var extraArgs = "";
|
||||
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.4.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.4.0.0")]
|
||||
[assembly: AssemblyVersion("0.4.0.1")]
|
||||
[assembly: AssemblyFileVersion("0.4.0.1")]
|
||||
|
@ -12,6 +12,7 @@ namespace com.captainalm.YTDLNetFrontEnd.util
|
||||
protected Process representation;
|
||||
protected List<IProcessOuputReceiver> outputReceivers = new List<IProcessOuputReceiver>();
|
||||
protected List<IProcessOuputReceiver> errorReceivers = new List<IProcessOuputReceiver>();
|
||||
protected bool closed = false;
|
||||
|
||||
private object inputSLock = new object();
|
||||
private object outputSLock = new object();
|
||||
@ -68,7 +69,7 @@ namespace com.captainalm.YTDLNetFrontEnd.util
|
||||
{
|
||||
lock (processSLock)
|
||||
{
|
||||
if (!startInfo.RedirectStandardInput || representation == null || representation.HasExited) return;
|
||||
if (!startInfo.RedirectStandardInput || representation == null || closed || representation.HasExited) return;
|
||||
lock (inputSLock)
|
||||
{
|
||||
representation.StandardInput.Write(inputData);
|
||||
@ -78,6 +79,7 @@ namespace com.captainalm.YTDLNetFrontEnd.util
|
||||
|
||||
public Process start()
|
||||
{
|
||||
if (closed) return null;
|
||||
lock (processSLock)
|
||||
{
|
||||
representation = Process.Start(startInfo);
|
||||
@ -128,7 +130,7 @@ namespace com.captainalm.YTDLNetFrontEnd.util
|
||||
|
||||
public void waitForExit()
|
||||
{
|
||||
if (representation == null) return;
|
||||
if (representation == null || closed) return;
|
||||
if (!representation.HasExited) representation.WaitForExit();
|
||||
}
|
||||
|
||||
@ -139,7 +141,8 @@ namespace com.captainalm.YTDLNetFrontEnd.util
|
||||
|
||||
public void close()
|
||||
{
|
||||
if (representation == null) return;
|
||||
if (representation == null || closed) return;
|
||||
closed = true;
|
||||
waitForExit();
|
||||
if (representation != null && startInfo.RedirectStandardInput) representation.StandardInput.Close();
|
||||
representation.Close();
|
||||
@ -147,7 +150,7 @@ namespace com.captainalm.YTDLNetFrontEnd.util
|
||||
|
||||
public void kill()
|
||||
{
|
||||
if (representation != null && !representation.HasExited) representation.Kill();
|
||||
if (representation != null && !closed && !representation.HasExited) representation.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user