当前位置: 首页>>代码示例>>C#>>正文


C# Squirrel.UpdateManager类代码示例

本文整理汇总了C#中Squirrel.UpdateManager的典型用法代码示例。如果您正苦于以下问题:C# UpdateManager类的具体用法?C# UpdateManager怎么用?C# UpdateManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UpdateManager类属于Squirrel命名空间,在下文中一共展示了UpdateManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        private static async void Update(Task<string> result)
        {
            if (result.Result == null || result.Result != "1")
                return;

            try
            {
                using (var mgr = new UpdateManager(@"https://releases.noelpush.com/", "NoelPush"))
                {
                    var updates = await mgr.CheckForUpdate();

                    if (updates.ReleasesToApply.Any())
                    {
                        var lastVersion = updates.ReleasesToApply.OrderBy(x => x.Version).Last();

                        await mgr.DownloadReleases(updates.ReleasesToApply);
                        await mgr.ApplyReleases(updates);

                        var latestExe = Path.Combine(mgr.RootAppDirectory, string.Concat("app-", lastVersion.Version), "NoelPush.exe");
                        mgr.Dispose();

                        RestartAppEvent();
                        UpdateManager.RestartApp(latestExe);
                    }
                    mgr.Dispose();
                }
            }
            catch (Exception e)
            {
                LogManager.GetCurrentClassLogger().Error(e.Message);
            }
        }
开发者ID:noelpush,项目名称:noelpush,代码行数:32,代码来源:UpdatesService.cs

示例2: CheckForAppUpdates

 private async void CheckForAppUpdates()
 {
     using (var updateManager = new UpdateManager(APP_UPDATE_URL, APPLICATION_ID, FrameworkVersion.Net45))
     {
         await updateManager.UpdateApp();
     }
 }
开发者ID:ababhamdi,项目名称:FastCapt,代码行数:7,代码来源:UpdateService.cs

示例3: UpgradeRunsSquirrelAwareAppsWithUpgradeFlag

        public async Task UpgradeRunsSquirrelAwareAppsWithUpgradeFlag()
        {
            string tempDir;
            string remotePkgDir;

            using (Utility.WithTempDirectory(out tempDir))
            using (Utility.WithTempDirectory(out remotePkgDir)) {
                IntegrationTestHelper.CreateFakeInstalledApp("0.1.0", remotePkgDir);
                var pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
                ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));

                using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
                    await fixture.FullInstall(false, new ProgressSource());
                }

                await Task.Delay(1000);

                IntegrationTestHelper.CreateFakeInstalledApp("0.2.0", remotePkgDir);
                pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
                ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));

                using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
                    await fixture.UpdateApp();
                }

                await Task.Delay(1000);

                Assert.False(File.Exists(Path.Combine(tempDir, "theApp", "app-0.2.0", "args2.txt")));
                Assert.True(File.Exists(Path.Combine(tempDir, "theApp", "app-0.2.0", "args.txt")));

                var text = File.ReadAllText(Path.Combine(tempDir, "theApp", "app-0.2.0", "args.txt"), Encoding.UTF8);
                Assert.Contains("updated|0.2.0", text);
            }
        }
开发者ID:fusetools,项目名称:Squirrel.Windows,代码行数:34,代码来源:ApplyReleasesTests.cs

示例4: ScheduleApplicationUpdates

        private async void ScheduleApplicationUpdates(Object o)
        {
            var location = UpdateHelper.AppUpdateCheckLocation;
            var appName = Assembly.GetExecutingAssembly().GetName().Name;
            using (var mgr = new UpdateManager(location, appName, FrameworkVersion.Net45))
            {
                try
                {
                    UpdateInfo updateInfo = await mgr.CheckForUpdate();
                    if (updateInfo.FutureReleaseEntry != null)
                    {
                        if (updateInfo.CurrentlyInstalledVersion.Version == updateInfo.FutureReleaseEntry.Version) return;
                        await mgr.UpdateApp();

                        // This will show a button that will let the user restart the app
                        Dispatcher.Invoke(ShowUpdateIsAvailable);

                        // This will restart the app automatically
                        //Dispatcher.InvokeAsync<Task>(ShutdownApp);
                    }
                }
                catch (Exception ex)
                {
                    var a = ex;
                }
            }
        }
