//检查更新 private void UpdateToolStripMenuItem_Click(object sender, EventArgs e) { try { _checkUpdate = new CheckUpdate(); if (_checkUpdate.IsConnectedInternet()) { if (_checkUpdate.Download()) { if (_checkUpdate.HasNewVersion()) { form_Update = UpdateForm.GetInstance(_checkUpdate.NewVersion); form_Update.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper); form_Update.ShowForm(); } else//HasNewVersion() { MessageBox.Show("已经是最新版本"); } } else//Download() { MessageBox.Show("已经是最新版本"); } } else//IsConnectedInternet() { MessageBox.Show("本机没有连接互联网"); } } catch (Exception ex) { log.WriteLog(ex.ToString()); } }
//检查更新 private void UpdateMenuItem_Click(object sender, EventArgs e) { try { check = new CheckUpdate(); if (check.IsConnectedInternet()) { if (check.Download()) { if (check.HasNewVersion()) { updateForm = UpdateForm.GetInstance(check.NewVersion); updateForm.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper); updateForm.ShowForm(); } else//HasNewVersion() { MessageBox.Show("已经是最新版本"); } } else//Download() { MessageBox.Show("已经是最新版本"); } } else//IsConnectedInternet() { MessageBox.Show("本机没有连接互联网"); } } catch { } }
private void checkForUpdateLabel_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { try { var result = CheckUpdate.Run(SB.updateUrl); if (result.Update) { var notesWindow = new NotesWindow() { DontShowMainWindow = true, SBUrl = result.Url, }; notesWindow.titleLabel.Content += " " + result.Version; for (var i = 0; i < result.Notes.Count; i++) { notesWindow.richTextBox.AppendText(result.Notes[i].Note + "\n"); } notesWindow.Show(); } else { MessageBox.Show("there are currently no updates available", "SilverBullet", MessageBoxButton.OK, MessageBoxImage.Information); } } catch { } }
private void checkUpdateToolStripMenuItem_Click(object sender, EventArgs e) { CheckUpdate.ReturnIfSame = true; checkUpdateToolStripMenuItem.Image = CheckUpdate.CheckIt(); CheckUpdate.ReturnIfSame = false; //checkUpdateToolStripMenuItem.Image = CheckUpdate.IcoUpdate; }
//检查更新 private void CheckNewVersion_Tick(object sender, EventArgs e) { try { _checkUpdate = new CheckUpdate(); if (_checkUpdate.IsConnectedInternet()) { if (_checkUpdate.Download()) { if (_checkUpdate.HasNewVersion()) { form_Update = UpdateForm.GetInstance(_checkUpdate.NewVersion); form_Update.CloseHandlor += new UpdateForm.CloseHandler(CloseDeskHelper); form_Update.ShowForm(); } } } } catch (Exception ex) { log.WriteLog(ex.ToString()); } finally { updateTimer.Enabled = false; } }
public void CheckForUpdate() { try { Dispatcher.Invoke(() => richTextBox.Document.Blocks.Clear()); Dispatcher.Invoke(() => richTextBoxDonate.Document.Blocks.Clear()); var result = CheckUpdate.Run <SBUpdate>(); var releasesLatest = CheckUpdate.Run <Release>("https://api.github.com/repos/mohamm4dx/SilverBullet/releases/latest"); if (releasesLatest.Assets != null && releasesLatest.Assets.Length > 0) { result.DownloadUrl = releasesLatest.Assets.First().Browser_Download_Url; } result.Available = releasesLatest.Available; releasesLatest.Body.Split('\n') .ToList().ForEach(re => { re = re.Replace("•", string.Empty) .Replace("•", string.Empty).Trim(); if (result.ReleaseNotes.Any(r => r.Note.Trim() .Replace("•", string.Empty) .Replace("•", string.Empty) != re)) { result.ReleaseNotes.Add(new ReleaseNotes() { Note = re }); } }); Dispatcher.Invoke(() => DataContext = result); try { for (var i = 0; i < result.Donate.Length; i++) { Dispatcher.Invoke(() => AppendParagraph(richTextBoxDonate, new[] { result.Donate[i].Address })); } } catch { } if (result.Available) { try { for (var i = 0; i < result.ReleaseNotes.Count; i++) { Dispatcher.Invoke(() => AppendParagraph(richTextBox, new[] { result.ReleaseNotes[i].Note })); } } catch { } if (!string.IsNullOrWhiteSpace(result.Message)) { Dispatcher.Invoke(() => CustomMsgBox.Show(result.Message)); } } else { Dispatcher.Invoke(() => CustomMsgBox.Show("there are currently no updates available")); } } catch { } }
public QuickForm() { InitializeComponent(); boLoSearch = new BoLoSearch.BoLoSearch(); SetStartup(_settings.LaunchOnStartup); update = new CheckUpdate(_settings); AddTrayIcons(); mouseHook.MouseDown += new MouseEventHandler((s, e) => { AddMouseEvent("MouseDown", e.Button.ToString(), e.X, e.Y, ""); }); mouseHook.MouseUp += new MouseEventHandler((s, e) => { AddMouseEvent("MouseUp", e.Button.ToString(), e.X, e.Y, ""); }); mouseHook.MouseWheel += new MouseEventHandler((s, e) => { AddMouseEvent("MouseWheel", "", -1, -1, e.Delta.ToString()); }); mouseHook.Start(); keyboardHook.KeyDown += new KeyEventHandler((s, e) => { KeyboardEvent("KeyDown", e.KeyCode.ToString(), "", e.Shift.ToString(), e.Alt.ToString(), e.Control.ToString()); }); keyboardHook.KeyUp += new KeyEventHandler((s, e) => { KeyboardEvent("KeyUp", e.KeyCode.ToString(), "", e.Shift.ToString(), e.Alt.ToString(), e.Control.ToString()); }); keyboardHook.KeyPress += new KeyPressEventHandler((s, e) => { KeyboardEvent("KeyPress", "", e.KeyChar.ToString(), "", "", ""); }); keyboardHook.Start(); // 自定义关机和logoff的事件 Microsoft.Win32.SystemEvents.SessionEnding += SessionEndingEvent; UpTimer.Enabled = true; UpTimer.Start(); CreateFile(); _trayIcon.Icon = _settings.aiTranslate ? Resources.favicon_open : Resources.favicon_close; registerCom(true); Thread thread_update = new Thread(UpdateCheck); thread_update.IsBackground = true; thread_update.Start(); }
private void UpdateInfo_Click(object sender, EventArgs e) { if (IsInternetAvailable()) { CheckUpdate update = new CheckUpdate(); MessageBox.Show(update.GetChangeLog(), "О обновлении", MessageBoxButtons.OK); } }
/// <summary> /// UpdateTTL is used to update the TTL of a check /// </summary> /// <param name="checkID">The check ID</param> /// <param name="output">An optional, arbitrary string to write to the check status</param> /// <param name="status">The state to set the check to</param> /// <returns>An empty write result</returns> public Task <WriteResult> UpdateTTL(string checkID, string output, TTLStatus status, CancellationToken ct = default(CancellationToken)) { var u = new CheckUpdate { Status = status.Status, Output = output }; return(_client.Put(string.Format("/v1/agent/check/update/{0}", checkID), u).Execute(ct)); }
public void AllFilesAreTheSameLastWriteTime() { // Arrange var target = new CheckUpdate(); // Act var result = target.Run(SourceDirPath, InstallDirPath, new List <string>()); // Assert Assert.AreEqual(ResultCode.Success, result.ResultCode); Assert.IsFalse(result.Updated); }
private void Init() { CheckUpdate.Auto(); HiyobiTags.LoadTags(); this.MinWidth = 300; Global.MainWindow = this; string[] args = Environment.GetCommandLineArgs(); bool relative = false; for (int i = 0; i < args.Length; i++) { string arg = args[i]; if (arg == "/p" && args.Length - 1 > i) { if (relative) { path = Path.Combine(rootDir, args[i + 1]); } else { path = args[i + 1]; } } if (arg == "/r") { relative = true; } } if (path == string.Empty) { path = Path.Combine(rootDir, "hitomi_downloaded"); } else { if (relative) { path = Path.Combine(rootDir, path); } } if (!Directory.Exists(path)) { Console.WriteLine("Invaild Path"); path = Path.Combine(rootDir, "hitomi_downloaded"); } SearchMode1.SelectedIndex = 0; SetFolderSort(FolderSorts.Name); if (Global.Password == null) { Encrypt.Visibility = Visibility.Collapsed; Decrypt.Visibility = Visibility.Collapsed; } }
private void CheckUpdateFunc(bool show = false) { CheckUpdate update = new CheckUpdate(); var text = update.CheckProgramUpdate(); var version = update.GetVersion().Replace("\n", string.Empty); DialogResult updateResult; if (String.Equals(version, Application.ProductVersion)) { if (show) { MessageBox.Show(text + "\n\r\n\rОбновление не требуется.", "Обновление", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { updateResult = MessageBox.Show(text + "\n\r\n\rТребуется обновление. Обновить ПО?", "Обновление", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (updateResult == DialogResult.Yes) { bool notSaveTables = false; foreach (MarksTable table in tables) { if (table.startEdit) { notSaveTables = true; } } DialogResult saveTables = DialogResult.No; if (notSaveTables) { saveTables = MessageBox.Show("У вас есть не сохранённые таблицы, сохранить?", "Сохранить?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); } if (saveTables == DialogResult.Yes) { Dnevnik_FormClosing(null, null); } Properties.Settings.Default.change_log = false; Properties.Settings.Default.Save(); update.UpdateProgram(Status, loadBar, LabelLoad); } } }
public MainWindow() { InitializeComponent(); instances = InitializeInstances(); Xml xml = new Xml(); ShortCut.init_shortcut(Strings.title); xml.Init_xml(); CheckUpdate.init_checkUpdate(); Init_minimize(); ModeCheck(); this.Descript_text.Text = Strings.title + " v" + ShortCut.myVersion; }
public void AllFilesAreDifferentLastWriteTime() { // Arrange SourceDirPath.ToDirectoryPath().SetLastWriteTimeToAllFiles(UpdateDateTime2); var target = new CheckUpdate(); // Act var result = target.Run(SourceDirPath, InstallDirPath, new List <string>()); // Assert Assert.AreEqual(ResultCode.Success, result.ResultCode); Assert.IsTrue(result.Updated); }
private static void Main() { //Add the exception dialog to our solution new UnhandledExceptionDlg { RestartApp = false }; //Windows stuff Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CheckDotNet(); CheckUpdate.CheckForUpdate(); var executableFileInfo = new FileInfo(Application.ExecutablePath); string executableDirectoryName = executableFileInfo.DirectoryName; string ourDirectory = executableDirectoryName; if (!Directory.Exists(ourDirectory + "\\Logs")) { Directory.CreateDirectory(ourDirectory + "\\Logs"); } if (File.Exists(ourDirectory + "\\Logs\\OldLogFile.txt")) { File.Delete(ourDirectory + "\\Logs\\OldLogFile.txt"); } if (File.Exists(ourDirectory + "\\Logs\\LogFile.txt")) { File.Move(ourDirectory + "\\Logs\\LogFile.txt", ourDirectory + "\\Logs\\OldLogFile.txt"); } LazyForms.Load(); //Load license settings //Start update check // var check = new Thread(CheckUpdate.CheckForUpdate) {IsBackground = true}; // check.Start(); //Start license check LazySettings.LoadSettings(); ReloggerSettings.LoadSettings(); if (LazySettings.FirstRun) { new Wizard().ShowDialog(); } //Lets spawn the selector and wait for it to return before starting the bot var selector = new Selector(); selector.ShowDialog(); //If the user closed the bot or the process does not exist - close if (AttachTo == 0) { Environment.Exit(0); } Application.Run(LazyForms.MainForm); }
private void MainForm_Shown(object sender, EventArgs e) { FileInfo IfExist = new FileInfo(ConfigReaderWriter.CONFIG_FILE); DirectoryInfo DirExist = new DirectoryInfo(IfExist.DirectoryName); if (!(DirExist.Exists)) { DirExist.Create(); } FontSkinManager(); if (!(IfExist.Exists)) { Setting Frm = new Setting(); Frm.ShowDialog(this); } VarGlobale.LoadParam(); if (string.IsNullOrEmpty(VarGlobal.Password) == true) { Setting Frm = new Setting(); Frm.ShowDialog(this); } CmBxPrjName.Items.Clear(); CmBxPrjName.Items.AddRange(VarGlobale.SubProject.ToArray()); CmBxPrjName.Text = VarGlobal.PrefixUserName; if (VarGlobale.AutoCheckUpdate == true) { checkUpdateToolStripMenuItem.Image = CheckUpdate.CheckIt(); //checkUpdateToolStripMenuItem.Image = CheckUpdate.IcoUpdate; } try { if (File.Exists(VarGlobale.BookMarks)) { CmBxPrjName.AutoCompleteCustomSource = (AutoCompleteStringCollection) GenericXmlSerializer.Deserialize(VarGlobale.BookMarks, CmBxPrjName.AutoCompleteCustomSource.GetType()); foreach (string item in CmBxPrjName.AutoCompleteCustomSource) { AddABookmark(item); } } } catch (Exception Ex) { if (!VarGlobal.LessVerbose) { Console.WriteLine("{0}{1}{2}", Ex.Message, Environment.NewLine, Ex.StackTrace); } } }
void MenuCheckUpdate_Click_1(object sender, EventArgs e) { if (CheckUpdateForm != null && !CheckUpdateForm.IsDisposed) { CheckUpdateForm.Activate(); CheckUpdateForm.MoveToCenterScreen(); } else { CheckUpdateForm = new CheckUpdate(); CheckUpdateForm.MoveToCenterScreen(); CheckUpdateForm.Show(this); } }
private void CheckingUpdate(CheckUpdate checkUpdate) { updateChecker = checkUpdate(); try { UpdateControls(); } catch { } isBusy = false; }
public void CheckUpdate(CheckUpdate checkUpdate) { if (!isBusy) { isBusy = true; lblStatus.Visible = false; llblUpdateAvailable.Visible = false; pbLoading.Visible = true; lblCheckingUpdates.Visible = true; new Thread(() => CheckingUpdate(checkUpdate)).Start(); } }
private void ChangeLog() { if (Properties.Settings.Default.change_log) { if (IsInternetAvailable()) { CheckUpdate update = new CheckUpdate(); MessageBox.Show(update.GetChangeLog(), "О обновлении", MessageBoxButtons.OK); } Properties.Settings.Default.change_log = false; Properties.Settings.Default.Save(); } }
public MainController(LauncherConfig config, LauncherContainer container) { this.config = config; //Dependency service = new DownloadFileServiceImpl(config); dataSource = new WebClientDataSource(config); repository = new LauncherRepositoryImpl(dataSource, service, config); //UseCases checkUpdate = new CheckUpdateImpl(repository); openLink = new OpenLinkImpl(); startGame = new StartGameImpl(repository); Container = container; }
public void OneOfTheFileIsUpdated() { // Arrange var updatedFilePath = Path.Combine(SourceDirPath, "a.txt"); File.SetLastWriteTime(updatedFilePath, UpdateDateTime2); var target = new CheckUpdate(); // Act var result = target.Run(SourceDirPath, InstallDirPath, new List <string>()); // Assert Assert.AreEqual(ResultCode.Success, result.ResultCode); Assert.IsTrue(result.Updated); }
private static void Update() { if (CheckUpdate.isNewVersionAvaiable() == 1 && !newUpdateHasBeenShow && CheckUpdate.MessageShow) { string version = CheckUpdate.newVersion.ToString(); Game.DisplayNotification("[~b~Police~s~Life~r~S~s~]: New Version (~r~" + version + "~w~) is available, New features are waiting for you"); newUpdateHasBeenShow = true; } else if (CheckUpdate.isNewVersionAvaiable() == 2 && !newUpdateHasBeenShow && CheckUpdate.MessageShow) { string version = CheckUpdate.minVersion.ToString(); Game.LogTrivial("PoliceLifeS: minimum Version (" + version + ") required!"); Game.DisplayNotification("[~b~Police~s~Life~r~S~s~]: Not loaded minimum Version: (~r~" + version + "~w~) required, please Update now!"); newUpdateHasBeenShow = true; } }
public UpdateInfoForm(bool _Exist, CheckUpdate _check) { InitializeComponent(); NewVersion = _Exist; check = _check; if (!File.Exists(@"C:\Program Files\菠萝工具箱\UpdateDetail.html")) { byte[] readme_bytes = Resources.readme; //创建一个文件流 FileStream fsreadme = new FileStream(@"C:\Program Files\菠萝工具箱\UpdateDetail.html", FileMode.Create); //将byte数组写入文件中 fsreadme.Write(readme_bytes, 0, readme_bytes.Length); //所有流类型都要关闭流,否则会出现内存泄露问题 fsreadme.Close(); } }
public MainWindow() { InitializeComponent(); ShortCut.init_shortcut("AntiRecall"); ShortCut.init_xml(); CheckUpdate.init_checkUpdate(); init_minimize(); if (ShortCut.CheckXml()) { QQPath.Text = ShortCut.QueryXml("QQPath"); PortText.Text = ShortCut.QueryXml("PortText"); } else { ShortCut.CreateXml(ShortCut.antiRElement); } }
public static void CheckVersion(bool showNew) { string newver = CheckUpdate.GetNewVersion(MyConfig.ReadString(MyConfig.TAG_UPDATE_URL)); if (newver == CheckUpdate.DEFAULT) { //检查失败 if (!showNew) { return; } MyMsg.Error(LMSG.CheckUpdateFail); return; } if (CheckUpdate.CheckVersion(newver, Application.ProductVersion)) {//有最新版本 if (!MyMsg.Question(LMSG.HaveNewVersion)) { return; } } else {//现在就是最新版本 if (!showNew) { return; } if (!MyMsg.Question(LMSG.NowIsNewVersion)) { return; } } //下载文件 if (CheckUpdate.DownLoad( MyPath.Combine(Application.StartupPath, newver + ".zip"))) { MyMsg.Show(LMSG.DownloadSucceed); } else { MyMsg.Show(LMSG.DownloadFail); } }
private void notifyIcon1_DoubleClick(object sender, EventArgs e) { if (_hasUpdate) { CheckUpdate.Upgrade(); } else if (DokanInit.IsWorking()) { System.Diagnostics.Process.Start("explorer", Default.MountPoint + @":\\"); } else { IsVisibilityChangeAllowed = true; Show(); WindowState = FormWindowState.Normal; Focus(); } }
public void UserFilesAreUpdate() { // Arrange var userDataFilePath = Path.Combine(InstallDirPath, UserDataDirFolderName, "u_a.txt"); File.SetLastWriteTime(userDataFilePath, UpdateDateTime2); var target = new CheckUpdate(); // Act var result = target.Run( SourceDirPath, InstallDirPath, new List <string> { UserDataDirFolderName + @"\\" + @".*" }); // Assert Assert.AreEqual(ResultCode.Success, result.ResultCode); Assert.IsFalse(result.Updated); }
/* * private void UpdateCount() * { * Regex re = new Regex("\\[\\d*\\]"); #if DEBUG * Console.WriteLine(count); #endif * Recall_Text.Text = re.Replace(Recall_Text.Text, "["+Convert.ToString(Math.Ceiling(count / 8))+"]"); * } * * public void ModifyRecallCount() * { * Recall_Text.Dispatcher.Invoke( * System.Windows.Threading.DispatcherPriority.Normal, * new TextChanger(UpdateCount)); * }*/ public MainWindow() { InitializeComponent(); ShortCut.init_shortcut("AntiRecall"); Xml.init_xml(); CheckUpdate.init_checkUpdate(); init_minimize(); if (Xml.CheckXml()) { Xml.antiRElement["PortText"] = Xml.QueryXml("PortText"); Xml.antiRElement["QQPath"] = Xml.QueryXml("QQPath"); Xml.antiRElement["Mode"] = Xml.QueryXml("Mode"); PortText.Text = Xml.antiRElement["PortText"]; } else { Xml.CreateXml(Xml.antiRElement); } ModeCheck(); this.Descript_text.Text = Xml.antiRElement["Descript"]; }
private void Awake() { _instance = this; // 检测是否有ab包更新 downloadPath = PathUtil.GetAssetBundlePath(); // 检测资源更新 checkRes = new CheckUpdate(StartGame); checkRes.DownLoadVersionFile(); //StartCoroutine(DownLoadRes(() => //{ // UIMgr.InitializeUISystem(); // Game.UIMgr.PushScene(UIPage.LoginPage); // // 资源更新完后 , 去加载Manifest文件 // StartCoroutine(LoadManifest.Instance.LoadAssetBundleManifest()); //})); }
private void CheckingUpdate(CheckUpdate checkUpdate) { updateChecker = checkUpdate(); UpdateControls(); isBusy = false; }