Skip to content

Instantly share code, notes, and snippets.

@brandonio21
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonio21/f6af53fa7b985b7d03f4 to your computer and use it in GitHub Desktop.
Save brandonio21/f6af53fa7b985b7d03f4 to your computer and use it in GitHub Desktop.
Update.NET Tester Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace update.netTester
{
class Program
{
static void Main(string[] args)
{
Console.Write("Creating UPDATE.NET Object");
update.net.updater updateObject = new update.net.updater("VersionFileURL.txt",
"UpdateFileURL.exe",
"ChangelogURL.txt");
Console.WriteLine("... Done!");
Console.ReadLine();
Console.WriteLine("Getting changelog...");
Console.WriteLine(updateObject.getChangelog());
Console.ReadLine();
Console.Write("Checking if update is available...");
if (updateObject.isUpdateAvailable(".01"))
{
Console.WriteLine("YES!");
Console.ReadLine();
Console.Write("Downloading Update...");
updateObject.UpdateDownloadProgressChanged += updateObject_UpdateDownloadProgressChanged;
updateObject.UpdateDownloaded += handleComplete;
updateObject.downloadUpdate();
Console.ReadLine();
}
else
{
Console.WriteLine("NO!");
Console.ReadLine();
}
}
static void updateObject_UpdateDownloadProgressChanged(object sender, EventArgs e)
{
System.Net.DownloadProgressChangedEventArgs args = (System.Net.DownloadProgressChangedEventArgs)e;
Console.Write(args.ProgressPercentage);
}
static public void handleComplete(System.Object sender, System.EventArgs e)
{
Console.WriteLine("Done!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment