Zbiór zmian 597 dla trunk/BazaReklam/FormBadVer.cs
- Data:
- 2009-04-21 17:45:38 (17 years ago)
- Pliki:
-
- 1 zmodyfikowane
-
trunk/BazaReklam/FormBadVer.cs (zmodyfikowane) (4 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/BazaReklam/FormBadVer.cs
r65 r597 1 1 using System; 2 using System.Collections.Generic;3 2 using System.ComponentModel; 4 using System.Data;5 using System.Drawing;6 using System.Text;7 3 using System.Windows.Forms; 8 4 using System.Net; 9 5 using System.Diagnostics; 6 10 7 using Baza_Reklam.Classes; 11 8 … … 14 11 public partial class FormBadVer : Form 15 12 { 16 private WebClient webClient; 17 private bool isBusy = false; 18 const string strUrl = "http://www.infocity.pl/baza_reklam/files/Updater.exe"; 13 const string UPDATER_URL = "http://www.infocity.pl/baza_reklam/update/updater.exe"; 14 const string ZIP_URL = "http://www.infocity.pl/baza_reklam/update/BazaReklam.zip"; 15 16 private readonly WebClient webClient; 19 17 20 18 public FormBadVer() 21 19 { 22 20 InitializeComponent(); 23 21 24 22 webClient = new WebClient(); 25 webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadFileCompleted);23 webClient.DownloadFileCompleted += DownloadFileCompleted; 26 24 } 27 25 28 26 private void button1_Click(object sender, EventArgs e) 29 27 { 30 string updater = Environment.CurrentDirectory + "\\Updater.exe"; 28 button1.Enabled = false; 29 Cursor = Cursors.WaitCursor; 30 button1.Cursor = Cursors.WaitCursor; 31 webClient.DownloadFileAsync(new Uri(UPDATER_URL), Environment.CurrentDirectory + "\\Updater.exe"); 32 return; 31 33 32 if (System.IO.File.Exists(updater)) 33 { 34 StartUpdater(); 35 } 36 else 37 { 38 isBusy = true; 39 webClient.DownloadFileAsync(new Uri(strUrl), Environment.CurrentDirectory + "\\Updater.exe"); 40 } 34 //TODO: Uncomment after every user will get updated version of the Updater 35 //string updater = Environment.CurrentDirectory + "\\Updater.exe"; 36 37 //if (System.IO.File.Exists(updater)) 38 // StartUpdater(); 39 //else 40 // webClient.DownloadFileAsync(new Uri(UPDATER_URL), Environment.CurrentDirectory + "\\Updater.exe"); 41 41 } 42 42 43 43 private void DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) 44 44 { 45 isBusy = false;46 47 45 if (e.Error == null) 48 46 { … … 52 50 { 53 51 MessageBox.Show("B³¹d aktualizacji oprogramowania: " + e.Error.Message, "Aktualizacja oprogramowania", MessageBoxButtons.OK, MessageBoxIcon.Error); 52 Logger.LogException(e.Error, "[aktualizacja]", DateTime.Now); 54 53 Close(); 55 54 } … … 59 58 { 60 59 string updater = Environment.CurrentDirectory + "\\Updater.exe"; 61 60 Cursor = Cursors.Default; 61 button1.Cursor = Cursors.Default; 62 62 Close(); 63 ProcessStartInfo startInfo = new ProcessStartInfo(); 64 startInfo.Arguments = "1"; 65 startInfo.FileName = updater; 66 Process.Start(startInfo); 63 Process.Start(updater, string.Format(" \"{0}\" {1}", "Baza Reklam", ZIP_URL)); 67 64 } 68 69 private void Extract(string zipFileName, string destinationPath)70 {71 Shell32.ShellClass sc = new Shell32.ShellClass();72 Shell32.Folder SrcFlder = sc.NameSpace(zipFileName);73 Shell32.Folder DestFlder = sc.NameSpace(destinationPath);74 Shell32.FolderItems items = SrcFlder.Items();75 DestFlder.CopyHere(items, 20);76 }77 78 79 65 } 80 66 }
