update
This commit is contained in:
parent
94d12c1a86
commit
d00b3a414b
@ -1,6 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace VideoConcat
|
||||
{
|
||||
@ -9,15 +10,14 @@ namespace VideoConcat
|
||||
/// </summary>
|
||||
public partial class Video : Window
|
||||
{
|
||||
public string text = "";
|
||||
public string text = "", outPut = "";
|
||||
public FileSystemInfo[]? Floders { get; set; }
|
||||
public string[] Heads = [];
|
||||
public string[] Tails = [];
|
||||
public string[][] Middles = [];
|
||||
public List<string[]> Middles = [];
|
||||
|
||||
public DirectoryInfo? Path { get; set; }
|
||||
|
||||
|
||||
public Video()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -50,44 +50,36 @@ namespace VideoConcat
|
||||
|
||||
startButton.IsEnabled = false;
|
||||
|
||||
Array.ForEach(array: Middles, s =>
|
||||
{
|
||||
WriteTxt(s);
|
||||
});
|
||||
|
||||
|
||||
var dateStart = DateTime.Now; //记录用时的起始时间
|
||||
|
||||
List<List<string>> fpList = new List<List<string>>();
|
||||
|
||||
foreach (var item in await MockIOPerformanceAsync)
|
||||
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var dateEnd = DateTime.Now;
|
||||
var timeSpan = dateEnd - dateStart;//记录开票用时
|
||||
DebugText += item + " " + timeSpan.TotalSeconds + "\r\n";
|
||||
var dateStart = DateTime.Now; //记录用时的起始时间
|
||||
|
||||
}
|
||||
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
|
||||
for (int i = 0; i <= count; i++)
|
||||
{
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
processVideoBar.Dispatcher.Invoke(() =>
|
||||
{
|
||||
processVideoBar.Value = i;
|
||||
|
||||
});
|
||||
outputTxt.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
WriteTxt("正在生成第" + i + "个视频");
|
||||
}));
|
||||
});
|
||||
System.Threading.Thread.Sleep(50);
|
||||
|
||||
{
|
||||
|
||||
await MockIOPerformanceAsync(Middles[i]);
|
||||
//System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
||||
//{
|
||||
// processVideoBar.Dispatcher.Invoke(() =>
|
||||
// {
|
||||
// processVideoBar.Value = i;
|
||||
|
||||
// });
|
||||
// outputTxt.Dispatcher.Invoke(new Action(() =>
|
||||
// {
|
||||
// WriteTxt("正在生成第" + i + "个视频");
|
||||
// }));
|
||||
//});
|
||||
//System.Threading.Thread.Sleep(50);
|
||||
}
|
||||
|
||||
startButton.Dispatcher.Invoke(() =>
|
||||
@ -95,6 +87,9 @@ namespace VideoConcat
|
||||
startButton.IsEnabled = true;
|
||||
});
|
||||
|
||||
var dateEnd = DateTime.Now;
|
||||
var timeSpan = dateEnd - dateStart;//记录开票用时
|
||||
|
||||
});//ProcessVideo.RunTask(processVideoBar, startButton)
|
||||
}
|
||||
|
||||
@ -138,7 +133,8 @@ namespace VideoConcat
|
||||
continue;
|
||||
}
|
||||
|
||||
Middles = Middles.Concat(GetAllVideos($"{Path}\\{folder.Name}")).ToArray();
|
||||
string[] files = GetAllVideos($"{Path}\\{folder.Name}");
|
||||
Middles.Add(files);
|
||||
|
||||
}
|
||||
if (!hasHead)
|
||||
@ -150,6 +146,10 @@ namespace VideoConcat
|
||||
{
|
||||
WriteTxt("存在名称为tail的文件夹,将作为视频结尾!");
|
||||
}
|
||||
|
||||
Middles.Insert(0, Heads);
|
||||
Middles.Add(Tails);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -238,7 +238,7 @@ namespace VideoConcat
|
||||
|
||||
public void MakeOutPutDir()
|
||||
{
|
||||
string outPut = $"{Path}\\output";
|
||||
outPut = $"{Path}\\output";
|
||||
|
||||
if (!Directory.Exists(outPut))
|
||||
{
|
||||
@ -246,7 +246,7 @@ namespace VideoConcat
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<IEnumerable<string>> MockIOPerformanceAsync(List<string> ls)
|
||||
public static async Task<IEnumerable<string>> MockIOPerformanceAsync(string[] ls)
|
||||
{
|
||||
List<string> lss = new List<string>();
|
||||
List<Task> tasks = new List<Task>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user