mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-21 09:02:26 +08:00
26 lines
739 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
} |