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