You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/PlexRequests.Updater/Updater.cs

43 lines
790 B

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 ();
}
}
}
}