mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Add reindex requirement for startup
This commit is contained in:
@@ -21,6 +21,8 @@ namespace Wox.Plugin.Program
|
||||
internal static UWP.Application[] _uwps { get; set; }
|
||||
internal static Settings _settings { get; set; }
|
||||
|
||||
private static bool IsStartupIndexProgramsRequired => _settings.LastReindexTime.AddDays(3) < DateTime.Today;
|
||||
|
||||
private static PluginInitContext _context;
|
||||
|
||||
private static BinaryStorage<Win32[]> _win32Storage;
|
||||
@@ -44,13 +46,13 @@ namespace Wox.Plugin.Program
|
||||
|
||||
var a = Task.Run(() =>
|
||||
{
|
||||
if (!_win32s.Any())
|
||||
if (IsStartupIndexProgramsRequired || !_win32s.Any())
|
||||
Stopwatch.Normal("|Wox.Plugin.Program.Main|Win32Program index cost", IndexWin32Programs);
|
||||
});
|
||||
|
||||
var b = Task.Run(() =>
|
||||
{
|
||||
if (!_uwps.Any())
|
||||
if (IsStartupIndexProgramsRequired || !_uwps.Any())
|
||||
Stopwatch.Normal("|Wox.Plugin.Program.Main|Win32Program index cost", IndexUWPPrograms);
|
||||
});
|
||||
|
||||
@@ -112,6 +114,8 @@ namespace Wox.Plugin.Program
|
||||
var t2 = Task.Run(() => { IndexUWPPrograms(); });
|
||||
|
||||
Task.WaitAll(t1, t2);
|
||||
|
||||
_settings.LastReindexTime = DateTime.Today;
|
||||
}
|
||||
|
||||
public Control CreateSettingPanel()
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Wox.Plugin.Program.Programs;
|
||||
|
||||
namespace Wox.Plugin.Program
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
public DateTime LastReindexTime { get; set; }
|
||||
public List<ProgramSource> ProgramSources { get; set; } = new List<ProgramSource>();
|
||||
public List<DisabledProgramSource> DisabledProgramSources { get; set; } = new List<DisabledProgramSource>();
|
||||
public string[] ProgramSuffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"};
|
||||
|
||||
Reference in New Issue
Block a user