public MenuViewController(ShadowsocksController controller) { LoadMenu(); LoadTrayIcon(); this.controller = controller; controller.EnableStatusChanged += controller_EnableStatusChanged; controller.ConfigChanged += controller_ConfigChanged; controller.PACFileReadyToOpen += controller_PACFileReadyToOpen; controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged; controller.EnableGlobalChanged += controller_EnableGlobalChanged; controller.Errored += controller_Errored; this.updateChecker = new UpdateChecker(); updateChecker.NewVersionFound += updateChecker_NewVersionFound; LoadCurrentConfiguration(); updateChecker.CheckUpdate(); if (controller.GetConfiguration().isDefault) { _isFirstRun = true; ShowConfigForm(); } }
public MenuViewController(ShadowsocksController controller) { this.controller = controller; LoadMenu(); controller.EnableStatusChanged += controller_EnableStatusChanged; controller.ConfigChanged += controller_ConfigChanged; controller.PACFileReadyToOpen += controller_FileReadyToOpen; controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen; controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged; controller.EnableGlobalChanged += controller_EnableGlobalChanged; controller.Errored += controller_Errored; controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted; controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError; _notifyIcon = new NotifyIcon(); UpdateTrayIcon(); _notifyIcon.Visible = true; _notifyIcon.ContextMenu = contextMenu1; _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick; this.updateChecker = new UpdateChecker(); updateChecker.NewVersionFound += updateChecker_NewVersionFound; LoadCurrentConfiguration(); updateChecker.CheckUpdate(controller.GetConfigurationCopy()); if (controller.GetConfigurationCopy().isDefault) { _isFirstRun = true; ShowConfigForm(); } }
public UpdateCheckerNewVersionForm(UpdateChecker.Version version, UpdateCheckerSettings settings) { InitializeComponent(); m_settings = settings; Text += ": " + version; changelogBox.Text = version.Changelog; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); #if(!DEBUG) AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException; #else AppDomain.CurrentDomain.FirstChanceException += this.CurrentDomainFirstChanceException; #endif //Program.GamesRepository = new GamesRepository(); if (Program.GamesRepository.MissingFiles.Any()) { var sb = new StringBuilder( "Octgn cannot find the following files. The corresponding games have been disabled.\n\n"); foreach (string file in Program.GamesRepository.MissingFiles) sb.Append(file).Append("\n\n"); sb.Append("You should restore those files, or re-install the corresponding games."); ShutdownMode oldShutdown = ShutdownMode; ShutdownMode = ShutdownMode.OnExplicitShutdown; new Windows.MessageWindow(sb.ToString()).ShowDialog(); ShutdownMode = oldShutdown; } //#if(DEBUG) // Program.LauncherWindow.Show(); // Program.ChatWindows = new List<ChatWindow>(); //#else var uc = new UpdateChecker(); uc.ShowDialog(); if (!uc.IsClosingDown) { if (Program.UseNewChrome) Program.MainWindowNew.Show(); else { Program.LauncherWindow.Show(); Program.ChatWindows = new List<ChatWindow>(); } } else { if (Program.UseNewChrome) Program.MainWindowNew.Close(); else { Program.LauncherWindow.Close(); } Current.MainWindow = null; Program.Exit(); } //#endif if (e.Args.Any()) { Properties["ArbitraryArgName"] = e.Args[0]; } }
public AboutForm() { InitializeComponent(); Text = Program.Title; lblProductName.Text = Program.Title; lblCopyright.Text = AssemblyCopyright; UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Program.AssemblyVersion), ReleaseChannelType.Stable, Uploader.ProxySettings.GetWebProxy); uclUpdate.CheckUpdate(updateChecker); }
public AboutForm() { InitializeComponent(); Text = Program.FullTitle; Icon = Resources.ShareXIcon; lblProductName.Text = Program.FullTitle; lblCopyright.Text = Program.AssemblyCopyright; UpdateChecker updateChecker = new UpdateChecker(Links.URL_UPDATE, Application.ProductName, Program.AssemblyVersion, ReleaseChannelType.Stable, Uploader.ProxyInfo.GetWebProxy()); uclUpdate.CheckUpdate(updateChecker); }
public void CheckUpdate(UpdateChecker updateChecker) { this.updateChecker = updateChecker; if (!isBusy) { isBusy = true; lblStatus.Visible = false; llblUpdateAvailable.Visible = false; pbLoading.Visible = true; lblCheckingUpdates.Visible = true; new Thread(CheckingUpdate).Start(); } }
public MenuViewController(ShadowsocksController controller) { this.controller = controller; LoadMenu(); controller.EnableStatusChanged += controller_EnableStatusChanged; controller.ConfigChanged += controller_ConfigChanged; controller.PACFileReadyToOpen += controller_FileReadyToOpen; controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen; controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged; controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged; controller.EnableGlobalChanged += controller_EnableGlobalChanged; controller.Errored += controller_Errored; controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted; controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError; _notifyIcon = new NotifyIcon(); UpdateTrayIcon(); _notifyIcon.Visible = true; _notifyIcon.ContextMenu = contextMenu1; _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked; _notifyIcon.MouseClick += notifyIcon1_Click; _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick; _notifyIcon.BalloonTipClosed += _notifyIcon_BalloonTipClosed; controller.TrafficChanged += controller_TrafficChanged; this.updateChecker = new UpdateChecker(); updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted; LoadCurrentConfiguration(); Configuration config = controller.GetConfigurationCopy(); if (config.isDefault) { _isFirstRun = true; ShowConfigForm(); } else if(config.autoCheckUpdate) { _isStartupChecking = true; updateChecker.CheckUpdate(config, 3000); } }
public ConfigForm(ShadowsocksController controller, UpdateChecker updateChecker) { this.Font = System.Drawing.SystemFonts.MessageBoxFont; InitializeComponent(); // a dirty hack //this.ServersListBox.Dock = System.Windows.Forms.DockStyle.Fill; //this.PerformLayout(); this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); this.controller = controller; this.updateChecker = updateChecker; if (updateChecker.LatestVersionURL == null) LinkUpdate.Visible = false; UpdateTexts(); controller.ConfigChanged += controller_ConfigChanged; LoadCurrentConfiguration(); }
public void UpdateChecker_CheckForUpdate_Test() { var checker = new UpdateChecker(); ApplicationUpdate update = checker.CheckForUpdate("uniqueId", Path.Combine(Environment.CurrentDirectory, "ApplicationUpdate.xml")); Assert.AreEqual("0.4.10.156", update.Version); Assert.AreEqual(new DateTime(2010, 3, 18), update.UpdateDate); Assert.AreEqual(2, update.UpdateFiles.Count); Assert.AreEqual("Windows Installer", update.UpdateFiles[0].Description); Assert.AreEqual("http://hfm-net.googlecode.com/files/HFM Release 0.4.10.156.msi", update.UpdateFiles[0].HttpAddress); Assert.AreEqual(1569792, update.UpdateFiles[0].Size); Assert.AreEqual("30847cc654974d969f8f5a3f2423040d", update.UpdateFiles[0].MD5); Assert.AreEqual("b38dd073546647dcf37d89d62cb63823934c8fce", update.UpdateFiles[0].SHA1); Assert.AreEqual(0, update.UpdateFiles[0].UpdateType); Assert.AreEqual("Zip Archive", update.UpdateFiles[1].Description); Assert.AreEqual("http://hfm-net.googlecode.com/files/HFM Release 0.4.10.156.zip", update.UpdateFiles[1].HttpAddress); Assert.AreEqual(584621, update.UpdateFiles[1].Size); Assert.AreEqual("d1ea4151b2165c6a7ef3ec519b479464", update.UpdateFiles[1].MD5); Assert.AreEqual("4103946141f90105510827a0baf13cb38cb00256", update.UpdateFiles[1].SHA1); Assert.AreEqual(1, update.UpdateFiles[1].UpdateType); }
public MenuViewController(ShadowsocksController controller) { this.controller = controller; LoadMenu(); controller.EnableStatusChanged += controller_EnableStatusChanged; controller.ConfigChanged += controller_ConfigChanged; controller.PACFileReadyToOpen += controller_FileReadyToOpen; controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen; controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged; controller.SelectRandomStatusChanged += controller_SelectRandomStatusChanged; controller.EnableGlobalChanged += controller_EnableGlobalChanged; controller.Errored += controller_Errored; controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted; controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError; controller.ShowConfigFormEvent += Config_Click; _notifyIcon = new NotifyIcon(); UpdateTrayIcon(); _notifyIcon.Visible = true; _notifyIcon.ContextMenu = contextMenu1; _notifyIcon.MouseClick += notifyIcon1_Click; _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick; this.updateChecker = new UpdateChecker(); updateChecker.NewVersionFound += updateChecker_NewVersionFound; LoadCurrentConfiguration(); if (controller.GetConfiguration().isDefault) { _isFirstRun = true; ShowConfigForm(); } //timerDelayCheckUpdate = new System.Timers.Timer(1000 * 10.0); //timerDelayCheckUpdate.Elapsed += timer_Elapsed; //timerDelayCheckUpdate.Start(); }
public UpdatePresenterTests() { var checker = new UpdateChecker(); _update = checker.CheckForUpdate("uniqueId", Path.Combine(Environment.CurrentDirectory, "ApplicationUpdateLocal.xml")); }
public void CheckThatVersionBiggerComparesCorrectly(string currentVersion, string newVersion, bool expectedValue) { Assert.True(UpdateChecker.VersionBigger(currentVersion, newVersion) == expectedValue); }
public AboutForm() { InitializeComponent(); Icon = ShareXResources.Icon; lblProductName.Text = Program.Title; pbLogo.Image = ShareXResources.Logo; rtbShareXInfo.AddContextMenu(); rtbCredits.AddContextMenu(); #if STEAM || WindowsStore uclUpdate.Visible = false; lblBuild.Visible = true; if (Program.Build == ShareXBuild.Steam) { lblBuild.Text = "Steam build"; } else if (Program.Build == ShareXBuild.MicrosoftStore) { lblBuild.Text = "Microsoft Store build"; } #else if (!Program.PortableApps) { UpdateChecker updateChecker = Program.UpdateManager.CreateUpdateChecker(); uclUpdate.CheckUpdate(updateChecker); } else { uclUpdate.Visible = false; } #endif lblTeam.Text = "ShareX Team:"; lblBerk.Text = "Jaex (Berk)"; lblMike.Text = "McoreD (Michael Delpach)"; rtbShareXInfo.Text = $@"{Resources.AboutForm_AboutForm_Website}: {Links.URL_WEBSITE} {Resources.AboutForm_AboutForm_Project_page}: {Links.URL_PROJECT} {Resources.AboutForm_AboutForm_Changelog}: {Links.URL_CHANGELOG}"; rtbCredits.Text = $@"{Resources.AboutForm_AboutForm_Contributors}: https://github.com/ShareX/ShareX/graphs/contributors {Resources.AboutForm_AboutForm_Translators}: {Resources.AboutForm_AboutForm_Language_tr}: https://github.com/Jaex & https://github.com/muratmoon {Resources.AboutForm_AboutForm_Language_de}: https://github.com/Starbug2 & https://github.com/Kaeltis {Resources.AboutForm_AboutForm_Language_fr}: https://github.com/nwies & https://github.com/Shadorc {Resources.AboutForm_AboutForm_Language_zh_CH}: https://github.com/jiajiechan {Resources.AboutForm_AboutForm_Language_hu}: https://github.com/devBluestar {Resources.AboutForm_AboutForm_Language_ko_KR}: https://github.com/123jimin {Resources.AboutForm_AboutForm_Language_es}: https://github.com/ovnisoftware {Resources.AboutForm_AboutForm_Language_nl_NL}: https://github.com/canihavesomecoffee {Resources.AboutForm_AboutForm_Language_pt_BR}: https://github.com/RockyTV & https://github.com/athosbr99 {Resources.AboutForm_AboutForm_Language_vi_VN}: https://github.com/thanhpd {Resources.AboutForm_AboutForm_Language_ru}: https://github.com/L1Q {Resources.AboutForm_AboutForm_Language_zh_TW}: https://github.com/alantsai {Resources.AboutForm_AboutForm_Language_it_IT}: https://github.com/pjammo {Resources.AboutForm_AboutForm_Language_uk}: https://github.com/6c6c6 {Resources.AboutForm_AboutForm_Language_id_ID}: https://github.com/Nicedward {Resources.AboutForm_AboutForm_Language_es_MX}: https://github.com/absay {Resources.AboutForm_AboutForm_External_libraries}: Json.NET: https://github.com/JamesNK/Newtonsoft.Json SSH.NET: https://github.com/sshnet/SSH.NET Icons: http://p.yusukekamiyamane.com ImageListView: https://github.com/oozcitak/imagelistview FFmpeg: https://www.ffmpeg.org Zeranoe FFmpeg: https://ffmpeg.zeranoe.com/builds DirectShow video and audio device: https://github.com/rdp/screen-capture-recorder-to-video-windows-free FluentFTP: https://github.com/robinrodricks/FluentFTP Steamworks.NET: https://github.com/rlabrecque/Steamworks.NET OCR Space: https://ocr.space ZXing.Net: https://github.com/micjahn/ZXing.Net MegaApiClient: https://github.com/gpailler/MegaApiClient Blob Emoji: http://blobs.gg Copyright (c) 2007-2018 ShareX Team"; easterEggBounce = new EasterEggBounce(this); }
public UpdateNotificationViewModel(IMessenger messenger, UpdateChecker updateChecker) : base(messenger) { this.updateChecker = updateChecker; this.DownloadCommand = new RelayCommand(this.LaunchDownload); }
private static long Dispose = 0; // To detect redundant calls public static async Task DisposeAsync() { var compareRes = Interlocked.CompareExchange(ref Dispose, 1, 0); if (compareRes == 1) { while (Interlocked.Read(ref Dispose) != 2) { await Task.Delay(50); } return; } else if (compareRes == 2) { return; } try { await DisposeInWalletDependentServicesAsync(); if (UpdateChecker != null) { await UpdateChecker?.StopAsync(); Logger.LogInfo($"{nameof(UpdateChecker)} is stopped.", nameof(Global)); } if (Synchronizer != null) { await Synchronizer?.StopAsync(); Logger.LogInfo($"{nameof(Synchronizer)} is stopped.", nameof(Global)); } if (AddressManagerFilePath != null) { IoHelpers.EnsureContainingDirectoryExists(AddressManagerFilePath); if (AddressManager != null) { AddressManager?.SavePeerFile(AddressManagerFilePath, Config.Network); Logger.LogInfo($"{nameof(AddressManager)} is saved to `{AddressManagerFilePath}`.", nameof(Global)); } } if (Nodes != null) { Nodes?.Disconnect(); while (Nodes.ConnectedNodes.Any(x => x.IsConnected)) { await Task.Delay(50); } Nodes?.Dispose(); Logger.LogInfo($"{nameof(Nodes)} are disposed.", nameof(Global)); } if (RegTestMemPoolServingNode != null) { RegTestMemPoolServingNode.Disconnect(); Logger.LogInfo($"{nameof(RegTestMemPoolServingNode)} is disposed.", nameof(Global)); } if (TorManager != null) { await TorManager?.StopAsync(); Logger.LogInfo($"{nameof(TorManager)} is stopped.", nameof(Global)); } try { await AsyncMutex.WaitForAllMutexToCloseAsync(); Logger.LogInfo($"{nameof(AsyncMutex)}(es) are stopped.", nameof(Global)); } catch (Exception ex) { Logger.LogError($"Error during stopping {nameof(AsyncMutex)}: {ex}", nameof(Global)); } } catch (Exception ex) { Logger.LogWarning(ex, nameof(Global)); } finally { Interlocked.Exchange(ref Dispose, 2); } }
public void TestAutoUpdateChecker(string currentVersion, string newVersion, bool expectedResult) { var result = UpdateChecker.CheckForUpdate(currentVersion, newVersion); Assert.Equal(expectedResult, result); }
public async Task InitializeNoWalletAsync() { WalletService = null; ChaumianClient = null; AddressManager = null; TorManager = null; #region ConfigInitialization Config = new Config(Path.Combine(DataDir, "Config.json")); await Config.LoadOrCreateDefaultFileAsync(); Logger.LogInfo <Config>("Config is successfully initialized."); #endregion ConfigInitialization BitcoinStore = new BitcoinStore(); var bstoreInitTask = BitcoinStore.InitializeAsync(Path.Combine(DataDir, "BitcoinStore"), Network); var hwiInitTask = HwiProcessManager.InitializeAsync(DataDir, Network); var addressManagerFolderPath = Path.Combine(DataDir, "AddressManager"); AddressManagerFilePath = Path.Combine(addressManagerFolderPath, $"AddressManager{Network}.dat"); var addrManTask = InitializeAddressManagerBehaviorAsync(); var blocksFolderPath = Path.Combine(DataDir, $"Blocks{Network}"); var connectionParameters = new NodeConnectionParameters { UserAgent = "/Satoshi:0.18.0/" }; if (Config.UseTor.Value) { Synchronizer = new WasabiSynchronizer(Network, BitcoinStore, () => Config.GetCurrentBackendUri(), Config.TorSocks5EndPoint); } else { Synchronizer = new WasabiSynchronizer(Network, BitcoinStore, Config.GetFallbackBackendUri(), null); } UpdateChecker = new UpdateChecker(Synchronizer.WasabiClient); #region ProcessKillSubscription AppDomain.CurrentDomain.ProcessExit += async(s, e) => await TryDesperateDequeueAllCoinsAsync(); Console.CancelKeyPress += async(s, e) => { e.Cancel = true; Logger.LogWarning("Process was signaled for killing.", nameof(Global)); KillRequested = true; await TryDesperateDequeueAllCoinsAsync(); Dispatcher.UIThread.PostLogException(() => { Application.Current?.MainWindow?.Close(); }); await DisposeAsync(); Logger.LogInfo($"Wasabi stopped gracefully.", Logger.InstanceGuid.ToString()); }; #endregion ProcessKillSubscription #region TorProcessInitialization if (Config.UseTor.Value) { TorManager = new TorProcessManager(Config.TorSocks5EndPoint, TorLogsFile); } else { TorManager = TorProcessManager.Mock(); } TorManager.Start(false, DataDir); var fallbackRequestTestUri = new Uri(Config.GetFallbackBackendUri(), "/api/software/versions"); TorManager.StartMonitor(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(7), DataDir, fallbackRequestTestUri); Logger.LogInfo <TorProcessManager>($"{nameof(TorProcessManager)} is initialized."); #endregion TorProcessInitialization #region MempoolInitialization MempoolService = new MempoolService(); connectionParameters.TemplateBehaviors.Add(new MempoolBehavior(MempoolService)); #endregion MempoolInitialization #region HwiProcessInitialization try { await hwiInitTask; } catch (Exception ex) { Logger.LogError(ex, nameof(Global)); } #endregion HwiProcessInitialization #region BitcoinStoreInitialization await bstoreInitTask; #endregion BitcoinStoreInitialization #region AddressManagerInitialization AddressManagerBehavior addressManagerBehavior = await addrManTask; connectionParameters.TemplateBehaviors.Add(addressManagerBehavior); #endregion AddressManagerInitialization #region P2PInitialization if (Network == Network.RegTest) { Nodes = new NodesGroup(Network, requirements: Constants.NodeRequirements); try { Node node = await Node.ConnectAsync(Network.RegTest, new IPEndPoint(IPAddress.Loopback, 18444)); Nodes.ConnectedNodes.Add(node); RegTestMempoolServingNode = await Node.ConnectAsync(Network.RegTest, new IPEndPoint(IPAddress.Loopback, 18444)); RegTestMempoolServingNode.Behaviors.Add(new MempoolBehavior(MempoolService)); } catch (SocketException ex) { Logger.LogError(ex, nameof(Global)); } } else { if (Config.UseTor is true) { // onlyForOnionHosts: false - Connect to clearnet IPs through Tor, too. connectionParameters.TemplateBehaviors.Add(new SocksSettingsBehavior(Config.TorSocks5EndPoint, onlyForOnionHosts: false, networkCredential: null, streamIsolation: true)); // allowOnlyTorEndpoints: true - Connect only to onions and do not connect to clearnet IPs at all. // This of course makes the first setting unnecessary, but it's better if that's around, in case someone wants to tinker here. connectionParameters.EndpointConnector = new DefaultEndpointConnector(allowOnlyTorEndpoints: Network == Network.Main); await AddKnownBitcoinFullNodeAsHiddenServiceAsync(AddressManager); } Nodes = new NodesGroup(Network, connectionParameters, requirements: Constants.NodeRequirements); RegTestMempoolServingNode = null; } Nodes.Connect(); Logger.LogInfo("Start connecting to nodes..."); if (RegTestMempoolServingNode != null) { RegTestMempoolServingNode.VersionHandshake(); Logger.LogInfo("Start connecting to mempool serving regtest node..."); } #endregion P2PInitialization #region SynchronizerInitialization var requestInterval = TimeSpan.FromSeconds(30); if (Network == Network.RegTest) { requestInterval = TimeSpan.FromSeconds(5); } int maxFiltSyncCount = Network == Network.Main ? 1000 : 10000; // On testnet, filters are empty, so it's faster to query them together Synchronizer.Start(requestInterval, TimeSpan.FromMinutes(5), maxFiltSyncCount); Logger.LogInfo("Start synchronizing filters..."); #endregion SynchronizerInitialization Initialized = true; }
static void Main() { string runPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string configPath = $"{runPath}\\config_version.txt"; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (!File.Exists(configPath)) { MessageBox.Show("Config file not found", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string data = File.ReadAllText(configPath).Replace("\r", ""); var datas = data.Split('\n'); if (datas.Length < 3) { MessageBox.Show("Invalid config file", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string version = "0"; using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)) using (var key = hklm.OpenSubKey(datas[0])) { version = (string)key.GetValue("version"); if (version == null) { version = string.Empty; } } if (version == string.Empty) { if (Version.TryParse(version, out Version version_t2)) { version = version_t2.ToString(); } else { MessageBox.Show("Invalid config file, no valid version found", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } string url = datas[2]; bool silent = false; if (datas.Length >= 3) { if (datas[2] == "1") { silent = true; } } Console.WriteLine("Silent mode : " + silent); Console.WriteLine("Current version : " + version); UpdateChecker updateChecker = new UpdateChecker(url, version); var DownloadRequested = CheckUpdate(updateChecker, silent); if (DownloadRequested) { var task2 = Update(updateChecker, silent); int state = 0; while (!(task2.IsCompleted || task2.IsCanceled)) { Console.WriteLine("Downloading." + (state == 1 ? "." : state == 2 ? ".." : " ")); if (++state > 2) { state = 0; } Console.SetCursorPosition(0, Console.CursorTop - 1); Thread.Sleep(200); } } Console.WriteLine("Complete !"); }
public void StartPlugin( TabPage pluginScreenSpace, Label pluginStatusText) { this.isLoaded = false; // タイトルをセットする pluginScreenSpace.Text = "ULTRA SCOUTER"; EnvironmentMigrater.Migrate(); MasterFilePublisher.Publish(); WPFHelper.Start(); WPFHelper.BeginInvoke(async() => { AppLog.LoadConfiguration(AppLog.HojoringConfig); this.Logger?.Trace(Assembly.GetExecutingAssembly().GetName().ToString() + " start."); try { this.PluginTabPage = pluginScreenSpace; this.PluginStatusLabel = pluginStatusText; if (!EnvironmentHelper.IsValidPluginLoadOrder()) { pluginStatusText.Text = "Plugin Initialize Error"; return; } EnvironmentHelper.GarbageLogs(); EnvironmentHelper.StartActivator(() => { BaseView.Instance.SetActivationStatus(false); this.EndPlugin(); }); this.Logger.Trace("[ULTRA SCOUTER] Start InitPlugin"); // .NET FrameworkとOSのバージョンを確認する if (!UpdateChecker.IsAvailableDotNet() || !UpdateChecker.IsAvailableWindows()) { NotSupportedView.AddAndShow(pluginScreenSpace); return; } // 設定ファイルを読み込む Settings.Instance.Load(); Settings.Instance.MPTicker.UpdateUnlockMPSync(); // 設定ファイルをバックアップする await EnvironmentHelper.BackupFilesAsync( Settings.Instance.FileName); // HojoringのSplashを表示する WPFHelper.Start(); UpdateChecker.ShowSplash(); // 各種ファイルを読み込む await Task.Run(() => { TTSDictionary.Instance.Load(); Settings.Instance.MobList.LoadTargetMobList(); }); EnvironmentHelper.WaitInitActDone(); // FFXIVプラグインへのアクセスを開始する await Task.Run(() => { XIVPluginHelper.Instance.Start( Settings.Instance.PollingRate, Settings.Instance.FFXIVLocale); }); // ターゲット情報ワーカを開始する MainWorker.Instance.Start(); // タブページを登録する this.SetupPluginTabPages(pluginScreenSpace); // テキストコマンドの購読を追加する this.SubscribeTextCommands(); this.PluginStatusLabel.Text = "Plugin started."; this.Logger.Trace("[ULTRA SCOUTER] End InitPlugin"); // 共通ビューを追加する CommonViewHelper.Instance.AddCommonView( pluginScreenSpace.Parent as TabControl); this.isLoaded = true; // FFLogsの統計データベースをロードする StatisticsDatabase.Instance.Logger = Logger; await StatisticsDatabase.Instance.LoadAsync(); // アップデートを確認する await Task.Run(() => this.Update()); } catch (Exception ex) { this.Logger.Fatal(ex, "InitPlugin error."); this.ShowMessage("InitPlugin error.", ex); } }); }
public TabSettingsGeneral(Action reloadTweetDeck, Action reloadColumns, UpdateChecker updates) { InitializeComponent(); this.reloadTweetDeck = reloadTweetDeck; this.reloadColumns = reloadColumns; this.updates = updates; this.updates.CheckFinished += updates_CheckFinished; Disposed += (sender, args) => this.updates.CheckFinished -= updates_CheckFinished; // user interface toolTip.SetToolTip(checkExpandLinks, "Expands links inside the tweets. If disabled,\r\nthe full links show up in a tooltip instead."); toolTip.SetToolTip(checkFocusDmInput, "Places cursor into Direct Message input\r\nfield when opening a conversation."); toolTip.SetToolTip(checkOpenSearchInFirstColumn, "By default, TweetDeck adds Search columns at the end.\r\nThis option makes them appear before the first column instead."); toolTip.SetToolTip(checkKeepLikeFollowDialogsOpen, "Allows liking and following from multiple accounts at once,\r\ninstead of automatically closing the dialog after taking an action."); toolTip.SetToolTip(checkSmoothScrolling, "Toggles smooth mouse wheel scrolling."); toolTip.SetToolTip(labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots."); toolTip.SetToolTip(trackBarZoom, toolTip.GetToolTip(labelZoomValue)); checkExpandLinks.Checked = Config.ExpandLinksOnHover; checkFocusDmInput.Checked = Config.FocusDmInput; checkOpenSearchInFirstColumn.Checked = Config.OpenSearchInFirstColumn; checkKeepLikeFollowDialogsOpen.Checked = Config.KeepLikeFollowDialogsOpen; checkSmoothScrolling.Checked = Config.EnableSmoothScrolling; trackBarZoom.SetValueSafe(Config.ZoomLevel); labelZoomValue.Text = trackBarZoom.Value + "%"; // twitter toolTip.SetToolTip(checkBestImageQuality, "When right-clicking a tweet image, the context menu options\r\nwill use links to the original image size (:orig in the URL)."); toolTip.SetToolTip(checkHideTweetsByNftUsers, "Hides tweets created by users who use Twitter's NFT avatar integration.\r\nThis feature is somewhat experimental, some accounts might not be detected immediately."); toolTip.SetToolTip(checkAnimatedAvatars, "Some old Twitter avatars could be uploaded as animated GIFs."); checkBestImageQuality.Checked = Config.BestImageQuality; checkHideTweetsByNftUsers.Checked = Config.HideTweetsByNftUsers; checkAnimatedAvatars.Checked = Config.EnableAnimatedImages; // updates toolTip.SetToolTip(checkUpdateNotifications, "Checks for updates every hour.\r\nIf an update is dismissed, it will not appear again."); toolTip.SetToolTip(btnCheckUpdates, "Forces an update check, even for updates that had been dismissed."); checkUpdateNotifications.Checked = Config.EnableUpdateCheck; // external applications toolTip.SetToolTip(comboBoxCustomBrowser, "Sets the default browser for opening links."); toolTip.SetToolTip(comboBoxCustomVideoPlayer, "Sets the default application for playing videos."); toolTip.SetToolTip(comboBoxSearchEngine, "Sets the default website for opening searches."); foreach (WindowsUtils.Browser browserInfo in WindowsUtils.FindInstalledBrowsers()) { comboBoxCustomBrowser.Items.Add(browserInfo); } browserListIndexDefault = comboBoxCustomBrowser.Items.Add("(default browser)"); browserListIndexCustom = comboBoxCustomBrowser.Items.Add("(custom program...)"); UpdateBrowserPathSelection(); videoPlayerListIndexDefault = comboBoxCustomVideoPlayer.Items.Add("(default TweetDuck player)"); videoPlayerListIndexCustom = comboBoxCustomVideoPlayer.Items.Add("(custom program...)"); UpdateVideoPlayerPathSelection(); comboBoxSearchEngine.Items.Add(new SearchEngine("DuckDuckGo", "https://duckduckgo.com/?q=")); comboBoxSearchEngine.Items.Add(new SearchEngine("Google", "https://www.google.com/search?q=")); comboBoxSearchEngine.Items.Add(new SearchEngine("Bing", "https://www.bing.com/search?q=")); comboBoxSearchEngine.Items.Add(new SearchEngine("Yahoo", "https://search.yahoo.com/search?p=")); searchEngineIndexDefault = comboBoxSearchEngine.Items.Add("(no engine set)"); searchEngineIndexCustom = comboBoxSearchEngine.Items.Add("(custom url...)"); UpdateSearchEngineSelection(); // locales toolTip.SetToolTip(checkSpellCheck, "Underlines words that are spelled incorrectly."); toolTip.SetToolTip(comboBoxSpellCheckLanguage, "Language used for spell check."); toolTip.SetToolTip(comboBoxTranslationTarget, "Language tweets are translated into."); toolTip.SetToolTip(comboBoxFirstDayOfWeek, "First day of week used in the date picker."); checkSpellCheck.Checked = Config.EnableSpellCheck; try { foreach (Language item in SpellCheck.SupportedLanguages) { comboBoxSpellCheckLanguage.Items.Add(item); } } catch { comboBoxSpellCheckLanguage.Items.Add(Language.English); } comboBoxSpellCheckLanguage.SelectedItem = new Language(Config.SpellCheckLanguage); foreach (Language item in TweetDeckTranslations.SupportedLanguages) { comboBoxTranslationTarget.Items.Add(item); } comboBoxTranslationTarget.SelectedItem = new Language(Config.TranslationTarget); var daysOfWeek = comboBoxFirstDayOfWeek.Items; daysOfWeek.Add("(based on system locale)"); daysOfWeek.Add(new DayOfWeekItem("Monday", DayOfWeek.Monday)); daysOfWeek.Add(new DayOfWeekItem("Tuesday", DayOfWeek.Tuesday)); daysOfWeek.Add(new DayOfWeekItem("Wednesday", DayOfWeek.Wednesday)); daysOfWeek.Add(new DayOfWeekItem("Thursday", DayOfWeek.Thursday)); daysOfWeek.Add(new DayOfWeekItem("Friday", DayOfWeek.Friday)); daysOfWeek.Add(new DayOfWeekItem("Saturday", DayOfWeek.Saturday)); daysOfWeek.Add(new DayOfWeekItem("Sunday", DayOfWeek.Sunday)); comboBoxFirstDayOfWeek.SelectedItem = daysOfWeek.OfType <DayOfWeekItem>().FirstOrDefault(dow => dow.Id == Config.CalendarFirstDay) ?? daysOfWeek[0]; }
public void Initialize(NodesCollection nodes, WasabiSynchronizer synchronizer, UpdateChecker updateChecker) { Nodes = nodes; Synchronizer = synchronizer; HashChain = synchronizer.BitcoinStore.HashChain; UseTor = Global.Config.UseTor.Value; // Don't make it dynamic, because if you change this config settings only next time will it activate. _status = ActiveStatuses.WhenAnyValue(x => x.CurrentStatus) .ObserveOn(RxApp.MainThreadScheduler) .ToProperty(this, x => x.Status) .DisposeWith(Disposables); Observable.FromEventPattern <NodeEventArgs>(nodes, nameof(nodes.Added)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { SetPeers(Nodes.Count); }).DisposeWith(Disposables); Observable.FromEventPattern <NodeEventArgs>(nodes, nameof(nodes.Removed)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { SetPeers(Nodes.Count); }).DisposeWith(Disposables); SetPeers(Nodes.Count); Observable.FromEventPattern <int>(typeof(WalletService), nameof(WalletService.ConcurrentBlockDownloadNumberChanged)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { BlocksLeft = x.EventArgs; }).DisposeWith(Disposables); Synchronizer.WhenAnyValue(x => x.TorStatus) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(status => { SetTor(status); SetPeers(Nodes.Count); }).DisposeWith(Disposables); Synchronizer.WhenAnyValue(x => x.BackendStatus) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => { Backend = Synchronizer.BackendStatus; }).DisposeWith(Disposables); _filtersLeft = HashChain.WhenAnyValue(x => x.HashesLeft) .Throttle(TimeSpan.FromMilliseconds(100)) .ObserveOn(RxApp.MainThreadScheduler) .ToProperty(this, x => x.FiltersLeft) .DisposeWith(Disposables); Synchronizer.WhenAnyValue(x => x.UsdExchangeRate) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(usd => { BtcPrice = $"${(long)usd}"; }).DisposeWith(Disposables); Observable.FromEventPattern <bool>(Synchronizer, nameof(Synchronizer.ResponseArrivedIsGenSocksServFail)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(e => { OnResponseArrivedIsGenSocksServFail(e.EventArgs); }).DisposeWith(Disposables); this.WhenAnyValue(x => x.FiltersLeft, x => x.BlocksLeft) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(tup => { (int filtersLeft, int blocksLeft) = tup.ToValueTuple(); if (filtersLeft == 0 && blocksLeft == 0) { TryRemoveStatus(StatusBarStatus.Synchronizing); } else { TryAddStatus(StatusBarStatus.Synchronizing); } }); this.WhenAnyValue(x => x.Tor, x => x.Backend, x => x.Peers) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(tup => { (TorStatus tor, BackendStatus backend, int peers) = tup.ToValueTuple(); if (tor == TorStatus.NotRunning || backend != BackendStatus.Connected || peers < 1) { TryAddStatus(StatusBarStatus.Connecting); } else { TryRemoveStatus(StatusBarStatus.Connecting); } }); this.WhenAnyValue(x => x.UpdateStatus) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { if (x == UpdateStatus.Critical) { TryAddStatus(StatusBarStatus.CriticalUpdate); } else { TryRemoveStatus(StatusBarStatus.CriticalUpdate); } if (x == UpdateStatus.Optional) { TryAddStatus(StatusBarStatus.OptionalUpdate); } else { TryRemoveStatus(StatusBarStatus.OptionalUpdate); } }); UpdateCommand = ReactiveCommand.Create(() => { try { IoHelpers.OpenBrowser("https://wasabiwallet.io/#download"); } catch (Exception ex) { Logging.Logger.LogWarning <StatusBarViewModel>(ex); IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()); } }, this.WhenAnyValue(x => x.UpdateStatus) .ObserveOn(RxApp.MainThreadScheduler) .Select(x => x != UpdateStatus.Latest)); this.RaisePropertyChanged(nameof(UpdateCommand)); // The binding happens after the constructor. So, if the command is not in constructor, then we need this line. updateChecker.Start(TimeSpan.FromMinutes(7), () => { UpdateStatus = UpdateStatus.Critical; return(Task.CompletedTask); }, () => { if (UpdateStatus != UpdateStatus.Critical) { UpdateStatus = UpdateStatus.Optional; } return(Task.CompletedTask); }); }
internal static bool CheckForUpdateCore() { UpdateChecker updateChecker = new UpdateChecker(new Uri(Properties.Settings.Default.UpdateURL), typeof(Program).Assembly.GetName().Version); return(updateChecker.CheckForUpdate(Properties.Settings.Default.UpdateCheckIncludePrerelease)); }
public void Initialize(NodesCollection nodes, WasabiSynchronizer synchronizer, UpdateChecker updateChecker) { Nodes = nodes; Synchronizer = synchronizer; HashChain = synchronizer.BitcoinStore.HashChain; UseTor = Global.Config.UseTor; // Do not make it dynamic, because if you change this config settings only next time will it activate. _status = ActiveStatuses.WhenAnyValue(x => x.CurrentStatus) .ObserveOn(RxApp.MainThreadScheduler) .ToProperty(this, x => x.Status) .DisposeWith(Disposables); Observable .Merge(Observable.FromEventPattern <NodeEventArgs>(nodes, nameof(nodes.Added)).Select(x => true) .Merge(Observable.FromEventPattern <NodeEventArgs>(nodes, nameof(nodes.Removed)).Select(x => true) .Merge(Synchronizer.WhenAnyValue(x => x.TorStatus).Select(x => true)))) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => { // Set peers to 0 if Tor is not running, because we get Tor status from backend answer so it seems to the user that peers are connected over clearnet, while they are not. Peers = Synchronizer.TorStatus == TorStatus.NotRunning ? 0 : Nodes.Count; }).DisposeWith(Disposables); Peers = Tor == TorStatus.NotRunning ? 0 : Nodes.Count; Observable.FromEventPattern <bool>(typeof(WalletService), nameof(WalletService.DownloadingBlockChanged)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => DownloadingBlock = x.EventArgs) .DisposeWith(Disposables); Synchronizer.WhenAnyValue(x => x.TorStatus) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(status => { Tor = UseTor ? status : TorStatus.TurnedOff; }).DisposeWith(Disposables); Synchronizer.WhenAnyValue(x => x.BackendStatus) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => { Backend = Synchronizer.BackendStatus; }).DisposeWith(Disposables); _filtersLeft = HashChain.WhenAnyValue(x => x.HashesLeft) .Throttle(TimeSpan.FromMilliseconds(100)) .ObserveOn(RxApp.MainThreadScheduler) .ToProperty(this, x => x.FiltersLeft) .DisposeWith(Disposables); Synchronizer.WhenAnyValue(x => x.UsdExchangeRate) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(usd => { BtcPrice = $"${(long)usd}"; }).DisposeWith(Disposables); Observable.FromEventPattern <bool>(Synchronizer, nameof(Synchronizer.ResponseArrivedIsGenSocksServFail)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(e => { OnResponseArrivedIsGenSocksServFail(e.EventArgs); }).DisposeWith(Disposables); this.WhenAnyValue(x => x.FiltersLeft, x => x.DownloadingBlock) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(tup => { (int filtersLeft, bool downloadingBlock) = tup.ToValueTuple(); if (filtersLeft == 0 && !downloadingBlock) { TryRemoveStatus(StatusBarStatus.Synchronizing); } else { TryAddStatus(StatusBarStatus.Synchronizing); } }); this.WhenAnyValue(x => x.Tor, x => x.Backend, x => x.Peers) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(tup => { (TorStatus tor, BackendStatus backend, int peers) = tup.ToValueTuple(); if (tor == TorStatus.NotRunning || backend != BackendStatus.Connected || peers < 1) { TryAddStatus(StatusBarStatus.Connecting); } else { TryRemoveStatus(StatusBarStatus.Connecting); } }); this.WhenAnyValue(x => x.UpdateStatus) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { if (x == UpdateStatus.Critical) { TryAddStatus(StatusBarStatus.CriticalUpdate); } else { TryRemoveStatus(StatusBarStatus.CriticalUpdate); } if (x == UpdateStatus.Optional) { TryAddStatus(StatusBarStatus.OptionalUpdate); } else { TryRemoveStatus(StatusBarStatus.OptionalUpdate); } }); UpdateCommand = ReactiveCommand.Create(() => { try { IoHelpers.OpenBrowser("https://wasabiwallet.io/#download"); } catch (Exception ex) { Logger.LogWarning(ex); IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global)); } }, this.WhenAnyValue(x => x.UpdateStatus) .ObserveOn(RxApp.MainThreadScheduler) .Select(x => x != UpdateStatus.Latest)); this.RaisePropertyChanged(nameof(UpdateCommand)); // The binding happens after the constructor. So, if the command is not in constructor, then we need this line. Observable.FromEventPattern <UpdateStatusResult>(updateChecker, nameof(updateChecker.UpdateChecked)) .Select(x => x.EventArgs) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { if (x.BackendCompatible) { if (x.ClientUpToDate) { UpdateStatus = UpdateStatus.Latest; } else { UpdateStatus = UpdateStatus.Optional; } } else { UpdateStatus = UpdateStatus.Critical; } UpdateAvailable = !x.ClientUpToDate; CriticalUpdateAvailable = !x.BackendCompatible; }).DisposeWith(Disposables); updateChecker.Start(TimeSpan.FromMinutes(7)); }
public override async void OnAppearing(params object[] datas) { IsLoaded = false; while (!await WebApiService.CheckInternetConnection()) { } // Check Exist Latest Version await UpdateChecker.Execute(); // Table Loader TableLoader.Init(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)); // Check Language { LocalStorage.Storage.GetValueOrDefault <string>(LocalStorageKey.UserLanguageId, out string userLanguageId); if (userLanguageId == null) { userLanguageId = CultureInfo.CurrentUICulture.Name.Split('-')[0]; if (!CoverageLanguage.CoverageLanguages.ContainsKey(userLanguageId)) { // Default Language : EN userLanguageId = AppConfig.DEFAULT_LANGUAGE; } LocalStorage.Storage.AddOrUpdateValue <string>(LocalStorageKey.UserLanguageId, userLanguageId); } CultureInfo.CurrentCulture = new CultureInfo(userLanguageId); CultureInfo.CurrentUICulture = new CultureInfo(userLanguageId); } // Check Timezone { LocalStorage.Storage.GetValueOrDefault <string>(LocalStorageKey.UserTimeZoneId, out string userTimeZoneId); // Delete ExpiredCachedData if (TimeZoneInfo.Local.Id.Equals(userTimeZoneId)) { await _cacheService.DeleteExpiredCachedDataAsync(); } else { await _cacheService.DeleteAllCachedDataAsync(); } LocalStorage.Storage.AddOrUpdateValue <string>(LocalStorageKey.UserTimeZoneId, TimeZoneInfo.Local.Id); } string serverPubKey = await _webApiService.RequestAsync <string>(new WebRequestContext { SerializeType = SerializeType.MessagePack, MethodType = WebMethodType.GET, BaseUrl = AppConfig.PoseWebBaseUrl, ServiceUrl = AuthProxy.ServiceUrl, SegmentGroup = AuthProxy.P_PUBLISH_KEY, }); if (!string.IsNullOrEmpty(serverPubKey)) { CryptoFacade.Instance.RSA_FromXmlString(serverPubKey); ClientContext.eSignature = CryptoFacade.Instance.GetEncryptedSignature(); ClientContext.eSignatureIV = CryptoFacade.Instance.GetEncryptedSignatureIV(); } // Prepare SingletonPage ShinyHost.Resolve <AppMasterViewModel>(); // Notify Init //await _notificationService.Initialize(); // InAppBilling Item Init bool isBillingSystemInit = false; do { isBillingSystemInit = await ShinyHost.Resolve <InAppBillingService>().InitializeProduct(); if (!isBillingSystemInit) { await MaterialDialog.Instance.AlertAsync(LocalizeString.BillingSystem_Not_Available, LocalizeString.App_Title, LocalizeString.Ok, DialogConfiguration.AppTitleAlterDialogConfiguration); } } while (!isBillingSystemInit); var deviceInfoHelper = DependencyService.Resolve <IDeviceInfoHelper>(); if (!deviceInfoHelper.IsLicensed.HasValue || !deviceInfoHelper.IsLicensed.Value) { await MaterialDialog.Instance.AlertAsync(LocalizeString.Service_Not_Available, LocalizeString.App_Title, LocalizeString.Ok, DialogConfiguration.AppTitleAlterDialogConfiguration); } else if (!await _OAuthService.IsAuthenticatedAndValid() || !await ShinyHost.Resolve <LoginViewModel>().PoseLogin(true)) { await _OAuthService.Logout(); await ShinyHost.Resolve <LoginViewModel>().GuestLogin(); } IsLoaded = true; OnPropertyChanged("IsLoaded"); MessagingCenter.Send(this, "LoadingComplete"); }
public AboutForm() { InitializeComponent(); Icon = ShareXResources.Icon; lblProductName.Text = Program.Title; pbLogo.Image = ShareXResources.Logo; rtbShareXInfo.AddContextMenu(); rtbCredits.AddContextMenu(); #if STEAM || WindowsStore uclUpdate.Visible = false; lblBuild.Visible = true; if (Program.Build == ShareXBuild.Steam) { lblBuild.Text = "Steam build"; } else if (Program.Build == ShareXBuild.WindowsStore) { lblBuild.Text = "Windows Store build"; } #else if (!Program.PortableApps) { UpdateChecker updateChecker = Program.UpdateManager.CreateUpdateChecker(); uclUpdate.CheckUpdate(updateChecker); } else { uclUpdate.Visible = false; } #endif lblTeam.Text = "ShareX Team:"; lblBerk.Text = "Jaex (Berk)"; lblMike.Text = "McoreD (Michael Delpach)"; rtbShareXInfo.Text = $@"{Resources.AboutForm_AboutForm_Website}: {Links.URL_WEBSITE} {Resources.AboutForm_AboutForm_Project_page}: {Links.URL_PROJECT} {Resources.AboutForm_AboutForm_Changelog}: {Links.URL_CHANGELOG}"; rtbCredits.Text = $@"{Resources.AboutForm_AboutForm_Contributors}: https://github.com/ShareX/ShareX/graphs/contributors {Resources.AboutForm_AboutForm_Translators}: Turkish: https://github.com/Jaex & https://github.com/muratmoon German: https://github.com/Starbug2 & https://github.com/Kaeltis French: https://github.com/nwies & https://github.com/Shadorc Simplified Chinese: https://github.com/jiajiechan Hungarian: https://github.com/devBluestar Korean: https://github.com/123jimin Spanish: https://github.com/ovnisoftware Dutch: https://github.com/canihavesomecoffee Portuguese (Brazil): https://github.com/RockyTV & https://github.com/athosbr99 Vietnamese: https://github.com/thanhpd Russian: https://github.com/L1Q Traditional Chinese: https://github.com/alantsai {Resources.AboutForm_AboutForm_External_libraries}: Greenshot Image Editor: https://github.com/greenshot/greenshot Json.NET: https://github.com/JamesNK/Newtonsoft.Json SSH.NET: https://github.com/sshnet/SSH.NET Icons: http://p.yusukekamiyamane.com ImageListView: https://github.com/oozcitak/imagelistview FFmpeg: http://www.ffmpeg.org Zeranoe FFmpeg: http://ffmpeg.zeranoe.com/builds 7-Zip: http://www.7-zip.org SevenZipSharp: https://sevenzipsharp.codeplex.com DirectShow video and audio device: https://github.com/rdp/screen-capture-recorder-to-video-windows-free QrCode.Net: https://qrcodenet.codeplex.com System.Net.FtpClient: https://netftp.codeplex.com Steamworks.NET: https://github.com/rlabrecque/Steamworks.NET OCR Space: http://ocr.space Copyright (c) 2007-2017 ShareX Team"; }
private void hbUpdates_RequestNavigate(object sender, RequestNavigateEventArgs e) { tbVersion.Text = String.Format("{0} ({1})", VersionUtil.GetVersionName(), UI.CheckingForUpdates); e.Handled = true; versionChecker = new BackgroundWorker(); versionChecker.DoWork += delegate(object s, DoWorkEventArgs args) { string text; if (!UpdateChecker.IsWorking()) { text = UI.FailedToRetrieveUpdateInformation; } else if (UpdateChecker.IsUpdateAvailable()) { text = String.Format(UI.UpdateAvailable, UpdateChecker.GetLastReleasedVersion().Version, UpdateChecker.GetLastReleasedVersion().ReleaseDate); } else { text = UI.NoUpdateAvailable; } args.Result = String.Format("{0} ({1})", VersionUtil.GetVersionName(), text); }; versionChecker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args) { tbVersion.Text = args.Result as string; }; versionChecker.RunWorkerAsync(); }
private void btnCheckUpdates_Click(object sender, EventArgs e) { UpdateChecker.StartUpdateCheck(false); }
public static async Task InitializeNoWalletAsync() { WalletService = null; ChaumianClient = null; AddressManager = null; TorManager = null; #region ConfigInitialization Config = new Config(Path.Combine(DataDir, "Config.json")); await Config.LoadOrCreateDefaultFileAsync(); Logger.LogInfo <Config>("Config is successfully initialized."); #endregion ConfigInitialization BitcoinStore = new BitcoinStore(); var bstoreInitTask = BitcoinStore.InitializeAsync(Path.Combine(DataDir, "BitcoinStore"), Network); var hwiInitTask = HwiProcessManager.InitializeAsync(DataDir, Network); var addressManagerFolderPath = Path.Combine(DataDir, "AddressManager"); AddressManagerFilePath = Path.Combine(addressManagerFolderPath, $"AddressManager{Network}.dat"); var blocksFolderPath = Path.Combine(DataDir, $"Blocks{Network}"); var connectionParameters = new NodeConnectionParameters(); if (Config.UseTor.Value) { Synchronizer = new WasabiSynchronizer(Network, BitcoinStore, () => Config.GetCurrentBackendUri(), Config.GetTorSocks5EndPoint()); } else { Synchronizer = new WasabiSynchronizer(Network, BitcoinStore, Config.GetFallbackBackendUri(), null); } UpdateChecker = new UpdateChecker(Synchronizer.WasabiClient); #region ProcessKillSubscription AppDomain.CurrentDomain.ProcessExit += async(s, e) => await TryDesperateDequeueAllCoinsAsync(); Console.CancelKeyPress += async(s, e) => { e.Cancel = true; Logger.LogWarning("Process was signaled for killing.", nameof(Global)); KillRequested = true; await TryDesperateDequeueAllCoinsAsync(); Dispatcher.UIThread.PostLogException(() => { Application.Current?.MainWindow?.Close(); }); await DisposeAsync(); Logger.LogInfo($"Wasabi stopped gracefully.", Logger.InstanceGuid.ToString()); }; #endregion ProcessKillSubscription #region TorProcessInitialization if (Config.UseTor.Value) { TorManager = new TorProcessManager(Config.GetTorSocks5EndPoint(), TorLogsFile); } else { TorManager = TorProcessManager.Mock(); } TorManager.Start(false, DataDir); var fallbackRequestTestUri = new Uri(Config.GetFallbackBackendUri(), "/api/software/versions"); TorManager.StartMonitor(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(7), DataDir, fallbackRequestTestUri); Logger.LogInfo <TorProcessManager>($"{nameof(TorProcessManager)} is initialized."); #endregion TorProcessInitialization #region AddressManagerInitialization var needsToDiscoverPeers = true; if (Network == Network.RegTest) { AddressManager = new AddressManager(); Logger.LogInfo <AddressManager>($"Fake {nameof(AddressManager)} is initialized on the RegTest."); } else { try { AddressManager = AddressManager.LoadPeerFile(AddressManagerFilePath); // The most of the times we don't need to discover new peers. Instead, we can connect to // some of those that we already discovered in the past. In this case we assume that we // assume that discovering new peers could be necessary if out address manager has less // than 500 addresses. A 500 addresses could be okay because previously we tried with // 200 and only one user reported he/she was not able to connect (there could be many others, // of course). // On the other side, increasing this number forces users that do not need to discover more peers // to spend resources (CPU/bandwith) to discover new peers. needsToDiscoverPeers = Config.UseTor == true || AddressManager.Count < 500; Logger.LogInfo <AddressManager>($"Loaded {nameof(AddressManager)} from `{AddressManagerFilePath}`."); } catch (DirectoryNotFoundException ex) { Logger.LogInfo <AddressManager>($"{nameof(AddressManager)} did not exist at `{AddressManagerFilePath}`. Initializing new one."); Logger.LogTrace <AddressManager>(ex); AddressManager = new AddressManager(); } catch (FileNotFoundException ex) { Logger.LogInfo <AddressManager>($"{nameof(AddressManager)} did not exist at `{AddressManagerFilePath}`. Initializing new one."); Logger.LogTrace <AddressManager>(ex); AddressManager = new AddressManager(); } catch (OverflowException ex) { // https://github.com/zkSNACKs/WalletWasabi/issues/712 Logger.LogInfo <AddressManager>($"{nameof(AddressManager)} has thrown `{nameof(OverflowException)}`. Attempting to autocorrect."); File.Delete(AddressManagerFilePath); Logger.LogTrace <AddressManager>(ex); AddressManager = new AddressManager(); Logger.LogInfo <AddressManager>($"{nameof(AddressManager)} autocorrection is successful."); } catch (FormatException ex) { // https://github.com/zkSNACKs/WalletWasabi/issues/880 Logger.LogInfo <AddressManager>($"{nameof(AddressManager)} has thrown `{nameof(FormatException)}`. Attempting to autocorrect."); File.Delete(AddressManagerFilePath); Logger.LogTrace <AddressManager>(ex); AddressManager = new AddressManager(); Logger.LogInfo <AddressManager>($"{nameof(AddressManager)} autocorrection is successful."); } } var addressManagerBehavior = new AddressManagerBehavior(AddressManager) { Mode = needsToDiscoverPeers ? AddressManagerBehaviorMode.Discover : AddressManagerBehaviorMode.None }; connectionParameters.TemplateBehaviors.Add(addressManagerBehavior); #endregion AddressManagerInitialization #region MempoolInitialization MemPoolService = new MemPoolService(); connectionParameters.TemplateBehaviors.Add(new MemPoolBehavior(MemPoolService)); #endregion MempoolInitialization #region HwiProcessInitialization try { await hwiInitTask; } catch (Exception ex) { Logger.LogError(ex, nameof(Global)); } #endregion HwiProcessInitialization #region BitcoinStoreInitialization await bstoreInitTask; #endregion BitcoinStoreInitialization #region P2PInitialization if (Network == Network.RegTest) { Nodes = new NodesGroup(Network, requirements: Constants.NodeRequirements); try { Node node = await Node.ConnectAsync(Network.RegTest, new IPEndPoint(IPAddress.Loopback, 18444)); Nodes.ConnectedNodes.Add(node); RegTestMemPoolServingNode = await Node.ConnectAsync(Network.RegTest, new IPEndPoint(IPAddress.Loopback, 18444)); RegTestMemPoolServingNode.Behaviors.Add(new MemPoolBehavior(MemPoolService)); } catch (SocketException ex) { Logger.LogError(ex, nameof(Global)); } } else { if (Config.UseTor is true) { // onlyForOnionHosts: false - Connect to clearnet IPs through Tor, too. connectionParameters.TemplateBehaviors.Add(new SocksSettingsBehavior(Config.GetTorSocks5EndPoint(), onlyForOnionHosts: false, networkCredential: null, streamIsolation: true)); // allowOnlyTorEndpoints: true - Connect only to onions and don't connect to clearnet IPs at all. // This of course makes the first setting unneccessary, but it's better if that's around, in case someone wants to tinker here. connectionParameters.EndpointConnector = new DefaultEndpointConnector(allowOnlyTorEndpoints: Network == Network.Main); await AddKnownBitcoinFullNodeAsHiddenServiceAsync(AddressManager); } Nodes = new NodesGroup(Network, connectionParameters, requirements: Constants.NodeRequirements); RegTestMemPoolServingNode = null; } Nodes.Connect(); Logger.LogInfo("Start connecting to nodes..."); if (RegTestMemPoolServingNode != null) { RegTestMemPoolServingNode.VersionHandshake(); Logger.LogInfo("Start connecting to mempool serving regtest node..."); } #endregion P2PInitialization #region SynchronizerInitialization var requestInterval = TimeSpan.FromSeconds(30); if (Network == Network.RegTest) { requestInterval = TimeSpan.FromSeconds(5); } int maxFiltSyncCount = Network == Network.Main ? 1000 : 10000; // On testnet, filters are empty, so it's faster to query them together Synchronizer.Start(requestInterval, TimeSpan.FromMinutes(5), maxFiltSyncCount); Logger.LogInfo("Start synchronizing filters..."); #endregion SynchronizerInitialization Initialized = true; }
public async Task CheckAndDownloadNewVersion(bool displayDialogue) { UpdateChecker updater = new UpdateChecker(); VersionInfo info; info = await updater.CheckForNewVersion(); if (info.isNew) { // Create update information to display. string updateResult = "Version " + info.version + " was found!\n\n"; updateResult += info.updateInfo; GUIConfirm confirm = new GUIConfirm(); confirm.infoLabel.Text = GlobalVariables.PROGRAM_TITLE + " Updater"; confirm.textBox.Text = updateResult; confirm.infoLabel2.Text = "Do you wish to update?"; confirm.ShowDialog(this); if (confirm.confirmed) await updater.DownloadFile(true); } else { if (displayDialogue) MessageBox.Show("The latest version is installed."); } }
public ConfigForm(ShadowsocksController controller, UpdateChecker updateChecker, int focusIndex) { this.Font = System.Drawing.SystemFonts.MessageBoxFont; InitializeComponent(); ServersListBox.Font = CreateFont(); NumServerPort.Minimum = IPEndPoint.MinPort; NumServerPort.Maximum = IPEndPoint.MaxPort; NumUDPPort.Minimum = IPEndPoint.MinPort; NumUDPPort.Maximum = IPEndPoint.MaxPort; this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); this.controller = controller; this.updateChecker = updateChecker; if (updateChecker.LatestVersionURL == null) { LinkUpdate.Visible = false; } foreach (string name in EncryptorFactory.GetEncryptor()) { EncryptorInfo info = EncryptorFactory.GetEncryptorInfo(name); if (info.display) { EncryptionSelect.Items.Add(name); } } UpdateTexts(); controller.ConfigChanged += controller_ConfigChanged; LoadCurrentConfiguration(); if (_modifiedConfiguration.index >= 0 && _modifiedConfiguration.index < _modifiedConfiguration.configs.Count) { _oldSelectedID = _modifiedConfiguration.configs[_modifiedConfiguration.index].id; } if (focusIndex == -1) { int index = _modifiedConfiguration.index + 1; if (index < 0 || index > _modifiedConfiguration.configs.Count) { index = _modifiedConfiguration.configs.Count; } focusIndex = index; } if (_modifiedConfiguration.isHideTips) { PictureQRcode.Visible = false; } int dpi_mul = Util.Utils.GetDpiMul(); //ServersListBox.Height = ServersListBox.Height * 4 / dpi_mul; ServersListBox.Width = ServersListBox.Width * dpi_mul / 4; //ServersListBox.Height = ServersListBox.Height * dpi_mul / 4; ServersListBox.Height = checkAdvSetting.Top + checkAdvSetting.Height; AddButton.Width = AddButton.Width * dpi_mul / 4; AddButton.Height = AddButton.Height * dpi_mul / 4; DeleteButton.Width = DeleteButton.Width * dpi_mul / 4; DeleteButton.Height = DeleteButton.Height * dpi_mul / 4; UpButton.Width = UpButton.Width * dpi_mul / 4; UpButton.Height = UpButton.Height * dpi_mul / 4; DownButton.Width = DownButton.Width * dpi_mul / 4; DownButton.Height = DownButton.Height * dpi_mul / 4; //IPTextBox.Width = IPTextBox.Width * dpi_mul / 4; //ServerPortNumericUpDown.Width = ServerPortNumericUpDown.Width * dpi_mul / 4; //PasswordTextBox.Width = PasswordTextBox.Width * dpi_mul / 4; //EncryptionSelect.Width = EncryptionSelect.Width * dpi_mul / 4; //TCPProtocolComboBox.Width = TCPProtocolComboBox.Width * dpi_mul / 4; //ObfsCombo.Width = ObfsCombo.Width * dpi_mul / 4; //TextObfsParam.Width = TextObfsParam.Width * dpi_mul / 4; //RemarksTextBox.Width = RemarksTextBox.Width * dpi_mul / 4; //TextGroup.Width = TextGroup.Width * dpi_mul / 4; //TextLink.Width = TextLink.Width * dpi_mul / 4; //TextUDPPort.Width = TextUDPPort.Width * dpi_mul / 4; //int font_height = 9; //EncryptionSelect.Height = EncryptionSelect.Height - font_height + font_height * dpi_mul / 4; //TCPProtocolComboBox.Height = TCPProtocolComboBox.Height - font_height + font_height * dpi_mul / 4; //ObfsCombo.Height = ObfsCombo.Height - font_height + font_height * dpi_mul / 4; //OKButton.Width = OKButton.Width * dpi_mul / 4; OKButton.Height = OKButton.Height * dpi_mul / 4; //MyCancelButton.Width = MyCancelButton.Width * dpi_mul / 4; MyCancelButton.Height = MyCancelButton.Height * dpi_mul / 4; DrawLogo(350 * dpi_mul / 4); //DrawLogo(350); ShowWindow(); if (focusIndex >= 0 && focusIndex < _modifiedConfiguration.configs.Count) { SetServerListSelectedIndex(focusIndex); LoadSelectedServer(); } UpdateServersListBoxTopIndex(); }
///<summary>Called on the UI thread to download and apply an update.</summary> ///<returns>True if the update was downloaded and applied.</returns> public static bool ApplyUpdate(UpdateInfo update) { if (Updater.RestartPending) { if (DialogResult.Yes == XtraMessageBox.Show("An update has already been downloaded.\r\nDo you want to restart the program and apply the update?", "Shomrei Torah Billing", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { Application.Exit(); } return(true); } UserLookAndFeel.Default.SkinName = "Office 2010 Blue"; //This must be set here in case we're on the splash thread at launch time. SkinManager.EnableFormSkins(); var parent = (IWin32Window)Program.UIInvoker; //For some reason, I must set the parent to MainForm or it won't be properly modal. var description = update.GetChanges(Checker.CurrentVersion); if (DialogResult.No == XtraMessageBox.Show(parent, "An update is available. Do you want to install it?\r\n\r\nThis update provides the following features:\r\n" + description, "Shomrei Torah Billing", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { return(false); } string updatePath = null; try { if (!ProgressWorker.Execute(parent, ui => { ui.Caption = "Downloading update..."; updatePath = update.DownloadFiles(existingFiles: Program.AppDirectory, organizationId: Config.ReadAttribute("Updates", "OrganizationId"), ui: ui); if (!ui.WasCanceled) { ui.Caption = "Applying update"; } }, true)) { return(false); } } catch (TargetInvocationException tex) { Exception ex = tex.GetBaseException(); if (!Debugger.IsAttached) { Email.Warn("Billing Update Error", "New Version: " + update.NewVersion + "\r\nDescription: \r\n" + description + "\r\n\r\n" + ex); } XtraMessageBox.Show(parent, "An error occurred while downloading the update.\r\n" + ex, "Shomrei Torah Billing", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (updatePath == null) { return(false); } //Updates will (usually) include a billing config file, //but I don't want a billing config file at home. if (!File.Exists(Path.Combine(Program.AppDirectory, "ShomreiTorah.Billing.Config.xml"))) { File.Delete(Path.Combine(updatePath, "ShomreiTorah.Billing.Config.xml")); //File.Delete doesn't throw FileNotFound } if (Program.Current.SyncContext != null) //If an update was applied at launch, the database will not have been loaded yet. { Program.Current.SaveDatabase(); } UpdateChecker.ApplyUpdate(updatePath, Program.AppDirectory); try { Email.Default.Send(Email.AlertsAddress, Email.AdminAddress, Environment.UserName + " updated ShomreiTorah.Billing on " + Environment.MachineName, "Old version: " + Checker.CurrentVersion + "\r\n" + "New version: " + update.NewVersion + " (Published on " + update.PublishDate.ToString("F", CultureInfo.InvariantCulture) + ")\r\n\r\nPath: " + Program.AppDirectory + "\r\n\r\nChanges:\r\n" + description + "\r\n\r\nUpdated files:\r\n • " + update.Files.Where(f => !f.Matches(Program.AppDirectory)).Join("\r\n • ", f => f.RelativePath) + "\r\n\r\nPre-update files:\r\n • " + String.Join("\r\n • ", Directory.GetFiles(Program.AppDirectory, "*.*", SearchOption.AllDirectories)) , false); } catch (SmtpException) { } timer.Stop(); //In case we were called by the Update button in MainForm RestartPending = true; var cea = new CancelEventArgs(); Application.Exit(cea); if (cea.Cancel) { XtraMessageBox.Show(parent, "The update will be applied after you exit the program.", "Shomrei Torah Billing"); } return(true); }
public UpdateMessage() { updateChecker = new UpdateChecker(Configuration.CurrentVersion()); }
public Main() { UpdateChecker.VerifyXmlNodeExists(PluginName, FileID, DownloadURL, Path); DependencyChecker.RegisterPluginForDependencyChecks(PluginName); }
public static MainWindowViewModel GetMainWindowViewModel(MainWindowModel model, Dispatcher dispatcher, HidGuardianManager hidGuardianManager, UpdateChecker updateChecker) { return(new MainWindowViewModel(model, dispatcher, hidGuardianManager, updateChecker)); }
private void CheckUpdate() { UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Program.AssemblyVersion), ReleaseChannelType.Stable, Uploader.ProxySettings.GetWebProxy); updateChecker.CheckUpdate(); if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateRequired && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL)) { if (MessageBox.Show("Update found. Do you want to download it?", "Update check", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary); downloader.ShowDialog(); if (downloader.Status == DownloaderFormStatus.InstallStarted) Application.Exit(); } } }
public async Task InitializeNoWalletAsync() { WalletService = null; ChaumianClient = null; AddressManager = null; TorManager = null; #region ConfigInitialization Config = new Config(Path.Combine(DataDir, "Config.json")); await Config.LoadOrCreateDefaultFileAsync(); Logger.LogInfo($"{nameof(Config)} is successfully initialized."); #endregion ConfigInitialization BitcoinStore = new BitcoinStore(); var bstoreInitTask = BitcoinStore.InitializeAsync(Path.Combine(DataDir, "BitcoinStore"), Network); var addressManagerFolderPath = Path.Combine(DataDir, "AddressManager"); Task <CoreNode> bitcoinCoreNodeInitTask; if (Config.StartLocalBitcoinCoreOnStartup) { bitcoinCoreNodeInitTask = CoreNode .CreateAsync(new CoreNodeParams( Network, Config.LocalBitcoinCoreDataDir, tryRestart: false, tryDeleteDataDir: false, EndPointStrategy.Custom(Config.GetBitcoinP2pEndPoint()), EndPointStrategy.Default(Network, EndPointType.Rpc), txIndex: null, prune: null)); } else { bitcoinCoreNodeInitTask = Task.FromResult <CoreNode>(null); } AddressManagerFilePath = Path.Combine(addressManagerFolderPath, $"AddressManager{Network}.dat"); var addrManTask = InitializeAddressManagerBehaviorAsync(); var blocksFolderPath = Path.Combine(DataDir, $"Blocks{Network}"); var connectionParameters = new NodeConnectionParameters { UserAgent = "/Satoshi:0.18.1/" }; if (Config.UseTor) { Synchronizer = new WasabiSynchronizer(Network, BitcoinStore, () => Config.GetCurrentBackendUri(), Config.TorSocks5EndPoint); } else { Synchronizer = new WasabiSynchronizer(Network, BitcoinStore, Config.GetFallbackBackendUri(), null); } UpdateChecker = new UpdateChecker(TimeSpan.FromMinutes(7), Synchronizer.WasabiClient); #region ProcessKillSubscription AppDomain.CurrentDomain.ProcessExit += async(s, e) => await TryDesperateDequeueAllCoinsAsync(); Console.CancelKeyPress += async(s, e) => { e.Cancel = true; Logger.LogWarning("Process was signaled for killing."); KillRequested = true; await TryDesperateDequeueAllCoinsAsync(); Dispatcher.UIThread.PostLogException(() => { var window = (Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).MainWindow; window?.Close(); }); await DisposeAsync(); Logger.LogSoftwareStopped("Wasabi"); }; #endregion ProcessKillSubscription #region TorProcessInitialization if (Config.UseTor) { TorManager = new TorProcessManager(Config.TorSocks5EndPoint, TorLogsFile); } else { TorManager = TorProcessManager.Mock(); } TorManager.Start(false, DataDir); var fallbackRequestTestUri = new Uri(Config.GetFallbackBackendUri(), "/api/software/versions"); TorManager.StartMonitor(TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(7), DataDir, fallbackRequestTestUri); Logger.LogInfo($"{nameof(TorProcessManager)} is initialized."); #endregion TorProcessInitialization #region BitcoinStoreInitialization await bstoreInitTask; #endregion BitcoinStoreInitialization #region BitcoinCoreInitialization var feeProviderList = new List <IFeeProvider>(); try { BitcoinCoreNode = await bitcoinCoreNodeInitTask.ConfigureAwait(false); if (Config.StartLocalBitcoinCoreOnStartup) { RpcMonitor.RpcClient = BitcoinCoreNode.RpcClient; RpcMonitor.Start(); RpcFeeProvider = new RpcFeeProvider(TimeSpan.FromMinutes(1), BitcoinCoreNode.RpcClient); RpcFeeProvider.Start(); feeProviderList.Add(RpcFeeProvider); } } catch (Exception ex) { Logger.LogError(ex); } feeProviderList.Add(Synchronizer); FeeProviders = new FeeProviders(feeProviderList); #endregion BitcoinCoreInitialization #region MempoolInitialization connectionParameters.TemplateBehaviors.Add(BitcoinStore.CreateMempoolBehavior()); #endregion MempoolInitialization #region AddressManagerInitialization AddressManagerBehavior addressManagerBehavior = await addrManTask; connectionParameters.TemplateBehaviors.Add(addressManagerBehavior); #endregion AddressManagerInitialization #region P2PInitialization if (Network == Network.RegTest) { Nodes = new NodesGroup(Network, requirements: Constants.NodeRequirements); try { EndPoint bitcoinCoreEndpoint = Config.GetBitcoinP2pEndPoint(); Node node = await Node.ConnectAsync(Network.RegTest, bitcoinCoreEndpoint); Nodes.ConnectedNodes.Add(node); RegTestMempoolServingNode = await Node.ConnectAsync(Network.RegTest, bitcoinCoreEndpoint); RegTestMempoolServingNode.Behaviors.Add(BitcoinStore.CreateMempoolBehavior()); } catch (SocketException ex) { Logger.LogError(ex); } } else { if (Config.UseTor is true) { // onlyForOnionHosts: false - Connect to clearnet IPs through Tor, too. connectionParameters.TemplateBehaviors.Add(new SocksSettingsBehavior(Config.TorSocks5EndPoint, onlyForOnionHosts: false, networkCredential: null, streamIsolation: true)); // allowOnlyTorEndpoints: true - Connect only to onions and do not connect to clearnet IPs at all. // This of course makes the first setting unnecessary, but it's better if that's around, in case someone wants to tinker here. connectionParameters.EndpointConnector = new DefaultEndpointConnector(allowOnlyTorEndpoints: Network == Network.Main); await AddKnownBitcoinFullNodeAsHiddenServiceAsync(AddressManager); } Nodes = new NodesGroup(Network, connectionParameters, requirements: Constants.NodeRequirements); RegTestMempoolServingNode = null; } Nodes.Connect(); Logger.LogInfo("Start connecting to nodes..."); if (RegTestMempoolServingNode != null) { RegTestMempoolServingNode.VersionHandshake(); Logger.LogInfo("Start connecting to mempool serving regtest node..."); } #endregion P2PInitialization #region SynchronizerInitialization var requestInterval = TimeSpan.FromSeconds(30); if (Network == Network.RegTest) { requestInterval = TimeSpan.FromSeconds(5); } int maxFiltSyncCount = Network == Network.Main ? 1000 : 10000; // On testnet, filters are empty, so it's faster to query them together Synchronizer.Start(requestInterval, TimeSpan.FromMinutes(5), maxFiltSyncCount); Logger.LogInfo("Start synchronizing filters..."); #endregion SynchronizerInitialization TransactionBroadcaster = new TransactionBroadcaster(Network, BitcoinStore, Synchronizer, Nodes, BitcoinCoreNode?.RpcClient); Initialized = true; }
/// <summary> /// Return if we need to check for update or not /// </summary> /// <returns></returns> private bool NeedToCheckForUpdate() { return(UpdateChecker.IsNeedToUpdate()); }
public void TestThatIsUpdateCompatibleChecksVersionCorrectly(string version, string[] incompatibleVersions, bool expectedResult) { UpdateChecker checker = new UpdateChecker(version); Assert.Equal(expectedResult, checker.IsUpdateCompatible(incompatibleVersions)); }
public MenuViewController(ShadowsocksController controller) { this.controller = controller; this.trafficStats = new TrafficStats(); this.trafficStats.Load(); LoadMenu(); controller.EnableStatusChanged += controller_EnableStatusChanged; controller.ConfigChanged += controller_ConfigChanged; controller.PACFileReadyToOpen += controller_FileReadyToOpen; controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen; controller.ShareOverLANStatusChanged += controller_ShareOverLANStatusChanged; controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged; controller.EnableGlobalChanged += controller_EnableGlobalChanged; controller.Errored += controller_Errored; controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted; controller.UpdatePACFromGFWListError += controller_UpdatePACFromGFWListError; _notifyIcon = new NotifyIcon(); UpdateTrayIcon(); _notifyIcon.Visible = true; _notifyIcon.ContextMenu = contextMenu1; _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked; _notifyIcon.MouseClick += notifyIcon1_Click; _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick; _notifyIcon.BalloonTipClosed += _notifyIcon_BalloonTipClosed; controller.TrafficChanged += controller_TrafficChanged; this.updateChecker = new UpdateChecker(); updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted; LoadCurrentConfiguration(); CheckStatsItem(statsItem.Checked); Configuration config = controller.GetConfigurationCopy(); if (config.isDefault) { _isFirstRun = true; ShowConfigForm(); } else if (config.autoCheckUpdate) { _isStartupChecking = true; updateChecker.CheckUpdate(config, 3000); } this.lastInboundCounter = controller.InboundCounter; this.lastOutboundCounter = controller.OutboundCounter; //更新统计数据 Task.Factory.StartNew(UpdateTrafficDataStats, (cts = new CancellationTokenSource()).Token, TaskCreationOptions.LongRunning, TaskScheduler.Current); //统计数据校正 this.trafficStats.CalibrateTrafficDataStats(); Application.ApplicationExit += Application_ApplicationExit; }
private void CheckUpdate() { if (UpdaterAck != System.Windows.Forms.DialogResult.None) { UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Adapter.AssemblyVersion), Engine.ConfigUI.ReleaseChannel, Uploader.ProxySettings.GetWebProxy); updateChecker.CheckUpdate(); UpdaterAck = System.Windows.Forms.DialogResult.None; if (updateChecker.UpdateInfo != null && updateChecker.UpdateInfo.Status == UpdateStatus.UpdateRequired && !string.IsNullOrEmpty(updateChecker.UpdateInfo.URL)) { UpdaterAck = MessageBox.Show("Update found. Do you want to download it?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (UpdaterAck == DialogResult.Yes) { DownloaderForm downloader = new DownloaderForm(updateChecker.UpdateInfo.URL, updateChecker.Proxy, updateChecker.UpdateInfo.Summary); downloader.ShowDialog(); if (downloader.Status == DownloaderFormStatus.InstallStarted) Application.Exit(); } } } }
private async void checkForUpdates_button_Click(object sender, RoutedEventArgs e) { await UpdateChecker.CheckForNewVersion(false, true); }
private void updateThread_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = (BackgroundWorker)sender; NewVersionWindowOptions nvwo = new NewVersionWindowOptions { MyIcon = Resources.zss_main, MyImage = Resources.main }; UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName, new Version(Adapter.AssemblyVersion), Engine.ConfigUI.ReleaseChannel, Adapter.CheckProxySettings().GetWebProxy, nvwo); updateChecker.CheckUpdate(); string status; if (updateChecker.UpdateInfo.Status == UpdateStatus.UpdateCheckFailed) { status = "Update check failed"; } else { status = updateChecker.UpdateInfo.ToString(); } worker.ReportProgress(1, status); }
private long _dispose = 0; // To detect redundant calls public async Task DisposeAsync() { var compareRes = Interlocked.CompareExchange(ref _dispose, 1, 0); if (compareRes == 1) { while (Interlocked.Read(ref _dispose) != 2) { await Task.Delay(50); } return; } else if (compareRes == 2) { return; } try { await DisposeInWalletDependentServicesAsync(); if (UpdateChecker != null) { await UpdateChecker?.StopAsync(); Logger.LogInfo($"{nameof(UpdateChecker)} is stopped."); } if (FeeProviders != null) { FeeProviders.Dispose(); Logger.LogInfo($"Disposed {nameof(FeeProviders)}."); } if (Synchronizer != null) { await Synchronizer?.StopAsync(); Logger.LogInfo($"{nameof(Synchronizer)} is stopped."); } if (RpcFeeProvider != null) { await RpcFeeProvider.StopAsync(); Logger.LogInfo("Stopped synching fees through RPC."); } if (AddressManagerFilePath != null) { IoHelpers.EnsureContainingDirectoryExists(AddressManagerFilePath); if (AddressManager != null) { AddressManager?.SavePeerFile(AddressManagerFilePath, Config.Network); Logger.LogInfo($"{nameof(AddressManager)} is saved to `{AddressManagerFilePath}`."); } } if (Nodes != null) { Nodes?.Disconnect(); while (Nodes.ConnectedNodes.Any(x => x.IsConnected)) { await Task.Delay(50); } Nodes?.Dispose(); Logger.LogInfo($"{nameof(Nodes)} are disposed."); } if (RegTestMempoolServingNode != null) { RegTestMempoolServingNode.Disconnect(); Logger.LogInfo($"{nameof(RegTestMempoolServingNode)} is disposed."); } if (RpcMonitor != null) { await RpcMonitor.StopAsync(); Logger.LogInfo("Stopped monitoring RPC."); } if (Config.StopLocalBitcoinCoreOnShutdown && BitcoinCoreNode != null) { await BitcoinCoreNode.TryStopAsync().ConfigureAwait(false); } if (TorManager != null) { await TorManager?.StopAsync(); Logger.LogInfo($"{nameof(TorManager)} is stopped."); } if (AsyncMutex.IsAny) { try { await AsyncMutex.WaitForAllMutexToCloseAsync(); Logger.LogInfo($"{nameof(AsyncMutex)}(es) are stopped."); } catch (Exception ex) { Logger.LogError($"Error during stopping {nameof(AsyncMutex)}: {ex}"); } } } catch (Exception ex) { Logger.LogWarning(ex); } finally { Interlocked.Exchange(ref _dispose, 2); } }
internal GeneralSettingsViewModel(GlobalSettingsContainer globalSettingsContainer, UpdateChecker updateChecker, IBuildMonitorAdvanced buildMonitor) { this.globalSettingsContainer = globalSettingsContainer; GeneralSettings = this.globalSettingsContainer.GeneralSettings.Clone(); this.updateChecker = updateChecker; this.buildMonitor = buildMonitor; SaveCommand = new DelegateCommand(OnSave); }
private static bool CheckUpdate(UpdateChecker update, bool silent) { try { //MessageBox.Show(System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString()); update.CheckUpdates(); if (update.Result.ErrorOccurred) { if (!silent) { MessageBox.Show(update.Result.Error.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Console.Error.WriteLine($"ERROR : {update.Result.Error.ToString()}"); } return(false); } if (update.NeedUpdate()) { // Update available var result = update.Result; Dialog.DialogConfig dialogConfig = new Dialog.DialogConfig() { Button1 = Dialog.ButtonType.Custom1, CustomButton1Text = "Visit website", Button2 = Dialog.ButtonType.Custom2, CustomButton2Text = "Download and install", Button3 = Dialog.ButtonType.Cancel, Message = $"Update is available, do you want to download ?\nCurrent : {result.CurrentVersion}\nLast : {result.LastVersion}", Title = "Update available", }; var dialogResult = Dialog.ShowDialog(dialogConfig); if (dialogResult.DialogResult == Dialog.DialogResult.Custom1) { // Visit website result.OpenUpdateWebsite(); } else if (dialogResult.DialogResult == Dialog.DialogResult.Custom2) { return(true); } } else { if (!silent) { MessageBox.Show("No update avaiable", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Console.WriteLine("Already up to date"); } } } catch (Exception ex) { if (!silent) { MessageBox.Show($"Unknown error :\n{ex}\n\n{ex.StackTrace}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Console.Error.WriteLine($"UNKNWON ERROR :\n{ex}\n\n{ex.StackTrace}"); } } return(false); }
private void Main_Shown(object sender, EventArgs e) { if (auto) { auto = false; Run(); Close(); return; } updater = new UpdateChecker(this); updater.OnHasUpdate += HasUpdate; updater.Check(); }
private async void App_Startup(object sender, StartupEventArgs e) { var c = Config.Instance; c.SetStartup(c.IsStartupWithWindows); // WebBrowser のIEを最新版に指定する WebBrowserHelper.SetUseNewestWebBrowser(); await Task.WhenAll( ChatOverlaysController.Instance.StartAsync(), SharlayanController.Instance.StartAsync(), DiscordBotController.Instance.StartAsync(), Task.Run(() => { this.SetCredits(); HelpViewModel.Instance.OfficialSiteUri = new Uri(@"https://github.com/anoyetta/RINGS"); foreach (var asm in ReferenceAssemblies) { HelpViewModel.Instance.AddVersionInfos(asm); } HelpViewModel.Instance.GetReleaseChannelCallback = () => c.UpdateChannel; HelpViewModel.Instance.SetReleaseChannelCallback = value => c.UpdateChannel = value; })); AppLogger.Write("RINGS is chat communication enhancer for FFXIV, developed by anoyetta and best friends."); AppLogger.Write($"{c.AppNameWithVersion} Start."); #if DEBUG /* * new SandboxWindow().Show(); * WebViewOverlay.Instance.ShowUrl( * this.MainWindow, * @"https://www.jma.go.jp/jp/gms/imgs/0/infrared/1/201902251650-00.png"); */ #endif // アップデートを確認する UpdateChecker.ShutdownCallback = () => WPFHelper.Dispatcher.Invoke(() => this.CloseMainWindowCallback?.Invoke()); UpdateChecker.UpdateSourceUri = Config.Instance.UpdateSourceUri; UpdateChecker.LastUpdateCheckCallback = (lastUpdateTimestamp) => { Config.Instance.LastUpdateTimestamp = lastUpdateTimestamp; Config.Instance.Save(Config.FileName); }; await this.Dispatcher.InvokeAsync(async() => { await Task.Delay(TimeSpan.FromSeconds(0.1)); #if !DEBUG await UpdateChecker.IsUpdateAsync( Config.Instance.LastUpdateTimestamp, Config.Instance.UpdateChannel); #else #if false await UpdateChecker.IsUpdateAsync( Config.Instance.LastUpdateTimestamp, Config.Instance.UpdateChannel); #else // デバッグ用 // 強制的に最新バージョンを取得する await UpdateChecker.IsUpdateAsync( Config.Instance.LastUpdateTimestamp, Config.Instance.UpdateChannel, UpdateChecker.DefaultUpdateCheckInterval, true); #endif #endif }, DispatcherPriority.ApplicationIdle); // グローバルキーフックをセットする SharlayanController.SubscribeKeyHook(); }
/// <summary> /// Runs update checker /// </summary> /// <returns>True if there is an update, else false</returns> internal static bool RunUpdateChecker() { Log.Info("Launching UpdateChecker"); var uc = new UpdateChecker(); uc.ShowDialog(); Log.Info("UpdateChecker Done."); return uc.IsClosingDown; }
private void CheckForUpdates() { this.IsChecking = true; var checker = new UpdateChecker(this.UpdateChecked); checker.CheckForUpdates(); }