Example #1
0
        private static bool DoCompile(string[] aArgs, String aDirectoryName, FileInfo[] aSourceFileList, ProgramArguments aArguments)
        {
            bool result = false;
            Console.WriteLine("Done");
            foreach (FileInfo sourceFile in aSourceFileList)
            {
                SourceCode sourceCode = new SourceCode(sourceFile, aArguments);
                if (!sourceCode.DoesHaveCode())
                    throw new ArgumentException(String.Format("There is no C# source code in the file: {0}", sourceFile.Name));

                if (File.Exists(sourceCode.GetJavaDestinationFullName()))
                    File.Delete(sourceCode.GetJavaDestinationFullName());

                Generator gen = new Generator(aDirectoryName, sourceCode, true);
                gen.Run();

                Console.WriteLine();
                if (gen.HasErrors())
                {
                    Console.WriteLine("\nPlease resolve the following errors first:\n ");

                    foreach (String error in gen.GetErrors())
                        Console.WriteLine("- {0}", error);

                    GeneralUtils.WriteErrorFile(aDirectoryName, gen.GetErrors());
                    Console.WriteLine();
                }
                else
                    result = true;
            }
            return result;
        }
Example #2
0
 public Generator(List<String> aSourceCodeForTesting, bool aUnitTestMode)
 {
     this.sourceCode = new SourceCode(aSourceCodeForTesting);
     this.displayProgress = false;
     this.writeJavaCode = false;
     this.UnitTestMode = aUnitTestMode;
 }
Example #3
0
 public Generator(SourceCode sourceCode)
 {
     this.sourceCode = sourceCode;
     this.displayProgress = false;
     this.writeJavaCode = false;
     this.UnitTestMode = false;
 }
Example #4
0
 public Generator(string aDirectoryName, SourceCode aSourceCode, bool aDisplayProgress)
 {
     this.directoryName = aDirectoryName;
     this.sourceCode = aSourceCode;
     this.displayProgress = aDisplayProgress;
     this.writeJavaCode = true;
     this.UnitTestMode = false;
 }