Exemple #1
0
        public TextWriter GetTextWriter()
        {
            if (pw == null)
            {
                HashAlgorithm digest;
                try {
                    digest = HashAlgorithm.Create("MD5");
                } catch (TargetException e) {
                    throw new IOException("No MD5 implementation", e);
                }

                dos = new DigestOutputStream(new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write), digest);
                pw  = new TrapCloseTextWriter(this, dos);

                // Write the headers....
                String version = compatibleVersion ?? typeof(OutputFile).Assembly.GetName().Version.ToString();
                pw.WriteLine("/* " + CSharpCCGlobals.GetIdString(toolName, Path.GetFileName(file)) + " Version " + version + " */");
                if (options != null)
                {
                    pw.WriteLine("/* CSharpCCOptions:" + Options.GetOptionsString(options) + " */");
                }
            }

            return(pw);
        }
Exemple #2
0
        public TextWriter GetTextWriter()
        {
            if (pw == null) {
                HashAlgorithm digest;
                try {
                    digest = HashAlgorithm.Create("MD5");
                } catch (TargetException e) {
                    throw new IOException("No MD5 implementation", e);
                }

                dos = new DigestOutputStream(new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write), digest);
                pw = new TrapCloseTextWriter(this, dos);

                // Write the headers....
                String version = compatibleVersion ?? typeof(OutputFile).Assembly.GetName().Version.ToString();
                pw.WriteLine("/* " + CSharpCCGlobals.GetIdString(toolName, Path.GetFileName(file)) + " Version " + version + " */");
                if (options != null) {
                    pw.WriteLine("/* CSharpCCOptions:" + Options.GetOptionsString(options) + " */");
                }
            }

            return pw;
        }