开发者ID:amazzanti,项目名称:Resquirrelly,代码行数:27,代码来源:MainWindow.xaml.cs

示例5: ProcessStaging

 public async void ProcessStaging()
 {
     using (var mgr = new UpdateManager("https://path/to/my/update/folder"))
     {
         await mgr.UpdateApp();
     }
 }
开发者ID:faint32,项目名称:snowflake-1,代码行数:7,代码来源:StagingUpdater.cs

示例6: SquirrellUpdate

 async static void SquirrellUpdate()
 {
     using (var mgr = new UpdateManager(@"C:\DHT\TsunamiLocal\GUI_WPF\bin\x64"))
     {
         await mgr.UpdateApp();
     }
 }
开发者ID:ChristianSacramento,项目名称:Tsunami,代码行数:7,代码来源:MainWindow.xaml.cs

示例7: App_OnStartup

 private void App_OnStartup(object sender, StartupEventArgs e)
 {
     if (e.Args.Length > 0)
     {
         using (var mgr = new UpdateManager("http://zizit.lt"))
         {
             // Note, in most of these scenarios, the app exits after this method
             // completes!
             SquirrelAwareApp.HandleEvents(
                 onInitialInstall: v =>
                 {
                     mgr.CreateShortcutForThisExe();
                     Shutdown();
                 },
                 onAppUpdate: v =>
                 {
                     mgr.CreateShortcutForThisExe();
                     Shutdown();
                 },
                 onAppUninstall: v =>
                 {
                     mgr.RemoveShortcutForThisExe();
                     Shutdown();
                 },
                 onFirstRun: () =>
                 {
                     MessageBox.Show("Success", "Installation successful", MessageBoxButton.OK);
                     Shutdown();
                 });
         }
     }
 }
开发者ID:Rayvid,项目名称:Zizit.Sigils,代码行数:32,代码来源:App.xaml.cs

示例8: Update

        private static async Task Update()
        {
            try
            {
                using (var mgr = new UpdateManager("http://lunyx.net/CasualMeter"))
                {
                    Logger.Info("Checking for updates.");
                    if (mgr.IsInstalledApp)
                    {
                        Logger.Info($"Current Version: v{mgr.CurrentlyInstalledVersion()}");
                        var updates = await mgr.CheckForUpdate();
                        if (updates.ReleasesToApply.Any())
                        {
                            Logger.Info("Updates found. Applying updates.");
                            var release = await mgr.UpdateApp();

                            MessageBox.Show(CleanReleaseNotes(release.GetReleaseNotes(Path.Combine(mgr.RootAppDirectory, "packages"))),
                                $"Casual Meter Update - v{release.Version}");

                            Logger.Info("Updates applied. Restarting app.");
                            UpdateManager.RestartApp();
                        }
                    }
                }
            }
            catch (Exception e)
            {   //log exception and move on
                HandleException(e);
            }
        }
开发者ID:DzenDyn,项目名称:CasualMeter,代码行数:30,代码来源:App.xaml.cs

示例9: App

 public App()
 {
     InitializeComponent();
     AppearanceManager.Current.ThemeSource = AppearanceManager.DarkThemeSource;
     Task.Factory.StartNew(async () =>
     {
         AboutViewModel.Instance.State = "Updater process started";
         await Task.Delay(TimeSpan.FromSeconds(1));
         while (true)
         {
             try
             {
                 AboutViewModel.Instance.State = "Ready for the first check...";
                 using (var updateManager = new UpdateManager(Releases))
                 {
                     AboutViewModel.Instance.State = "Updating...";
                     await updateManager.UpdateApp();
                     AboutViewModel.Instance.State = "Updated!";
                 }
             }
             catch (Exception x)
             {
                 AboutViewModel.Instance.State = x.Message;
                 return;
             }
             await Task.Delay(TimeSpan.FromHours(1));
         }
     });
 }
开发者ID:marhoily,项目名称:Approve.exe,代码行数:29,代码来源:App.xaml.cs

示例10: CheckAndUpdate

        /// <summary>
        /// Squirrel check and update.
        /// </summary>
        private async Task CheckAndUpdate(bool checkOnly = false)
        {
            // 6/27/15 - Task.Wait always times out. Seems to be an issue with the return of Squirrel's async methods.
            try
            {
                AddMessage("Start of CheckAndUpdate");
                using (var updateManager = new UpdateManager(Program.PackageUrl, Program.PackageId))
                {
                    // Check
                    AddMessage(String.Format("UpdateManager: {0}", JsonConvert.SerializeObject(updateManager, Formatting.Indented)));
                    AddMessage("Calling UpdateManager.CheckForUpdate");
                    var updateInfo = await updateManager.CheckForUpdate();
                    AddMessage(String.Format(
                                        "UpdateManager.CheckForUpdate returned UpdateInfo: {0}", 
                                        JsonConvert.SerializeObject(updateInfo, Formatting.Indented)));
                    if (checkOnly) { return; }

                    // Update
                    if (updateInfo.ReleasesToApply.Count > 0)
                    {
                        AddMessage("Calling UpdateManager.UpdateApp");
                        var releaseEntry = await updateManager.UpdateApp();
                        AddMessage(String.Format(
                                            "UpdateManager.UpdateApp returned ReleaseEntry: {0}",
                                            JsonConvert.SerializeObject(releaseEntry, Formatting.Indented)));
                    }
                    else { AddMessage("No updates to apply"); }
                }
            }
            catch (Exception exception) 
            { 
                Log.Error("Exception in CheckAndUpdate", exception);
                throw;
            }
        }
开发者ID:DaneVinson,项目名称:Nuts,代码行数:38,代码来源:MainForm.cs

示例11: InitialInstallSmokeTest

            public async Task InitialInstallSmokeTest()
            {
                string tempDir;
                using (Utility.WithTempDirectory(out tempDir)) {
                    var remotePackageDir = Directory.CreateDirectory(Path.Combine(tempDir, "remotePackages"));
                    var localAppDir = Path.Combine(tempDir, "theApp");

                    new[] {
                        "Squirrel.Core.1.0.0.0-full.nupkg",
                    }.ForEach(x => File.Copy(IntegrationTestHelper.GetPath("fixtures", x), Path.Combine(remotePackageDir.FullName, x)));

                    using (var fixture = new UpdateManager(remotePackageDir.FullName, "theApp", FrameworkVersion.Net45, tempDir)) {
                        await fixture.FullInstall();
                    }

                    var releasePath = Path.Combine(localAppDir, "packages", "RELEASES");
                    File.Exists(releasePath).ShouldBeTrue();

                    var entries = ReleaseEntry.ParseReleaseFile(File.ReadAllText(releasePath, Encoding.UTF8));
                    entries.Count().ShouldEqual(1);

                    new[] {
                        "ReactiveUI.dll",
                        "NSync.Core.dll",
                    }.ForEach(x => File.Exists(Path.Combine(localAppDir, "app-1.0.0.0", x)).ShouldBeTrue());
                }
            }
开发者ID:christianrondeau,项目名称:Squirrel.Windows.Next,代码行数:27,代码来源:UpdateManagerTests.cs

示例12: CallingMethodTwiceShouldUpdateInstaller

            public async Task CallingMethodTwiceShouldUpdateInstaller()
            {
                string remotePkgPath;
                string path;

                using (Utility.WithTempDirectory(out path)) {
                    using (Utility.WithTempDirectory(out remotePkgPath))
                    using (var mgr = new UpdateManager(remotePkgPath, "theApp", path)) {
                        IntegrationTestHelper.CreateFakeInstalledApp("1.0.0.1", remotePkgPath);
                        await mgr.FullInstall();
                    }

                    using (var mgr = new UpdateManager("http://lol", "theApp", path)) {
                        await mgr.CreateUninstallerRegistryEntry();
                        var regKey = await mgr.CreateUninstallerRegistryEntry();

                        Assert.False(String.IsNullOrWhiteSpace((string)regKey.GetValue("DisplayName")));

                        mgr.RemoveUninstallerRegistryEntry();
                    }

                    // NB: Squirrel-Aware first-run might still be running, slow
                    // our roll before blowing away the temp path
                    Thread.Sleep(1000);
                }

                var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
                    .OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall");

                using (key) {
                    Assert.False(key.GetSubKeyNames().Contains("theApp"));
                }
            }
