コード例 #1
0
        static async Task Main(string[] args)
        {
            if (IsAlreadyRunning())
            {
                Environment.Exit(0);
            }

            Console.Title = string.Format("Scraps - {0}", Common.Constants.Version.Full);

            Console.WriteLine();
            Console.WriteLine("Scraps - Scrap.TF Raffle Bot");
            Console.WriteLine("By depthbomb - https://s.team/p/fwc-crhc");
            Console.WriteLine("Changelog available at https://github.com/depthbomb/Scraps/blob/master/CHANGELOG.md");
            Console.WriteLine();

            EnsureFileSystem();

            ParseArguments(args);

            InitializeLogger();
            InitializeSettings();
            InitializeHttpClient();

            CheckForAnnouncement();

            using (var us = new UpdateService())
            {
                await us.CheckForUpdates();
            }

            Console.CursorVisible = false;

            var bot = new Bot(_config, _http);
            await bot.RunAsync();
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: xyx0826/Priceall
        /// <summary>
        /// Binds data contexts ASAP to prevent flickering.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            SettingsService.Upgrade();

            // Network tasks
            Task.Run(async() => { await FlagService.CheckAllFlags(); });
            Task.Run(async() => { await UpdateService.CheckForUpdates(); });

            // Bind data contexts
            DataContext = _styleBinding;
            AppraisalInfo.DataContext     = _infoBinding;
            AppraisalControls.DataContext = _controlsBinding;
        }
コード例 #3
0
        public async Task TestCheckForUpdatesNoUpdateLink()
        {
            applicationVersion.VersionKnown.Returns(true);
            data.HasUpdateServerData.Returns(true);
            updateClient
            .CheckForUpdates(Arg.Any <string>(), Arg.Any <long>())
            .Returns(new CheckVersionResponse()
            {
                DownloadUrl = null, LatestVersion = 2
            });

            var updateService = new UpdateService(data, clientFactory, applicationVersion, application, fileSystem,
                                                  standaloneUpdate, settings, platformService);

            Assert.IsNull(await updateService.CheckForUpdates());
        }
コード例 #4
0
        public async Task TestCheckForUpdatesHasUpdate()
        {
            applicationVersion.VersionKnown.Returns(true);
            data.HasUpdateServerData.Returns(true);
            updateClient
            .CheckForUpdates(Arg.Any <string>(), Arg.Any <long>())
            .Returns(new CheckVersionResponse()
            {
                DownloadUrl = "localhost", LatestVersion = 2
            });

            var updateService = new UpdateService(data, clientFactory, applicationVersion, application, fileSystem,
                                                  standaloneUpdate, settings, platformService, updateVerifier);

            Assert.AreEqual("localhost", await updateService.CheckForUpdates());
        }
コード例 #5
0
ファイル: MainViewModel.cs プロジェクト: xiaohszx/Hurricane
        public void Loaded(MainWindow window)
        {
            _baseWindow = window;
            MySettings  = HurricaneSettings.Instance;

            MusicManager = new MusicManager();
            MusicManager.CSCoreEngine.TrackChanged      += CSCoreEngine_TrackChanged;
            MusicManager.CSCoreEngine.ExceptionOccurred += CSCoreEngine_ExceptionOccurred;
            MusicManager.LoadFromSettings();
            MainTabControlIndex = MySettings.CurrentState.MainTabControlIndex;
            TrackSearcher       = new TrackSearcher(MusicManager, window);

            _keyboardListener          = new KeyboardListener();
            _keyboardListener.KeyDown += KListener_KeyDown;
            Updater = new UpdateService(MySettings.Config.Language == "de" ? UpdateService.Language.German : UpdateService.Language.English);
            Updater.CheckForUpdates(_baseWindow);
        }
コード例 #6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            var mainWindow = new MainWindow();
            var viewModel  = (MainWindowViewModel)mainWindow.DataContext;

            var assembly = Assembly.GetExecutingAssembly();

            UpdateService.CheckForUpdates(assembly, (version, downloadUrl) =>
            {
                var content = $"{version} is Now Available!";
                void Action() => Process.Start(new ProcessStartInfo(downloadUrl)
                {
                    UseShellExecute = true
                });
                viewModel.MessageQueue.Enqueue(content, "Download", Action);
            });

            mainWindow.Show();
        }
コード例 #7
0
        public MainViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                return;
            }

            Log = Logger.Entries;
            Application.Current.MainWindow.Closing += MainWindow_Closing;

            Settings = Settings.Current;

            _updateService              = new UpdateService();
            _updateService.UpdateFound += UpdateService_UpdateFound;
            _updateService.CheckForUpdates();

            IsConsoleAtTop = Settings.IsConsoleAtTop;
            Settings.ConsolePositionChanged += Settings_ConsolePositionChanged;

            LoadStaticCommandPlugins();
        }
コード例 #8
0
 protected void OnButtonUpdateNowClicked(object sender, System.EventArgs e)
 {
     Store();
     UpdateService.CheckForUpdates();
 }
コード例 #9
0
ファイル: UpdateManager.asmx.cs プロジェクト: klimkina/CSharp
 public List <Guid> CheckForUpdates(string version, Guid applicationId)
 {
     return(UpdateService.CheckForUpdates(version, applicationId));
 }