Review update

This commit is contained in:
Vic 2022-10-24 14:31:19 +08:00
parent 963c6eaae9
commit 31453e5942
3 changed files with 8 additions and 5 deletions

View file

@ -191,11 +191,11 @@ namespace Flow.Launcher.Plugin.Program
return;
if (_uwps.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
_uwps.FirstOrDefault(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)
_uwps.First(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)
.Enabled = false;
if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
_win32s.FirstOrDefault(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)
_win32s.First(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier)
.Enabled = false;
_settings.DisabledProgramSources.Add(new DisabledProgramSource(programToDelete));

View file

@ -19,12 +19,12 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
public string Location { get; set; }
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
public bool Enabled { get; set; } = true;
private string uid { get; set; }
/// <summary>
/// Guranteed lowercase.
/// Guaranteed lowercase.
/// </summary>
public string UniqueIdentifier { get => uid; set => uid = value.ToLowerInvariant(); }
private string uid { get; set; }
public ProgramSource() { } // only for json deserialization
@ -74,6 +74,8 @@ namespace Flow.Launcher.Plugin.Program.Views.Models
public class DisabledProgramSource : ProgramSource
{
public new bool Enabled { get; init; }
public DisabledProgramSource() { } // only for json deserialization
public DisabledProgramSource(string location) : base(location, false) { }

View file

@ -199,7 +199,8 @@ namespace Flow.Launcher.Plugin.Program.Views
{
foreach (string directory in directories)
{
if (Directory.Exists(directory) && !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == directory.ToLowerInvariant()))
if (Directory.Exists(directory)
&& !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier.Equals(directory, System.StringComparison.InvariantCultureIgnoreCase)))
{
var source = new ProgramSource(directory);