Advertisement
Guest User

AutoUpdater With Parameters

a guest
Dec 3rd, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.97 KB | None | 0 0
  1.     public static class AutoUpdater
  2.     {
  3.         internal static String FileArguments;
  4.         private static void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e)
  5.         {
  6.                     XmlNode appCastFileArguments = item.SelectSingleNode("args");
  7.  
  8.                     FileArguments = appCastFileArguments != null ? appCastFileArguments.InnerText : "";
  9.  
  10.                     if (IntPtr.Size.Equals(8))
  11.                     {
  12.                         XmlNode appCastUrl64 = item.SelectSingleNode("url64");
  13.  
  14.                         var downloadURL64 = appCastUrl64 != null ? appCastUrl64.InnerText : "";
  15.  
  16.                         XmlNode appCastFileArguments64 = item.SelectSingleNode("args64");
  17.  
  18.                         var fileArguments64 = appCastFileArguments64 != null ? appCastFileArguments64.InnerText : "";
  19.                        
  20.                         if(!string.IsNullOrEmpty(downloadURL64))
  21.                         {
  22.                             DownloadURL = downloadURL64;
  23.                             if (!string.IsNullOrEmpty(fileArguments64))
  24.                             {
  25.                                 FileArguments = fileArguments64;
  26.                             }
  27.                         }
  28.                     }
  29.         }
  30.     }
  31.  
  32.  
  33.  
  34.  
  35.  
  36.     internal partial class DownloadUpdateDialog : Form
  37.     {
  38.         private readonly string _arguments;
  39.  
  40.         public DownloadUpdateDialog(string downloadURL, string arguments)
  41.         {
  42.             InitializeComponent();
  43.             this.Text = string.Format("Downloading {0} Update.", AutoUpdater.AppTitle);
  44.             _downloadURL = downloadURL;
  45.             _arguments = arguments;
  46.         }
  47.  
  48.         private void OnDownloadComplete(object sender, AsyncCompletedEventArgs e)
  49.         {
  50.             if (!e.Cancelled)
  51.             {
  52.                 var processStartInfo = new ProcessStartInfo {FileName = _tempPath, Arguments = _arguments, UseShellExecute = true};
  53.             }
  54.         }
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement