/// <summary> /// Sorts the specified input file. /// </summary> /// <param name="inputFileName">Name of the input file.</param> /// <param name="outputFileName">Name of the output file.</param> public async Task SortAsync(string inputFileName, string outputFileName) { FileInfo fileInfo = _fileProvider.GetExistingFileInfo(inputFileName); _baseDir = fileInfo.DirectoryName; if (fileInfo.Length < AppConstants.MaxFilePartSize) { Logger.LogInformation($"File less than {AppConstants.MaxFilePartSize} bytes"); await SortFileEntriesAsync(fileInfo.FullName, outputFileName); } else { Logger.LogInformation("Sort bigger files"); _noSortParts = new SortedDictionary <string, StreamData>(AppConstants.Comparer); _sortParts = new SortedDictionary <string, StreamData>(AppConstants.Comparer); await SplitFileAsync(inputFileName, 1); await MergeFilesAsync(outputFileName); _fileProvider.DeleteDirectoryRecursively($"{_baseDir}\\{AppConstants.WorkspaceDirectoryName}"); } }