Files
cefsharp/CefSharp/Internals/CommandLineArgsParser.cs
T
amaitland a8ff890433 Always pass through Process Id to subprocess
Improve command line parsing

Partial import of changes from #2375
2018-04-30 14:21:20 +10:00

32 lines
915 B
C#

// Copyright © 2010-2017 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.Linq;
using System.Collections.Generic;
namespace CefSharp.Internals
{
/// <summary>
/// Simple helper class used for checking/parsing command line arguments
/// </summary>
public static class CommandLineArgsParser
{
public static bool HasArgument(this IEnumerable<string> args, string arg)
{
return args.Any(a => a.StartsWith(arg));
}
public static string GetArgumentValue(this IEnumerable<string> args, string argumentName)
{
var arg = args.FirstOrDefault(a => a.StartsWith(argumentName));
if (arg == null)
{
return null;
}
return arg.Split('=').Last();
}
}
}