Skip to content

Commit 4725b0d

Browse files
Implement object.Equals for uwp and win32
1 parent 85256ef commit 4725b0d

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,23 @@ public override string ToString()
761761
{
762762
return $"{DisplayName}: {Description}";
763763
}
764+
765+
public override bool Equals(object obj)
766+
{
767+
if (obj is Application other)
768+
{
769+
return UniqueIdentifier == other.UniqueIdentifier;
770+
}
771+
else
772+
{
773+
return false;
774+
}
775+
}
776+
777+
public override int GetHashCode()
778+
{
779+
return UniqueIdentifier.GetHashCode();
780+
}
764781
}
765782

766783
public enum PackageVersion

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,18 @@ public bool Equals([AllowNull] Win32 other)
586586
return UniqueIdentifier == other.UniqueIdentifier;
587587
}
588588

589+
public override bool Equals(object obj)
590+
{
591+
if (obj is Win32 other)
592+
{
593+
return UniqueIdentifier == other.UniqueIdentifier;
594+
}
595+
else
596+
{
597+
return false;
598+
}
599+
}
600+
589601
private static IEnumerable<string> GetStartMenuPaths()
590602
{
591603
var directory1 = Environment.GetFolderPath(Environment.SpecialFolder.Programs);

Plugins/Flow.Launcher.Plugin.Program/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class Settings
2020
/// </summary>
2121
public List<ProgramSource> DisabledProgramSources { get; set; } = new List<ProgramSource>();
2222

23-
[Obsolete, JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
23+
[Obsolete("Should use GetSuffixes() instead."), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2424
public string[] ProgramSuffixes { get; set; } = null;
2525
public string[] CustomSuffixes { get; set; } = Array.Empty<string>(); // Custom suffixes only
2626
public string[] CustomProtocols { get; set; } = Array.Empty<string>();

0 commit comments

Comments
 (0)