From 332cdf695c605258f3c7e79ccc4639007f0465ec Mon Sep 17 00:00:00 2001 From: Keepoccino Date: Sat, 21 Aug 2021 17:41:39 +0200 Subject: [PATCH] Removed .exe file extension from app name --- MediaKeySyncServer/MediaControl.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MediaKeySyncServer/MediaControl.cs b/MediaKeySyncServer/MediaControl.cs index 4ecb973..95ce73f 100644 --- a/MediaKeySyncServer/MediaControl.cs +++ b/MediaKeySyncServer/MediaControl.cs @@ -59,7 +59,7 @@ public async void Next() public async Task Info() { - return new MediaProperties(await GetMediaProperties(session), session.SourceAppUserModelId); + return new MediaProperties(await GetMediaProperties(session), removeFileExtension(session.SourceAppUserModelId)); } private static async Task GetSystemMediaTransportControlsSessionManager() => @@ -67,6 +67,14 @@ private static async Task GetS private static async Task GetMediaProperties(GlobalSystemMediaTransportControlsSession session) => await session.TryGetMediaPropertiesAsync(); + + private string removeFileExtension(string filename) + { + var index = filename.LastIndexOf("."); + if (index > 0) + filename = filename.Substring(0, index); + return filename; + } } public class MediaChangeEventArgs : EventArgs