开发者ID:RxSmart,项目名称:Squirrel.Windows,代码行数:33,代码来源:UpdateManagerTests.cs

示例13: CleanInstallRunsSquirrelAwareAppsWithInstallFlag

        public async Task CleanInstallRunsSquirrelAwareAppsWithInstallFlag()
        {
            string tempDir;
            string remotePkgDir;

            using (Utility.WithTempDirectory(out tempDir))
            using (Utility.WithTempDirectory(out remotePkgDir)) {
                IntegrationTestHelper.CreateFakeInstalledApp("0.1.0", remotePkgDir);
                var pkgs = ReleaseEntry.BuildReleasesFile(remotePkgDir);
                ReleaseEntry.WriteReleaseFile(pkgs, Path.Combine(remotePkgDir, "RELEASES"));

                using (var fixture = new UpdateManager(remotePkgDir, "theApp", tempDir)) {
                    await fixture.FullInstall(false, new ProgressSource());

                    // NB: We execute the Squirrel-aware apps, so we need to give
                    // them a minute to settle or else the using statement will
                    // try to blow away a running process
                    await Task.Delay(1000);

                    Assert.False(File.Exists(Path.Combine(tempDir, "theApp", "app-0.1.0", "args2.txt")));
                    Assert.True(File.Exists(Path.Combine(tempDir, "theApp", "app-0.1.0", "args.txt")));

                    var text = File.ReadAllText(Path.Combine(tempDir, "theApp", "app-0.1.0", "args.txt"), Encoding.UTF8);
                    Assert.Contains("firstrun", text);
                }
            }
        }
开发者ID:fusetools,项目名称:Squirrel.Windows,代码行数:27,代码来源:ApplyReleasesTests.cs

示例14: ShellViewModel

        public ShellViewModel(
            EndpointsViewModel endpoints,
            MessageListViewModel messageList,
            MessageViewerViewModel messageViewer,
            HeadersViewModel headers)
        {
            Version = GetType().Assembly
                .GetCustomAttributes(false)
                .OfType<AssemblyInformationalVersionAttribute>()
                .First()
                .InformationalVersion;

            RefreshCommand = ServiceControl.Instance.IsValid.ToCommand(p => DoRefresh());

            Anchorables = new IContainerViewModel[] { endpoints, messageList };
            Documents = new IContainerViewModel[] { messageViewer, headers };

            Task.Run(async () =>
            {
                using (var mgr = new UpdateManager(@"https://s3.amazonaws.com/serviceinsight/"))
                {
                    await mgr.UpdateApp();
                }
            });
        }
开发者ID:distantcam,项目名称:ServiceInsight2,代码行数:25,代码来源:ShellViewModel.cs

示例15: App

        /// <summary>
        /// Initializes a new instance of the App class.
        /// </summary>
        static App()
        {
            Logger.Info(
                "Popcorn starting...");
            var watchStart = Stopwatch.StartNew();

            AppDomain.CurrentDomain.ProcessExit += (sender, args) => UpdateManager.Dispose();

            Directory.CreateDirectory(Helpers.Constants.Logging);

            DispatcherHelper.Initialize();

            LocalizeDictionary.Instance.SetCurrentThreadCulture = true;

            UpdateManager = new UpdateManager(Helpers.Constants.UpdateServerUrl, Helpers.Constants.ApplicationName);

            watchStart.Stop();
            var elapsedStartMs = watchStart.ElapsedMilliseconds;
            Logger.Info(
                $"Popcorn started in {elapsedStartMs} milliseconds.");

            Task.Run(async () =>
            {
                await StartUpdateProcessAsync();
            });
        }
开发者ID:MozzieMD,项目名称:Popcorn,代码行数:29,代码来源:App.xaml.cs


注:本文中的Squirrel.UpdateManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。