mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 07:27:36 +08:00
fix pubtool
This commit is contained in:
@@ -195,31 +195,23 @@ namespace System.Application.Steps
|
||||
Console.WriteLine("7z Step 正在创建压缩包...");
|
||||
|
||||
// 创建压缩包
|
||||
var gs = publishDirs.Select(x => Task.Run(() => GenerateCompressedPackage(dev, x)));
|
||||
foreach (var item in gs.ToArray())
|
||||
PerformanceCounter? ramCounter = null;
|
||||
if (OperatingSystem2.IsWindows())
|
||||
{
|
||||
await item;
|
||||
var processName = Process.GetCurrentProcess().ProcessName;
|
||||
ramCounter = new PerformanceCounter("Process", "Working Set", processName);
|
||||
}
|
||||
void WriteRAMLine()
|
||||
{
|
||||
if (ramCounter != null)
|
||||
Console.WriteLine($"Working Set: {IOPath.GetDisplayFileSizeString(ramCounter.NextValue())}");
|
||||
}
|
||||
foreach (var item in publishDirs)
|
||||
{
|
||||
WriteRAMLine();
|
||||
GenerateCompressedPackage(dev, item);
|
||||
WriteRAMLine();
|
||||
}
|
||||
//parallelTasks.AddRange(gs);
|
||||
|
||||
//var processorCount = Environment.ProcessorCount;
|
||||
//if (processorCount < 2) processorCount = 2;
|
||||
//var parallelCount = processorCount;
|
||||
//if (parallelTasks.Count > parallelCount)
|
||||
//{
|
||||
// var count = 0;
|
||||
// while (true)
|
||||
// {
|
||||
// var parallelTasksSplit = parallelTasks.Skip(count++ * parallelCount).Take(parallelCount).ToArray();
|
||||
// if (!parallelTasksSplit.Any()) break;
|
||||
// await Task.WhenAll(parallelTasksSplit);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// await Task.WhenAll(parallelTasks);
|
||||
//}
|
||||
//parallelTasks.Clear();
|
||||
|
||||
if (hasWindows)
|
||||
{
|
||||
|
||||
@@ -86,8 +86,6 @@ namespace System.Application
|
||||
|
||||
dirNames = dirNames.ThrowIsNull(nameof(dirNames));
|
||||
|
||||
var parallelTasks = dirNames.Select(x => Task.Run(() => Step_cd.GenerateCompressedPackage(dev, x, type))).ToArray();
|
||||
|
||||
PerformanceCounter? ramCounter = null;
|
||||
if (OperatingSystem2.IsWindows())
|
||||
{
|
||||
@@ -99,30 +97,12 @@ namespace System.Application
|
||||
if (ramCounter != null)
|
||||
Console.WriteLine($"Working Set: {IOPath.GetDisplayFileSizeString(ramCounter.NextValue())}");
|
||||
}
|
||||
foreach (var item in parallelTasks)
|
||||
foreach (var item in dirNames)
|
||||
{
|
||||
WriteRAMLine();
|
||||
await item;
|
||||
Step_cd.GenerateCompressedPackage(dev, item, type);
|
||||
WriteRAMLine();
|
||||
}
|
||||
//var processorCount = Environment.ProcessorCount;
|
||||
//if (processorCount < 2) processorCount = 2;
|
||||
//var parallelCount = processorCount;
|
||||
|
||||
//if (parallelTasks.Length > parallelCount)
|
||||
//{
|
||||
// var count = 0;
|
||||
// while (true)
|
||||
// {
|
||||
// var parallelTasksSplit = parallelTasks.Skip(count++ * parallelCount).Take(parallelCount).ToArray();
|
||||
// if (!parallelTasksSplit.Any()) break;
|
||||
// await Task.WhenAll(parallelTasksSplit);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// await Task.WhenAll(parallelTasks);
|
||||
//}
|
||||
|
||||
SavePublishJson(dirNames, removeFiles: false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user