private async Task SearchForSuperMemo() { var smFilePaths = await SuperMemoFinderUtil.SearchSuperMemoInWindowsIndex(); SMExeSuggestedFilePaths.UnionWith(smFilePaths.Where(fp => fp.Exists()) .Select(fp => fp.FullPathWin)); }
public static bool ShouldFindSuperMemo(StartupCfg startupCfg, NativeDataCfg nativeDataCfg) { return(string.IsNullOrWhiteSpace(startupCfg.SMBinPath) || SuperMemoFinderUtil.CheckSuperMemoExecutable( nativeDataCfg, startupCfg.SMBinPath, out _, out _) == false); }
/// <inheritdoc /> public override void OnDisplayed() { if (SMExeSuggestedFilePaths == null) { SMExeFilePath = new SuperMemoFilePath(_startupCfg.SuperMemo.SMBinPath, _nativeDataCfg); SMExeSuggestedFilePaths = new ObservableHashSet <string>(SuperMemoFinderUtil.SearchSuperMemoInDefaultLocations() .Select(fp => fp.FullPathWin)); Task.Run(SearchForSuperMemo).RunAsync(); } }
public SuperMemoFinder(NativeDataCfg nativeDataCfg, StartupCfg startupCfg) { _nativeDataCfg = nativeDataCfg; _startupCfg = startupCfg; SMExeFilePath = new SuperMemoFilePath(startupCfg.SMBinPath, nativeDataCfg); SMExeSuggestedFilePaths = SuperMemoFinderUtil.SearchSuperMemoInDefaultLocations() .Select(fp => fp.FullPathWin) .ToHashSet(); AcceptCommand = new RelayCommand(Accept, CanAcceptExecute); BrowseCommand = new RelayCommand(Browse); BuildDescriptionText(); Task.Run(SearchForSuperMemo).RunAsync(); InitializeComponent(); }