update
This commit is contained in:
parent
b656a17b35
commit
b06d44db46
@ -92,7 +92,7 @@ namespace VideoConcat
|
||||
{
|
||||
string mp4Path = $"{Directory.GetCurrentDirectory()}\\temp\\";
|
||||
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(mp4Path);
|
||||
DirectoryInfo directoryInfo = new(mp4Path);
|
||||
|
||||
FileInfo[] files = directoryInfo.GetFiles("*.mp4"); // 获取指定目录下的所有 txt 文件
|
||||
|
||||
@ -321,7 +321,7 @@ namespace VideoConcat
|
||||
{
|
||||
ls.Add(new List<string>(item.Value));
|
||||
}
|
||||
List<List<string>> permutations = CalculatePermutations(ls);
|
||||
List<List<string>> permutations = GenerateAllPermutations(ls);
|
||||
|
||||
|
||||
return permutations;
|
||||
@ -352,6 +352,32 @@ namespace VideoConcat
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static List<List<string>> GenerateAllPermutations(List<List<string>> ballInBoxes)
|
||||
{
|
||||
if (ballInBoxes.Count == 0)
|
||||
{
|
||||
return [[]];
|
||||
}
|
||||
|
||||
List<string> firstBoxBall = ballInBoxes[0];
|
||||
List<List<string>> remainingBoxes = ballInBoxes.GetRange(1, ballInBoxes.Count-1);
|
||||
|
||||
List<List<string>> subPermutations = GenerateAllPermutations(remainingBoxes);
|
||||
|
||||
List<List<string>> result = [];
|
||||
foreach (var firstItem in firstBoxBall)
|
||||
{
|
||||
foreach (var subPermutation in subPermutations)
|
||||
{
|
||||
List<string> newPermutation = [firstItem, .. subPermutation];
|
||||
result.Add(newPermutation);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user