Advertisement
Guest User

Untitled

a guest
May 1st, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using UpdaterDotNet;
  6. using System.IO;
  7.  
  8. namespace UpdaterTest
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             if (!File.Exists("Version.txt"))
  15.             {
  16.                 Console.WriteLine("Version.txt not found.");
  17.                 return;
  18.             }
  19.  
  20.             uint buildNumber = uint.Parse(File.ReadAllText("Version.txt"));
  21.             string buildsUrl = "http://yoururl.com/Patches/PatchInfo.xml";
  22.  
  23.             Console.WriteLine("Updater Started! Checking for updates...");
  24.  
  25.             UpdateManager updater = new UpdateManager();
  26.             if (updater.CheckForUpdates(buildsUrl, buildNumber))
  27.             {
  28.                 if (updater.ShowUpdateNotice())
  29.                 {
  30.                     if (!updater.DownloadUpdate())
  31.                     {
  32.                         Console.WriteLine("Error downloading update");
  33.                         return;
  34.                     }
  35.  
  36.                     if (!updater.InstallUpdate(null))
  37.                     {
  38.                         Console.WriteLine("Error running installer");
  39.                         return;
  40.                     }
  41.                 }
  42.             }
  43.             updater.Dispose();
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement