• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Squirrel.UpdateManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnAppUninstall

        /// <summary>
        /// Execute when app is uninstalling
        /// </summary>
        /// <param name="version"><see cref="Version"/> version</param>
        private static void OnAppUninstall(Version version)
        {
            using (var manager = new UpdateManager(Constants.UpdateServerUrl))
            {
                manager.RemoveShortcutsForExecutable("Popcorn.exe", ShortcutLocation.Desktop);
                manager.RemoveShortcutsForExecutable("Popcorn.exe", ShortcutLocation.StartMenu);
                manager.RemoveShortcutsForExecutable("Popcorn.exe", ShortcutLocation.AppRoot);

                manager.RemoveUninstallerRegistryEntry();
            }
        }
开发者ID:bbougot,项目名称:Popcorn,代码行数:15,代码来源:App.xaml.cs


示例17: CheckForUpdates

        private async void CheckForUpdates()
        {
            using (var mgr = new UpdateManager("http://arkmanager.teamitf.co.uk/iNGen/Releases/", "iNGen"))
            {
                SquirrelAwareApp.HandleEvents(
                    onInitialInstall: v => mgr.CreateShortcutForThisExe(),
                    onAppUpdate: v => mgr.CreateShortcutForThisExe(),
                    onAppUninstall: v => mgr.RemoveShortcutForThisExe());

                try
                {
                    UpdateInfo updateInfo = await mgr.CheckForUpdate();
                    if (updateInfo.FutureReleaseEntry != null)
                    {
                        if (updateInfo.CurrentlyInstalledVersion != null)
                        {
                            XElement xelement = XElement.Load("http://arkmanager.teamitf.co.uk/iNGen/version.xml");
                            StringReader reader = new StringReader(xelement.ToString());
                            System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(Models.AppUpdates));
                            Models.AppUpdates appUpdates = (Models.AppUpdates)xmlSerializer.Deserialize(reader);
                            string changes = MakeChangeLog(appUpdates);
                            if (updateInfo.CurrentlyInstalledVersion.Version == updateInfo.FutureReleaseEntry.Version) return;
                            var updateDialog = new Views.AppUpdate(updateInfo, changes) { Owner = this };
                            var result = updateDialog.ShowDialog();
                            if (result == false) return;
                            await mgr.UpdateApp();
                            var oldPath = System.IO.Path.Combine(mgr.RootAppDirectory, "app-" + updateInfo.CurrentlyInstalledVersion.Version.ToString(), "UserData");
                            var newPath = System.IO.Path.Combine(mgr.RootAppDirectory, "app-" + updateInfo.FutureReleaseEntry.Version.ToString(), "UserData");
                            DirectoryInfo d = new DirectoryInfo(oldPath);
                            var files = d.GetFiles();
                            foreach (var file in files)
                            {
                                file.CopyTo(System.IO.Path.Combine(newPath, file.Name), true);
                            }

                            MessageBox.Show("iNGen Has been Updated. Please Re-Launch It.");
                            Application.Current.Shutdown(0);
                        }
                        else
                        {
                            await mgr.UpdateApp();
                            MessageBox.Show("iNGen Has been Updated. Please Re-Launch It.");
                            Application.Current.Shutdown(0);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Checking for Updates Failed: " + ex.Message);
                }
            }
        }
开发者ID:prom3theu5,项目名称:iNGEN-Ark-RCON-Desktop,代码行数:52,代码来源:MainWindow.xaml.cs


示例18: RegisterSquirrelEvents

 private void RegisterSquirrelEvents()
 {
     var location = UpdateHelper.AppUpdateCheckLocation;
     var appName = Assembly.GetExecutingAssembly().GetName().Name;
     using (var mgr = new UpdateManager(location, appName, FrameworkVersion.Net45))
     {
         SquirrelAwareApp.HandleEvents(
             onInitialInstall: v => mgr.CreateShortcutForThisExe(),
             onAppUpdate: v => mgr.CreateShortcutForThisExe(),
             onAppUninstall: v => mgr.RemoveShortcutForThisExe()
         );
     }
 }
开发者ID:amazzanti,项目名称:Resquirrelly,代码行数:13,代码来源:App.xaml.cs


示例19: Main

        static void Main()
        {
            try {
                using (var mgr = new UpdateManager("https://s3.amazonaws.com/steamdesktopauthenticator/releases"))
                {
                    // Note, in most of these scenarios, the app exits after this method
                    // completes!
                    SquirrelAwareApp.HandleEvents(
                      onInitialInstall: v => mgr.CreateShortcutForThisExe(),
                      onAppUpdate: v => mgr.CreateShortcutForThisExe(),
                      onAppUninstall: v => mgr.RemoveShortcutForThisExe(),
                      onFirstRun: () => ShowTheWelcomeWizard = true);
                }
            }
            catch
            {
                // Not using a squirrel app
            }

            // run the program only once
            if (PriorProcess() != null)
            {
                MessageBox.Show("Another instance of the app is already running.");
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Manifest man = Manifest.GetManifest();
            if(man.FirstRun)
            {
                // Install VC++ Redist and wait
                new InstallRedistribForm().ShowDialog();

                if (man.Entries.Count > 0)
                {
                    // Already has accounts, just run
                    Application.Run(new MainForm());
                }
                else
                {
                    // No accounts, run welcome form
                    Application.Run(new WelcomeForm());
                }
            }
            else
            {
                Application.Run(new MainForm());
            }
        }
开发者ID:Dabann,项目名称:SteamDesktopAuthenticator,代码行数:51,代码来源:Program.cs


示例20: toolStripButtonCheckForUpdates_Click

        private async void toolStripButtonCheckForUpdates_Click(object sender, EventArgs e)
        {
            // NB: For this version, always say your app is using .NET 4.5, even if it's
            // totally not
            using (var mgr = new UpdateManager(textBoxPathForUpdate.Text))
            {
               var release = await mgr.UpdateApp();

               if (release != null)
               {
                   MessageBox.Show("New App Version Installed " + release.Version + " \n Close and reopen to load new version.");
               }
            }
        }
开发者ID:maurocavallin,项目名称:WinFormsSquirrelExample,代码行数:14,代码来源:MainForm.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Helpers.JavaScriptBundleFactory类代码示例发布时间:2022-05-26
下一篇:
C# Data.ItemInfo类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap