Implement object.Equals for uwp and win32

This commit is contained in:
Vic 2022-11-04 00:47:52 +08:00
parent 85256ef42f
commit 4725b0df07
3 changed files with 30 additions and 1 deletions

View file

@ -761,6 +761,23 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
return $"{DisplayName}: {Description}";
}
public override bool Equals(object obj)
{
if (obj is Application other)
{
return UniqueIdentifier == other.UniqueIdentifier;
}
else
{
return false;
}
}
public override int GetHashCode()
{
return UniqueIdentifier.GetHashCode();
}
}
public enum PackageVersion

View file

@ -586,6 +586,18 @@ namespace Flow.Launcher.Plugin.Program.Programs
return UniqueIdentifier == other.UniqueIdentifier;
}
public override bool Equals(object obj)
{
if (obj is Win32 other)
{
return UniqueIdentifier == other.UniqueIdentifier;
}
else
{
return false;
}
}
private static IEnumerable<string> GetStartMenuPaths()
{
var directory1 = Environment.GetFolderPath(Environment.SpecialFolder.Programs);

View file

@ -20,7 +20,7 @@ namespace Flow.Launcher.Plugin.Program
/// </summary>
public List<ProgramSource> DisabledProgramSources { get; set; } = new List<ProgramSource>();
[Obsolete, JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[Obsolete("Should use GetSuffixes() instead."), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[] ProgramSuffixes { get; set; } = null;
public string[] CustomSuffixes { get; set; } = Array.Empty<string>(); // Custom suffixes only
public string[] CustomProtocols { get; set; } = Array.Empty<string>();