// Return single record if passed ID exits public string GetRecord(int pID) { if (!Directory.Exists(ResultDirectory)) { throw new FileNotFoundException("There are no sorting results present."); } FileInfo[] vFiles = GetFiles(pID); if (vFiles.Length == 0) { throw new IndexOutOfRangeException("There is no records with pesented ID."); } _ = int.TryParse(vFiles[0].Name.Replace(vFiles[0].Extension, ""), out int vFileID); SortedData vDataEntry = new SortedData { ID = vFileID, SortDate = vFiles[0].LastWriteTime }; return(vDataEntry.ToString() + Environment.NewLine + "Result" + Environment.NewLine + File.ReadAllText(vFiles[0].FullName)); }