Last active
August 29, 2015 14:03
-
-
Save brandonio21/f6af53fa7b985b7d03f4 to your computer and use it in GitHub Desktop.
Update.NET Tester Program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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