/// <summary> /// Checks if an update is available and tells main form. Launches deferred update check otherwise. /// </summary> private static void doCheckUpdate() { // Start deferred check - update info changes all the time AppUpdateChecker.UILang = "en"; // When we have UI lang settings, get this from ZD.Gui.AppSettings AppUpdateChecker.StartDeferredCheck(5000); // Any number of things can go wrong here. // If there's an exception, we just assume no update. try { // No update - done here. if (!UpdateInfo.UpdateAvailable) { return; } // Get details int vmaj, vmin; DateTime rdate; string rnotes; // This call, in particular, is allowed to throw if Update.xml's data does not verify UpdateInfo.GetUpdateInfo(out vmaj, out vmin, out rdate, out rnotes); // If update's version is equal to mine or smaller, then it's just data lingering around // from before last successful update Version myVer = Assembly.GetExecutingAssembly().GetName().Version; if (vmaj < myVer.Major || (vmaj == myVer.Major && vmin <= myVer.Minor)) { return; } // Tell form mf.SetWelcomeUpdate(vmaj, vmin, rdate, rnotes); } catch { } }
internal static void ShowInfo() { Console.Clear(); NConsole.Resize(ResultsWindowWidth, 30); var sb = new StringBuilder(); sb.AppendColor(ColorMain1, NAME_BANNER); sb.AppendLine(); /* * Author info */ sb.AppendLabelWithColor(ColorMain1, "Author", ColorMain2, Author).AppendLine(); sb.AppendLabelWithColor(ColorMain1, "Repo", ColorMain2, Repo).AppendLine(); sb.AppendLabelWithColor(ColorMain1, "Readme", ColorMain2, Readme).AppendLine(); sb.AppendLine(); /* * Config */ sb.Append(SearchConfig.Config); /* * Version info */ sb.AppendLine(); var versionsInfo = UpdateInfo.GetUpdateInfo(); sb.AppendLabelWithColor(ColorVersion, "Current version", ColorMain2, versionsInfo.Current).AppendLine(); sb.AppendLabelWithColor(ColorVersion, "Latest version", ColorMain2, versionsInfo.Latest.Version).AppendLine(); sb.AppendLabelWithColor(ColorVersion, "Version status", ColorMain2, versionsInfo.Status).AppendLine(); /* * Runtime info */ sb.AppendLine(); string appFolderName = new DirectoryInfo(AppFolder).Name; var exeFolderName = new DirectoryInfo(ExeLocation).Name; sb.AppendLabelWithColor(ColorUtility, "Application folder", ColorMain2, appFolderName).AppendLine(); sb.AppendLabelWithColor(ColorUtility, "Executable location", ColorMain2, exeFolderName).AppendLine(); sb.AppendLabelWithColor(ColorUtility, "Context menu integrated", ColorMain2, Integration.IsContextMenuAdded).AppendLine(); sb.AppendLabelWithColor(ColorUtility, "In path", ColorMain2, IsAppFolderInPath).AppendLine(); /* * Dependencies */ // sb.AppendLine("Dependencies:"); // // var dependencies = RuntimeInfo.DumpDependencies(); // // foreach (var name in dependencies) { // sb.AppendColor(ColorMisc,$"{name.Name!} ({name.Version!})").AppendLine(); // } NConsole.Write(sb); }