public CompilerProject(string project) { ProjectLocation = project; FileExtension = ".bin"; CompressionModeLevel = 0; FileMap = new List <string>(); FileMap = CompilerUtilities.FileFinder(ProjectLocation, "*.js"); }
public CompilerProject(string project, string fileExtension, bool removeAfterCompile, bool compressToPackage, bool removeAfterCompression, int compressionLevel) { ProjectLocation = project; RemoveSourceCodeAfterCompiling = removeAfterCompile; FileExtension = fileExtension; CompressFilesToPackage = compressToPackage; RemoveFilesAfterCompression = removeAfterCompression; CompressionModeLevel = compressionLevel; FileMap = new List <string>(); FileMap = CompilerUtilities.FileFinder(ProjectLocation, "*.js"); }
//This method starts the nw.exe file. /// <summary> /// Starts the NW.js compiler. /// </summary> /// <param name="index">The index in the list.</param> public void CompileFile(int index) { CompilerUtilities.RecordToLog("Setting up the compiler...", 3); //Removing the JavaScript extension. Needed to place our own File Extension. //Setting up the compiler by throwing in two arguments. //The first bit (the one with the file variable) is the source. //The second bit (the one with the fileBuffer variable) makes the final file. CompilerInfo.Value.Arguments = "\"" + FileMap[index] + "\" \"" + FileMap[index].Replace(".js", "." + FileExtension, StringComparison.Ordinal) + "\""; //Making sure not to show the nwjc window. That program doesn't show anything of usefulness. CompilerInfo.Value.CreateNoWindow = true; CompilerInfo.Value.WindowStyle = ProcessWindowStyle.Hidden; //Run the compiler. CompilerUtilities.RecordToLog($"nwjc processing the file {FileMap[index]}...", 3); Process.Start(CompilerInfo.Value)?.WaitForExit(); //If the user asked to remove the JS files, delete them. if (RemoveSourceCodeAfterCompiling) { CompilerUtilities.RecordToLog($"Removing the file {FileMap[index]}...", 3); File.Delete(FileMap[index]); } }