mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-22 01:16:17 +08:00
27 lines
769 B
C#
27 lines
769 B
C#
using System.Application.Services;
|
|
using System.Diagnostics;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace System.Application
|
|
{
|
|
/// <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;
|
|
}
|
|
}
|
|
}
|
|
} |