mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Put back the old download code
This commit is contained in:
parent
83a7fd87d4
commit
c0b716f2b7
1 changed files with 5 additions and 15 deletions
|
@ -171,8 +171,9 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
{
|
{
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "TempUpdate", $"Ombi.Updater{updaterExtension}"),
|
FileName = $"Ombi.Updater{updaterExtension}",
|
||||||
Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + " " + extension
|
Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + " " + extension,
|
||||||
|
WorkingDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "TempUpdate"),
|
||||||
};
|
};
|
||||||
using (var proc = new Process { StartInfo = start })
|
using (var proc = new Process { StartInfo = start })
|
||||||
{
|
{
|
||||||
|
@ -223,20 +224,9 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
public async Task DownloadAsync(string requestUri, string filename, PerformContext ctx)
|
public async Task DownloadAsync(string requestUri, string filename, PerformContext ctx)
|
||||||
{
|
{
|
||||||
Logger.LogDebug("Starting the DownloadAsync");
|
Logger.LogDebug("Starting the DownloadAsync");
|
||||||
using (var client = new HttpClient())
|
using (var client = new WebClient())
|
||||||
{
|
{
|
||||||
using (var result = await client.GetAsync(requestUri))
|
await client.DownloadFileTaskAsync(requestUri, filename);
|
||||||
{
|
|
||||||
if (result.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
var contentStream = await result.Content.ReadAsStreamAsync();
|
|
||||||
using (var stream =
|
|
||||||
new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None))
|
|
||||||
{
|
|
||||||
await contentStream.CopyToAsync(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue