BitMiracle.VisualStudioConverter.CSScript.Converter.writeResultSolution C# (CSharp) Method

writeResultSolution() private method

private writeResultSolution ( byte bom, StringCollection sc ) : void
bom byte
sc System.Collections.Specialized.StringCollection
return void
        private void writeResultSolution(byte[] bom, StringCollection sc)
        {
            if (!Directory.Exists(m_options.ResultDirectory))
                Directory.CreateDirectory(m_options.ResultDirectory);

            string resultSolutionName = processSolutionName(m_options.PathToSolution);
            string pathToResultSolution = Path.Combine(m_options.ResultDirectory, resultSolutionName);
            using (FileStream fs = new FileStream(pathToResultSolution, FileMode.Create))
            {
                // write the BOM bytes (using the BinaryWriter)
                BinaryWriter bw = new BinaryWriter(fs);
                bw.Write(bom);
                bw.Flush();

                // write the remaining text (using the StreamWriter)
                StreamWriter sw = new StreamWriter(fs);

                foreach (string buf in sc)
                    sw.WriteLine(buf);

                sw.Flush();
            }
        }