Skip to content

Commit c6a47b0

Browse files
committed
add membernotnull attribute and small refactor
1 parent 281f4db commit c6a47b0

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using Flow.Launcher.Infrastructure.Storage;
2-
using Flow.Launcher.Plugin.Explorer.Helper;
1+
using Flow.Launcher.Plugin.Explorer.Helper;
32
using Flow.Launcher.Plugin.Explorer.Search;
43
using Flow.Launcher.Plugin.Explorer.Search.Everything;
5-
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
64
using Flow.Launcher.Plugin.Explorer.ViewModels;
75
using Flow.Launcher.Plugin.Explorer.Views;
86
using System;
97
using System.Collections.Generic;
108
using System.IO;
11-
using System.Linq;
129
using System.Threading;
1310
using System.Threading.Tasks;
1411
using System.Windows;
@@ -55,7 +52,7 @@ public Task InitAsync(PluginInitContext context)
5552
Settings.EverythingInstalledPath = s.Result;
5653
}, TaskScheduler.Default);
5754
}
58-
55+
5956
SortOptionTranslationHelper.API = context.API;
6057

6158
EverythingApiDllImport.Load(Path.Combine(Context.CurrentPluginMetadata.PluginDirectory, "EverythingSDK",

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Collections.Generic;
99
using System.Collections.ObjectModel;
1010
using System.Diagnostics;
11+
using System.Diagnostics.CodeAnalysis;
1112
using System.IO;
1213
using System.Linq;
1314
using System.Windows;
@@ -82,15 +83,21 @@ public EnumBindingModel<Settings.PathEnumerationEngineOption> SelectedPathEnumer
8283
}
8384
}
8485

86+
[MemberNotNull(nameof(IndexSearchEngines),
87+
nameof(ContentIndexSearchEngines),
88+
nameof(PathEnumerationEngines),
89+
nameof(_selectedIndexSearchEngine),
90+
nameof(_selectedContentSearchEngine),
91+
nameof(_selectedPathEnumerationEngine))]
8592
private void InitializeEngineSelection()
8693
{
8794
IndexSearchEngines = EnumBindingModel<Settings.IndexSearchEngineOption>.CreateList();
8895
ContentIndexSearchEngines = EnumBindingModel<Settings.ContentIndexSearchEngineOption>.CreateList();
8996
PathEnumerationEngines = EnumBindingModel<Settings.PathEnumerationEngineOption>.CreateList();
9097

91-
SelectedIndexSearchEngine = IndexSearchEngines.First(x => x.Value == Settings.IndexSearchEngine);
92-
SelectedContentSearchEngine = ContentIndexSearchEngines.First(x => x.Value == Settings.ContentSearchEngine);
93-
SelectedPathEnumerationEngine = PathEnumerationEngines.First(x => x.Value == Settings.PathEnumerationEngine);
98+
_selectedIndexSearchEngine = IndexSearchEngines.First(x => x.Value == Settings.IndexSearchEngine);
99+
_selectedContentSearchEngine = ContentIndexSearchEngines.First(x => x.Value == Settings.ContentSearchEngine);
100+
_selectedPathEnumerationEngine = PathEnumerationEngines.First(x => x.Value == Settings.PathEnumerationEngine);
94101
}
95102

96103
#endregion
@@ -99,6 +106,7 @@ private void InitializeEngineSelection()
99106

100107
#region ActionKeyword
101108

109+
[MemberNotNull(nameof(ActionKeywordsModels))]
102110
private void InitializeActionKeywordModels()
103111
{
104112
ActionKeywordsModels = new List<ActionKeywordModel>
@@ -307,7 +315,7 @@ internal static void OpenWindowsIndexingOptions()
307315
Process.Start(psi);
308316
}
309317

310-
private ICommand _openEditorPathCommand;
318+
private ICommand? _openEditorPathCommand;
311319

312320
public ICommand OpenEditorPath => _openEditorPathCommand ??= new RelayCommand(_ =>
313321
{
@@ -318,7 +326,7 @@ internal static void OpenWindowsIndexingOptions()
318326
EditorPath = path;
319327
});
320328

321-
private ICommand _openShellPathCommand;
329+
private ICommand? _openShellPathCommand;
322330

323331
public ICommand OpenShellPath => _openShellPathCommand ??= new RelayCommand(_ =>
324332
{

0 commit comments

Comments
 (0)