Exemple #1
0
        public bool Execute()
        {
            for (int i = 0; i < InputFiles.Length; i++)
            {
                var    inp = System.IO.File.ReadAllText(InputFiles[i].ItemSpec);
                string errors;
                var    outp = SyntaxRewriter.Translate(inp, out errors);
                if (outp != null)
                {
                    System.IO.File.WriteAllText(OutputFiles[i].ItemSpec, outp);
                }
                else
                {
                    // replace Program.psharp with the actual file name
                    errors = errors.Replace("Program.psharp", System.IO.Path.GetFileName(InputFiles[i].ItemSpec));
                    // print a compiler error with log
                    System.IO.File.WriteAllText(OutputFiles[i].ItemSpec,
                                                string.Format("#error Psharp Compiler Error {0} /* {0} {1} {0} */ ", "\n", errors));
                }
            }

            return(true);
        }