Forex_Strategy_Builder.Optimizer.SaveReport C# (CSharp) Method

SaveReport() private method

Saves the report in a file.
private SaveReport ( ) : void
return void
        void SaveReport()
        {
            string pathReport  = Data.StrategyPath.Replace(".xml", ".csv");
            string partilaPath = Data.StrategyPath.Replace(".xml", "");
            int reportIndex = 0;
            do
            {
                reportIndex++;
                pathReport = partilaPath + "-report-" + reportIndex.ToString() + ".csv";

            } while (File.Exists(pathReport));

            try
            {
                using (StreamWriter outfile = new StreamWriter(pathReport))
                {
                    outfile.Write(sbReport.ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }