private void RelationalQueriesBgWorkerWork(object sender, DoWorkEventArgs doWorkEventArgs) { using (var writer = new StreamWriter(RqOutputFile)) { using (var reader = new StreamReader(RqCases)) { var inputLines = reader.ReadToEnd(); var data = Regex.Split(inputLines, "\r\n|\r|\n"); var tct = data.Length; int ct = 0; for (int i = 0; i < data.Length; i++) { ct++; var queries = data[i].Split(','); var watch = Stopwatch.StartNew(); HashSet <string> scaSet = new HashSet <string>(); var length = _wordNet.GetSca(queries[0], queries[1], out scaSet); watch.Stop(); { var writeLine = $"{length},"; foreach (var sc in scaSet) { writeLine += $"{sc} "; } writeLine = writeLine.Remove(writeLine.LastIndexOf(" ", StringComparison.Ordinal), 1); writer.WriteLine(writeLine); } _rqAvgList.Add(watch.ElapsedMilliseconds); _bgWorker.ReportProgress(ct * 100 / (tct), new object[] { ct, watch.ElapsedMilliseconds, $"Working..{ct} / {tct}" }); } } writer.Flush(); } }