mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Added the updater to the soloution and did a bit of starting code.
This commit is contained in:
parent
98eadc9cc6
commit
96a40a2aaa
8 changed files with 165 additions and 24 deletions
42
PlexRequests.Updater/Updater.cs
Normal file
42
PlexRequests.Updater/Updater.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using PlexRequests.Core;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
|
||||
namespace PlexRequests.Updater
|
||||
{
|
||||
public class Updater
|
||||
{
|
||||
public void Start(){
|
||||
var c = new StatusChecker ();
|
||||
|
||||
try {
|
||||
|
||||
var release = c.GetStatus ();
|
||||
if(!release.UpdateAvailable)
|
||||
{
|
||||
Console.WriteLine ("No Update availble, shutting down");
|
||||
}
|
||||
|
||||
using(var client = new WebClient())
|
||||
using(var ms = new MemoryStream(client.DownloadData(release.DownloadUri), false))
|
||||
using(var gz = new GZipStream(ms, CompressionLevel.Optimal))
|
||||
{
|
||||
// TODO decompress stream
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
|
||||
Console.WriteLine (ex.Message);
|
||||
Console.WriteLine ("Oops... Looks like we cannot update!");
|
||||
Console.ReadLine ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue