AlexxEG/YouTube-Downloader

Manual updating youtube-dl from the application

Closed this issue · 0 comments

1. Adding a global variable and a public method in YoutubeDlHelper.cs.

// Global variable
public const string Update = " -U";

// Public method
public static string UpdateYoutubeDL()
{
     string update=string.Empty;
     StartProcess(null, Commands.Update, string.Empty,delegate (Process process, string line)
     {
          if (!string.IsNullOrEmpty(line))
          update = line.Trim();
     }, null).WaitForExit();

     return update;
}

2. Calling UpdateYoutubeDL() method under click event of update button in UpdateDownloader form.

private void btnUpdate_Click(object sender, EventArgs e)
{
     lyoutubedl.Text = "Updating...";
     lyoutubedl.Text = YoutubeDlHelper.UpdateYoutubeDL();
}

update