private static void Main(string[] args) { if (args.Length == 0) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (true || UpdateHelper.HasWriteAccessToFolder(UpdateHelper.FommUninstallInfo.InstallLocation)) { Application.Run(new UpdateForm(/*UpdateHelper.FommUninstallInfo*/)); } else if (!UpdateHelper.IsProcessElevated) { UpdateHelper.RunElevated(); } else { string strMessage = String.Format("Must have write access to directory: {0}", UpdateHelper.FommUninstallInfo.InstallLocation); MessageBox.Show(strMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { return; // @fixme temporary disabled switch (args[0]) { case "--update-associations": MessageBox.Show(String.Join(" ", args)); if (!UpdateHelper.IsProcessElevated) { UpdateHelper.RunElevated(args); } else { string[] assoc = new string[args.Length - 1]; Array.Copy(args, 1, assoc, 0, args.Length - 1); UpdateHelper.Associate(assoc); } break; } } }
void ApplyUpdateAsync() { PrepareUpdate(); if (SelfUpdate()) { UpdateHelper.Restart(); } progressBar1.Maximum = (int)updatePackage.CompressedCatalogSize; progressBar1.Value = 0; foreach (ZipStorer.ZipFileEntry entry in updatePackageCatalog) { if (entry.FilenameInZip == AppDomain.CurrentDomain.FriendlyName) { continue; } updatePackage.ExtractFile(entry, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, entry.FilenameInZip)); progressBar1.Value += (int)entry.CompressedSize; label1.Text = String.Format("Extracting: {0}", entry.FilenameInZip); } CleanUp(); }