mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-15 01:32:55 -07:00
42 lines
790 B
C#
42 lines
790 B
C#
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 ();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|