Files
SteamTools/System.Application.SteamTools.Client.Desktop/Extensions/ProcessExtensions.cs
T
2021-02-24 04:03:38 +08:00

26 lines
739 B
C#

using System.Application.Services;
using System.Diagnostics;
namespace System.Application.Extensions
{
/// <summary>
/// 为 <see cref="Process"/> 类型提供扩展方法
/// </summary>
public static class ProcessExtensions
{
/// <inheritdoc cref="IDesktopPlatformService.GetCommandLineArgs(Process)"/>
public static string GetCommandLineArgs(this Process process)
{
try
{
var p = DI.Get<IDesktopPlatformService>();
return p.GetCommandLineArgs(process);
}
catch (InvalidOperationException)
{
// 进程已退出。
return string.Empty;
}
}
}
}