public void CancelDownload() { if (!_webClient.IsBusy) // already canceled or used ExistingFirmwarePath { return; } LogUtil.LogEvent("Cancelling download"); _webClient.CancelAsync(); while (_webClient.IsBusy) { Thread.Sleep(50); } if (SafeFile.Exists(_fileName)) { SafeFile.Delete(_fileName); } }
public override ICommandResult Execute(IDictionary <string, string> vars, params string[] args) { if (args.Length != 1) { return(ArgsCountError(1, args)); } SubstituteVariables(vars, args); string filePath = args[0]; if (string.IsNullOrWhiteSpace(filePath)) { return(Error("the file path was empty or white space")); } SafeFile.Delete(filePath); return(Success()); }