Skip to content

Commit

Permalink
Code refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikasoukhov committed Oct 16, 2016
1 parent a469bac commit c5228ca
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,13 @@ private void ConvertDirectory(string path, IStorageRegistry registry, StorageFor
if (!_isStarted)
return;

var files = Directory.GetFiles(path, "*.qsh");

if (!multithread)
Directory.GetFiles(path, "*.qsh").ForEach(f => ConvertFile(f, registry, format, board, securityLike, orderLog2OrderBookBuilders, orderBookMaxDepth));
files.ForEach(f => ConvertFile(f, registry, format, board, securityLike, orderLog2OrderBookBuilders, orderBookMaxDepth));
else
{
var tasks = new List<Task>();
Directory.GetFiles(path, "*.qsh").ForEach(f =>
{
var task = new Task(() => ConvertFile(f, registry, format, board, securityLike, orderLog2OrderBookBuilders, orderBookMaxDepth));
tasks.Add(task);
task.Start();
});

Task.WaitAll(tasks.ToArray());
tasks.ForEach(t => t.Dispose());
tasks.Clear();
Parallel.ForEach(files, file => ConvertFile(file, registry, format, board, securityLike, orderLog2OrderBookBuilders, orderBookMaxDepth));
}

//пишем имена сконвертированных в деректории файлов qsh, в файл
Expand Down

0 comments on commit c5228ca

Please sign in to comment.