Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from KlimeSE/master
Browse files Browse the repository at this point in the history
Parallel
  • Loading branch information
AtlasTheProto authored Jul 11, 2020
2 parents 5be9e6b + f8eec43 commit 66f9f38
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bC7totif/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,28 +276,28 @@ public static void doConvertAll()
}

maxfiles = fileList.Length;

for (int i=0; i < fileList.Length; i++)

int current_working = 0;
Parallel.For(0, maxfiles, new ParallelOptions { MaxDegreeOfParallelism = 10 }, i =>
{
var currentFilePath = fileList[i];
var currentFilePath = fileList[i];
var DirName = Path.GetDirectoryName(currentFilePath);
var relDir = DirName.Replace(gamePath,"");
var relDir = DirName.Replace(gamePath, "");
var destDir = outDir + relDir;
//var destDir = "temp/" + relDir;
var convFileName = Path.GetFileName(currentFilePath);
Directory.CreateDirectory(destDir);
currentfiles = i;
var cmdArgs = string.Format("-ft TIF -if LINEAR -sRGB -y -o \"{0}\" \"{1}\"", destDir, currentFilePath);
var newProcess = StartProcess(toolPath + "\\texconv.exe", cmdArgs);
// consoleBuffer.Enqueue("Converting " + i + " out of " + maxfiles + " (" + convFileName + ")");
consoleBuffer.Enqueue("Converting: " + convFileName + " (" + i + "/" + maxfiles + ")");
if (newProcess!=null)
if (newProcess != null)
{
newProcess.WaitForExit();
Interlocked.Increment(ref current_working);
consoleBuffer.Enqueue("Converting: " + convFileName + " (" + current_working + "/" + maxfiles + ")");
}

}

);

MessageBox.Show("Finished!", "Conversion completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
busy = false;

Expand Down

0 comments on commit 66f9f38

Please sign in to comment.