Skip to content

Commit 6ae08be

Browse files
authored
Merge pull request #3347 from mrixner/improve-icon-detection
2 parents 6bd2400 + 9d6c108 commit 6ae08be

File tree

1 file changed

+9
-4
lines changed
  • src/UniGetUI.PackageEngine.PackageManagerClasses/Packages

1 file changed

+9
-4
lines changed

src/UniGetUI.PackageEngine.PackageManagerClasses/Packages/Package.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,18 @@ public Package(
100100

101101
_iconId = Manager.Name switch
102102
{
103-
"Winget" => string.Join('.', id.ToLower().Split(".")[1..]),
103+
"Winget" => Source.Name switch
104+
{
105+
"Steam" => id.ToLower().Split("\\")[^1].Replace("steam app ", "steam:").Trim(),
106+
"Local PC" => id.ToLower().Split("\\")[^1],
107+
"Microsoft Store" => id.IndexOf('_') < id.IndexOf('.') ? // If the first underscore is before the period, this ID has no publisher
108+
string.Join('_', id.ToLower().Split("\\")[1].Split("_")[0..^4]) : // no publisher: remove `MSIX\`, then the standard ending _version_arch__{random id}
109+
string.Join('_', string.Join('.', id.ToLower().Split(".")[1..]).Split("_")[0..^4]), // remove the publisher (before the first .), then the standard _version_arch__{random id}
110+
_ => string.Join('.', id.ToLower().Split(".")[1..]),
111+
},
104112
"Scoop" => id.ToLower().Replace(".app", ""),
105113
"Chocolatey" => id.ToLower().Replace(".install", "").Replace(".portable", ""),
106114
"vcpkg" => id.ToLower().Split(":")[0].Split("[")[0],
107-
"Steam" => id.ToLower().Split("\\")[^1].Replace("Steam App", "steam:"),
108-
"Local PC" => id.ToLower().Split("\\")[^1],
109-
"Microsoft Store" => id.ToLower().Split(".")[1].Split("_")[0],
110115
_ => id.ToLower()
111116
};
112117
}

0 commit comments

Comments
 (0)