mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Added ContainsOnlyOneOf insted of CountExistedKeys
This commit is contained in:
parent
8cc1791d25
commit
b4dcd9ffb1
1 changed files with 5 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FFMpegCore.FFMPEG.Argument
|
||||
{
|
||||
|
@ -102,8 +103,8 @@ public void Add(params Argument[] values)
|
|||
/// <returns></returns>
|
||||
public bool ContainsInputOutput()
|
||||
{
|
||||
return CountExistedKeys(typeof(InputArgument), typeof(ConcatArgument), typeof(InputPipeArgument)) == 1 &&
|
||||
CountExistedKeys(typeof(OutputArgument), typeof(OutputPipeArgument)) == 1;
|
||||
return ContainsOnlyOneOf(typeof(InputArgument), typeof(ConcatArgument), typeof(InputPipeArgument)) &&
|
||||
ContainsOnlyOneOf(typeof(OutputArgument), typeof(OutputPipeArgument));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -116,14 +117,9 @@ public bool ContainsKey(Type key)
|
|||
return _args.ContainsKey(key);
|
||||
}
|
||||
|
||||
public int CountExistedKeys(params Type[] types)
|
||||
public bool ContainsOnlyOneOf(params Type[] types)
|
||||
{
|
||||
int count = 0;
|
||||
for(int i =0; i < types.Length; i++)
|
||||
if (_args.ContainsKey(types[i]))
|
||||
count++;
|
||||
|
||||
return count;
|
||||
return types.Count(t => _args.ContainsKey(t)) == 1;
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<Type, Argument>[] array, int arrayIndex)
|
||||
|
|
Loading…
Reference in a new issue