Skip to content

Commit 2678a68

Browse files
committed
Merge branch 'use-const-strings-for-settings-names' of https://github.com/marticliment/UniGetUI into use-const-strings-for-settings-names
2 parents 393f97e + 1d972c3 commit 2678a68

2 files changed

Lines changed: 114 additions & 33 deletions

File tree

WebBasedData/screenshot-database-v2.json

Lines changed: 88 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"package_count": {
3-
"total": 11826,
4-
"done": 5310,
5-
"packages_with_icon": 5310,
6-
"packages_with_screenshot": 667,
7-
"total_screenshots": 2072
3+
"total": 11833,
4+
"done": 5322,
5+
"packages_with_icon": 5322,
6+
"packages_with_screenshot": 677,
7+
"total_screenshots": 2105
88
},
99
"icons_and_screenshots": {
1010
"__test_entry_DO_NOT_EDIT_PLEASE": {
@@ -12952,8 +12952,12 @@
1295212952
"images": []
1295312953
},
1295412954
"electronmail": {
12955-
"icon": "",
12956-
"images": []
12955+
"icon": "https://i.postimg.cc/zB1h53ds/image.png",
12956+
"images": [
12957+
"https://i.postimg.cc/jdRhP34p/image.png",
12958+
"https://i.postimg.cc/BZHhxK9K/image.png",
12959+
"https://i.postimg.cc/VkG4Y9M3/image.png"
12960+
]
1295712961
},
1295812962
"electrum": {
1295912963
"icon": "https://community.chocolatey.org/content/packageimages/electrum.portable.4.3.4.png",
@@ -23350,8 +23354,12 @@
2335023354
"images": []
2335123355
},
2335223356
"listary": {
23353-
"icon": "https://community.chocolatey.org/content/packageimages/Listary.6.0.11.35.png",
23354-
"images": []
23357+
"icon": "https://i.postimg.cc/2SxZ7C2m/Listary.png",
23358+
"images": [
23359+
"https://i.postimg.cc/L8vJZN88/image.png",
23360+
"https://i.postimg.cc/NfcFJWy0/image.png",
23361+
"https://i.postimg.cc/C1CTz6wv/image.png"
23362+
]
2335523363
},
2335623364
"listdlls": {
2335723365
"icon": "",
@@ -32464,24 +32472,34 @@
3246432472
"images": []
3246532473
},
3246632474
"proton": {
32467-
"icon": "",
32468-
"images": []
32475+
"icon": "https://i.postimg.cc/Wp5VcCz8/image.png",
32476+
"images": [
32477+
"https://i.postimg.cc/KzFbmytq/image.png"
32478+
]
3246932479
},
3247032480
"protonclient": {
32471-
"icon": "",
32472-
"images": []
32481+
"icon": "https://i.postimg.cc/0yQbq79M/image.png",
32482+
"images": [
32483+
"https://i.postimg.cc/gcVwyYMJ/image.png"
32484+
]
3247332485
},
3247432486
"protonmail-bridge": {
3247532487
"icon": "",
3247632488
"images": []
3247732489
},
3247832490
"protonmailbridge": {
3247932491
"icon": "https://community.chocolatey.org/content/packageimages/protonmailbridge.3.0.17.png",
32480-
"images": []
32492+
"images": [
32493+
"https://i.postimg.cc/QC1c11Fx/image.png",
32494+
"https://i.postimg.cc/fTQcZ2P3/image.png",
32495+
"https://i.postimg.cc/XvP5PQFY/image.png"
32496+
]
3248132497
},
3248232498
"protonvpn": {
3248332499
"icon": "https://community.chocolatey.org/content/packageimages/protonvpn.2.3.2.png",
3248432500
"images": [
32501+
"https://i.postimg.cc/GphzR864/image.png",
32502+
"https://i.postimg.cc/x8Sz0Bq6/image.png",
3248532503
"https://i.postimg.cc/2yQBsfSF/windows-ovpn-9-1024x616.png"
3248632504
]
3248732505
},
@@ -49955,7 +49973,7 @@
4995549973
"https://paulstsmith.github.io/images/netextender-screenShot-disconnected.png"
4995649974
]
4995749975
},
49958-
"beyondcompare-5": {
49976+
"beyondcompare.5": {
4995949977
"icon": "https://www.scootersoftware.com/bc_icon.png",
4996049978
"images": [
4996149979
"https://www.scootersoftware.com/shot_FolderCompare_Dark.png",
@@ -50013,15 +50031,15 @@
5001350031
]
5001450032
},
5001550033
"archivepassword": {
50016-
"icon": "",
50034+
"icon": "https://i.postimg.cc/SQPYg2yy/ARCHPR.png",
5001750035
"images": [
5001850036
"https://i.postimg.cc/8zmM3pwy/image.png",
5001950037
"https://i.postimg.cc/0jSJCPb0/image.png",
5002050038
"https://i.postimg.cc/FsjLdFt9/image.png"
5002150039
]
5002250040
},
5002350041
"sagepassword": {
50024-
"icon": "",
50042+
"icon": "https://i.postimg.cc/pdBnCsd7/asapr.png",
5002550043
"images": [
5002650044
"https://i.postimg.cc/hv2NpW6h/image.png"
5002750045
]
@@ -50049,6 +50067,59 @@
5004950067
"sysinternals-zoomIt": {
5005050068
"icon": "https://i.postimg.cc/hjPX2PL9/ZoomIt.png",
5005150069
"images": []
50070+
},
50071+
"rightnote": {
50072+
"icon": "https://i.postimg.cc/mZj8kSNm/Right-Note.png",
50073+
"images": [
50074+
"https://i.postimg.cc/Jhs9c2K7/image.png",
50075+
"https://i.postimg.cc/52sVmvVg/image.png",
50076+
"https://i.postimg.cc/QdyztqD2/image.png",
50077+
"https://i.postimg.cc/9MGgL592/image.png",
50078+
"https://i.postimg.cc/4N42Q0xC/image.png",
50079+
"https://i.postimg.cc/g0hg0FNh/image.png"
50080+
]
50081+
},
50082+
"protonmail": {
50083+
"icon": "https://i.postimg.cc/zGYnzbHJ/protonmail.png",
50084+
"images": [
50085+
"https://i.postimg.cc/zB6G5QXV/image.png",
50086+
"https://i.postimg.cc/SN3gWxX5/mail.png",
50087+
"https://i.postimg.cc/P51QYznp/image.png",
50088+
"https://i.postimg.cc/XvFmZyQQ/image.png"
50089+
]
50090+
},
50091+
"protonpass": {
50092+
"icon": "https://i.postimg.cc/8PvZmf2v/protonpass.png",
50093+
"images": [
50094+
"https://i.postimg.cc/cLh16CLq/image.png",
50095+
"https://i.postimg.cc/sDrN8Xfh/image.png",
50096+
"https://i.postimg.cc/htCZf1LL/image.png",
50097+
"https://i.postimg.cc/y8qY20gT/image.png",
50098+
"https://i.postimg.cc/sDb98H40/image.png",
50099+
"https://i.postimg.cc/nLG4XFb6/image.png"
50100+
]
50101+
},
50102+
"protondrive": {
50103+
"icon": "https://i.postimg.cc/RZpFXq57/Proton-Drive.png",
50104+
"images": [
50105+
"https://i.postimg.cc/MGtwZFtz/image.png",
50106+
"https://i.postimg.cc/HxBPyG7k/image.png",
50107+
"https://i.postimg.cc/W3b5j9fL/image.png"
50108+
]
50109+
},
50110+
"sketchup-2022": {
50111+
"icon": "https://i.postimg.cc/259Fnnxn/sketchup.png",
50112+
"images": []
50113+
},
50114+
"sketchup-2023": {
50115+
"icon": "https://i.postimg.cc/259Fnnxn/sketchup.png",
50116+
"images": []
50117+
},
50118+
"sketchup-2025": {
50119+
"icon": "https://i.postimg.cc/259Fnnxn/sketchup.png",
50120+
"images": [
50121+
"https://i.postimg.cc/yxZwM1Nr/image.png"
50122+
]
5005250123
}
5005350124
}
5005450125
}

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

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,7 @@ public Package(
9898

9999
ignoredId = IgnoredUpdatesDatabase.GetIgnoredIdForPackage(this);
100100

101-
_iconId = Manager.Name switch
102-
{
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-
},
112-
"Scoop" => id.ToLower().Replace(".app", ""),
113-
"Chocolatey" => id.ToLower().Replace(".install", "").Replace(".portable", ""),
114-
"vcpkg" => id.ToLower().Split(":")[0].Split("[")[0],
115-
_ => id.ToLower()
116-
};
101+
_iconId = GenerateIconId(this);
117102
}
118103

119104
/// <summary>
@@ -334,6 +319,31 @@ public static void ResetIconCache()
334319
{
335320
_cachedIconPaths.Clear();
336321
}
322+
323+
private static string GenerateIconId(Package p)
324+
{
325+
return (p.Manager.Name switch
326+
{
327+
"Winget" => p.Source.Name switch
328+
{
329+
"Steam" => p.Id.ToLower().Split("\\")[^1].Replace("steam app ", "steam-").Trim(),
330+
"Local PC" => p.Id.Split("\\")[^1],
331+
"Microsoft Store" => p.Id.IndexOf('_') < p.Id.IndexOf('.')
332+
? // If the first underscore is before the period, this ID has no publisher
333+
string.Join('_', p.Id.Split("\\")[1].Split("_")[0..^4])
334+
: // no publisher: remove `MSIX\`, then the standard ending _version_arch__{random p.Id}
335+
string.Join('_',
336+
string.Join('.', p.Id.Split(".")[1..])
337+
.Split("_")
338+
[0..^4]), // remove the publisher (before the first .), then the standard _version_arch__{random p.Id}
339+
_ => string.Join('.', p.Id.Split(".")[1..]),
340+
},
341+
"Scoop" => p.Id.Replace(".app", ""),
342+
"Chocolatey" => p.Id.Replace(".install", "").Replace(".portable", ""),
343+
"vcpkg" => p.Id.Split(":")[0].Split("[")[0],
344+
_ => p.Id
345+
}).ToLower().Replace('_', '-').Replace('.', '-').Replace(' ', '-').Replace('/', '-').Replace(',', '-');
346+
}
337347
}
338348
}
339349

0 commit comments

Comments
 (0)