private void btnBrowseDirectories_Click(object sender, EventArgs e) { if (fbdFolderBrowser.ShowDialog() == DialogResult.OK) { txbProjectDirectory.Text = fbdFolderBrowser.SelectedPath; LPHPCompiler.COMPOPT["UI_LAST_PROJECT_PATH"] = fbdFolderBrowser.SelectedPath; LPHPCompiler.SaveConfig(); } }
static void Main(string[] args) { string watchDirectory = null; ShowStartupBanner(); // Initialize LPHP-Compiler LPHPCompiler.Init(); // Set LPHP-Debug Mode LPHPDebugger.PrintDebug = LPHPDebugger.DebugOutputs.ToConsole; // Enable the creation of a log file LPHPDebugger.CreateLogFile = true; // Check if the project-path is provided upon startup if (args.Length > 0) { if (Directory.Exists(args[0].ToString())) { watchDirectory = args[0].ToString(); } else { LPHPDebugger.PrintError("*** LPHP Startup Error ***"); LPHPDebugger.PrintError("The path provided is not a valid directory."); } } else { LPHPDebugger.PrintWarning("No path provided upon startup. Please provide a path to your LPHP-project at startup, or enter it below:"); do { Console.Write("LPHP Project Path > "); watchDirectory = Console.ReadLine(); Console.WriteLine(""); if (!Directory.Exists(watchDirectory)) { LPHPDebugger.PrintError("The entered path is not valid! Please try again."); } }while (!Directory.Exists(watchDirectory)); } Console.Write("Watching directory \""); Console.ForegroundColor = ConsoleColor.Green; Console.Write(watchDirectory); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\""); // Set up the watchdog and set the project-root LPHPWatchdog.Init(watchDirectory); // Run the LPHP-Watchdog on the given directory LPHPWatchdog.Run(); }
private void bgwLPHPCompiler_DoWork(object sender, DoWorkEventArgs e) { // Initialize LPHP-Compiler LPHPCompiler.Init(); // Initialize LPHP-Watchdog LPHPWatchdog.Init(txbProjectDirectory.Text); // Set LPHP-Debug Mode LPHPDebugger.PrintDebug = DebugToTxb; // Enable the creation of a log file LPHPDebugger.CreateLogFile = true; while (true) { if (bgwLPHPCompiler.CancellationPending) { return; } if (QueueLPHPRestart) { bgwLPHPCompiler.ReportProgress(0, new Tuple <string, Color>("Reloading LPHP-Config...", Color.Yellow)); LPHPCompiler.Init(); LPHPWatchdog.Init(txbProjectDirectory.Text); QueueLPHPRestart = false; } // Run the LPHP-Watchdog on the given directory int watchdogResult = LPHPWatchdog.RunOnce(); if (watchdogResult == -1) { bgwLPHPCompiler.ReportProgress(0, new Tuple <string, Color>("Stopping LPHP-Engine.", Color.OrangeRed)); bgwLPHPCompiler.CancelAsync(); } if (watchdogResult == -2) { bgwLPHPCompiler.ReportProgress(0, new Tuple <string, Color>("Problem detected. Halting LPHP for 5 seconds.", Color.OrangeRed)); if (lastCompilerResult == 0) { nicLPHPNic.BalloonTipTitle = "LPHP Compilation Error"; nicLPHPNic.BalloonTipText = "LPHP has encountered an error during compilation.\r\n Open LPHP for more information."; nicLPHPNic.BalloonTipIcon = ToolTipIcon.Error; nicLPHPNic.ShowBalloonTip(3000); } Thread.Sleep(5000); } lastCompilerResult = watchdogResult; } }
public LPHPUI() { InitializeComponent(); this.Style.Border = new Pen(Color.FromArgb(79, 93, 149), 2); this.Style.InactiveBorder = new Pen(Color.FromArgb(101, 114, 172), 2); ShowStartupBanner(); LPHPCompiler.Init(); try { if (LPHPCompiler.COMPOPT.ContainsKey("UI_LAST_PROJECT_PATH")) { txbProjectDirectory.Text = LPHPCompiler.COMPOPT["UI_LAST_PROJECT_PATH"].ToString(); } else { txbProjectDirectory.Text = ""; } if (LPHPCompiler.COMPOPT.ContainsKey("REMOVE_HTML_COMMENTS") && Convert.ToBoolean(LPHPCompiler.COMPOPT["REMOVE_HTML_COMMENTS"])) { tglRemoveHTMLComments.ToggleState = Syncfusion.Windows.Forms.Tools.ToggleButtonState.Active; } else { tglRemoveHTMLComments.ToggleState = Syncfusion.Windows.Forms.Tools.ToggleButtonState.Inactive; } if (LPHPCompiler.COMPOPT.ContainsKey("MIN_OUTPUT_ENABLED") && Convert.ToBoolean(LPHPCompiler.COMPOPT["MIN_OUTPUT_ENABLED"])) { tglEnableMinOutput.ToggleState = Syncfusion.Windows.Forms.Tools.ToggleButtonState.Active; } else { tglEnableMinOutput.ToggleState = Syncfusion.Windows.Forms.Tools.ToggleButtonState.Inactive; } if (LPHPCompiler.COMPOPT.ContainsKey("XML_OUTPUT_ENABLED") && Convert.ToBoolean(LPHPCompiler.COMPOPT["XML_OUTPUT_ENABLED"])) { tglEnableXMLOutput.ToggleState = Syncfusion.Windows.Forms.Tools.ToggleButtonState.Active; } else { tglEnableXMLOutput.ToggleState = Syncfusion.Windows.Forms.Tools.ToggleButtonState.Inactive; } if (LPHPCompiler.COMPOPT.ContainsKey("ENABLE_CONSOLE_LOG")) { chbSaveConsoleLog.Checked = Convert.ToBoolean(LPHPCompiler.COMPOPT["ENABLE_CONSOLE_LOG"]); } } catch { } }
private void chbSaveConsoleLog_CheckedChanged(object sender, EventArgs e) { LPHPCompiler.COMPOPT["ENABLE_CONSOLE_LOG"] = chbSaveConsoleLog.Checked; LPHPCompiler.SaveConfig(); }
private void tglEnableXMLOutput_ToggleStateChanged(object sender, Syncfusion.Windows.Forms.Tools.ToggleStateChangedEventArgs e) { QueueLPHPRestart = true; LPHPCompiler.COMPOPT["XML_OUTPUT_ENABLED"] = (tglEnableXMLOutput.ToggleState == Syncfusion.Windows.Forms.Tools.ToggleButtonState.Active); LPHPCompiler.SaveConfig(); }
private void tglRemoveHTMLComments_ToggleStateChanged(object sender, Syncfusion.Windows.Forms.Tools.ToggleStateChangedEventArgs e) { QueueLPHPRestart = true; LPHPCompiler.COMPOPT["REMOVE_HTML_COMMENTS"] = (tglRemoveHTMLComments.ToggleState == Syncfusion.Windows.Forms.Tools.ToggleButtonState.Active); LPHPCompiler.SaveConfig(); }