Exemple #1
0
        /// <summary>
        /// Generate Text file
        /// </summary>
        /// <param name="filetext"></param>
        protected virtual void GenerateFile(string filetext)
        {
            Console.Write("Generating {0} text file .", generatedFile);

            System.Text.Encoding currentencoding = System.Text.Encoding.ASCII;

            if (CommonHelper.FileModified)
            {
                currentencoding = System.Text.Encoding.Unicode;
            }

            StreamWriterSW sw = new StreamWriterSW(generatedFile, false, currentencoding);

            sw.Flush();

            sw.WriteLine(filetext);
            sw.Close();
        }
Exemple #2
0
        /// <summary>
        /// Enables logging LHCompiler debug info to file.
        /// </summary>
        /// <value></value>
        public static void LogToFile(string write)
        {
            if (String.IsNullOrEmpty(logfilename))
            {
                logfilename = @"LHCompiler.log";
            }

            logfilename = PathSW.GetFullPath(logfilename);

            switch (write)
            {
            case "Overwrite":
                sw = new StreamWriterSW(logfilename);
                sw.Flush();
                break;

            case "Append":
                if (FileSW.Exists(logfilename))
                {
                    sw = new StreamWriterSW(logfilename, true);
                }
                else
                {
                    sw = new StreamWriterSW(logfilename);
                    sw.Flush();
                }
                break;

            default:
                break;
            }

            if (sw != null)
            {
                sw.Close();
            }
        }