Use audio display name if available
This commit is contained in:
parent
4ca0ad021f
commit
6aaa32cf92
@ -68,7 +68,14 @@ public class AudioHelper
|
|||||||
{
|
{
|
||||||
bestProcessMatch = audioProcess;
|
bestProcessMatch = audioProcess;
|
||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
|
|
||||||
|
if(string.IsNullOrEmpty(results.DisplayName))
|
||||||
|
{
|
||||||
|
session.GetDisplayName(out var displayName);
|
||||||
|
results.DisplayName = displayName;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//some apps like discord have multiple volume processes.
|
//some apps like discord have multiple volume processes.
|
||||||
//and some apps will be on multiple devices
|
//and some apps will be on multiple devices
|
||||||
|
@ -26,10 +26,13 @@ public class NameAndIconHelper
|
|||||||
var appx = AppxPackage.FromProcess(process);
|
var appx = AppxPackage.FromProcess(process);
|
||||||
if (appx == null)
|
if (appx == null)
|
||||||
{
|
{
|
||||||
//usingg process.MainModule.FileVersionInfo sometimes throws permission exceptions
|
//using process.MainModule.FileVersionInfo sometimes throws permission exceptions
|
||||||
//we get the file version info with a limited query flag to avoid that
|
//we get the file version info with a limited query flag to avoid that
|
||||||
var fileVersionInfo = GetFileVersionInfo(process);
|
var fileVersionInfo = GetFileVersionInfo(process);
|
||||||
|
|
||||||
|
//if the display name is already set, then it came from the display name of the audio session
|
||||||
|
if (string.IsNullOrEmpty(results.DisplayName))
|
||||||
|
{
|
||||||
results.DisplayName = process.MainWindowTitle;
|
results.DisplayName = process.MainWindowTitle;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(results.DisplayName))
|
if (string.IsNullOrEmpty(results.DisplayName))
|
||||||
@ -40,6 +43,7 @@ public class NameAndIconHelper
|
|||||||
results.DisplayName = process.ProcessName;
|
results.DisplayName = process.ProcessName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
results.ExecutablePath = fileVersionInfo?.FileName;
|
results.ExecutablePath = fileVersionInfo?.FileName;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user