Example #1
0
        static void SilentInstall()
        {
            Stream data;

            if (Environment.Is64BitOperatingSystem)
            {
                data = ZenithUpdates.DownloadAssetData(ZenithUpdates.DataAssetName64);
            }
            else
            {
                data = ZenithUpdates.DownloadAssetData(ZenithUpdates.DataAssetName32);
            }
            ZenithUpdates.InstallFromStream(data);
            data.Close();
            FinalizeInstall();
        }
Example #2
0
        static void UpdateFromPackage(string path)
        {
            if (!File.Exists(path))
            {
                if (!Silent)
                {
                    MessageBox.Show("Could not install update, update package file missing", "Update failed");
                }
                return;
            }
            var f = File.OpenRead(path);

            ZenithUpdates.KillAllProcesses();
            ZenithUpdates.InstallFromStream(f);
            f.Close();
            File.Delete(path);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Task.Run(() =>
            {
#if !DEBUG
                try
                {
#endif
                Stream data;
                if (Environment.Is64BitOperatingSystem)
                {
                    data = ZenithUpdates.DownloadAssetDataProgressive(ZenithUpdates.DataAssetName64, ProgressCallbac);
                }
                else
                {
                    data = ZenithUpdates.DownloadAssetDataProgressive(ZenithUpdates.DataAssetName32, ProgressCallbac);
                }
                Dispatcher.Invoke(() =>
                {
                    dlProgress.Visibility = Visibility.Collapsed;
                });
                Dispatcher.Invoke(() => progressText.Content = "Installing...");
                ZenithUpdates.InstallFromStream(data);
                data.Close();
                Program.FinalizeInstall();
                Dispatcher.Invoke(() => Close());
#if !DEBUG
            }
                     catch (Exception ex)
            {
                exception = ex;
                Dispatcher.Invoke(() => Close());
            }
#endif
            });
        }