private void mxmlcRunner_Output(object sender, string line) { PluginBase.RunAsync(delegate { if (!notificationSent && line.StartsWithOrdinal("Done(")) { running = false; TraceManager.Add(line, -2); notificationSent = true; ASContext.SetStatusText(TextHelper.GetString("Info.MxmlcDone")); EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, line)); if (Regex.IsMatch(line, "Done\\([1-9]")) { EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null)); } else { RunAfterBuild(); } } else { TraceManager.Add(line, 0); } }); }
private void mxmlcRunner_Output(object sender, string line) { Control ctrl = mainForm.CurDocument as Control; if (ctrl != null && ctrl.InvokeRequired) { ctrl.BeginInvoke(new ProcessOutputHandler(mxmlcRunner_Output), new object[] { sender, line }); } else { if (!notificationSent && line.StartsWith("Done(")) { mainForm.AddTraceLogEntry(line, -2); notificationSent = true; ASContext.SetStatusText("Mxmlc Done"); mainForm.DispatchEvent(new NotifyEvent(EventType.ProcessEnd)); if (Regex.IsMatch(line, "Done\\([1-9]")) { mainForm.DispatchEvent(new TextEvent(EventType.Command, "ShowResults")); } else { RunAfterBuild(); } } else { mainForm.AddTraceLogEntry(line, 0); } } }
private void mxmlcRunner_Output(object sender, string line) { Control ctrl = ASContext.Panel as Control; if (ctrl != null && ctrl.InvokeRequired) { ctrl.BeginInvoke((MethodInvoker) delegate { mxmlcRunner_Output(sender, line); }); } else { if (!notificationSent && line.StartsWith("Done(")) { running = false; TraceManager.Add(line, -2); notificationSent = true; ASContext.SetStatusText(TextHelper.GetString("Info.MxmlcDone")); EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, line)); if (Regex.IsMatch(line, "Done\\([1-9]")) { EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null)); } else { RunAfterBuild(); } } else { TraceManager.Add(line, 0); } } }
private void ascRunner_OutputError(object sender, string line) { if (line == null) { return; } PluginBase.RunAsync(delegate { if (line.StartsWithOrdinal("Exception ")) { TraceManager.AddAsync(line, -3); return; } if (silentChecking) { if (SyntaxError != null) { SyntaxError(line); } return; } TraceManager.Add(line, -3); if (!notificationSent) { notificationSent = true; TraceManager.Add("Done(1)", -2); EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, "Done(1)")); ASContext.SetStatusText(TextHelper.GetString("Info.AscDone")); EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null)); } }); }
private void ascRunner_OutputError(object sender, string line) { Control ctrl = ASContext.Panel as Control; if (ctrl != null && ctrl.InvokeRequired) { ctrl.BeginInvoke((MethodInvoker) delegate { ascRunner_OutputError(sender, line); }); } else { if (silentChecking) { if (SyntaxError != null) { SyntaxError(line); } return; } TraceManager.Add(line, -3); if (!notificationSent) { notificationSent = true; TraceManager.Add("Done(1)", -2); EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, "Done(1)")); ASContext.SetStatusText(TextHelper.GetString("Info.AscDone")); EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null)); } } }
/// <summary> /// Run the Flash IDE with the additional parameters provided /// </summary> /// <param name="parameters"></param> /// <returns>Operation successful</returns> static public bool Run(string pathToIDE, string cmdData) { if (pathToIDE != null && Path.GetExtension(pathToIDE).Length < 3) { pathToIDE = Path.Combine(pathToIDE, "Flash.exe"); } if (pathToIDE == null || !System.IO.File.Exists(pathToIDE)) { string msg = TextHelper.GetString("Info.ConfigureFlashPath"); string title = TextHelper.GetString("Info.ConfigurationRequired"); DialogResult result = MessageBox.Show(msg, title, MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash"); } return(false); } TimeSpan diff = DateTime.Now.Subtract(lastRun); if (diff.Seconds < 1) { return(false); } lastRun = DateTime.Now; string args = null; if (cmdData != null) { args = PluginBase.MainForm.ProcessArgString(cmdData); if (args.IndexOf('"') < 0) { args = '"' + args + '"'; } } // execution ASContext.SetStatusText(TextHelper.GetString("Info.CallingFlashIDE")); PluginBase.MainForm.CallCommand("SaveAllModified", null); EventManager.DispatchEvent(null, new NotifyEvent(EventType.ProcessStart)); if (args != null) { ProcessHelper.StartAsync(pathToIDE, args); } else { ProcessHelper.StartAsync(pathToIDE); } return(true); }
private void create_Click(object sender, EventArgs e) { string authorizationHeader = null; try { authorizationHeader = this.DetermineAuthorizationHeader(); } catch (OperationCanceledException) { ASContext.SetStatusText(ResourceHelper.GetString("CreateGist.LoginFailedOrCanceled")); return; } var fileName = Path.GetFileName(ASContext.Context.CurrentFile); var content = ASContext.CurSciControl.SelTextSize <= 0 ? ASContext.CurSciControl.Text : ASContext.CurSciControl.SelText; var gist = new Gist { Description = this.description.Text, Public = !this.isPrivate.Checked }.AddFile(fileName, content); try { var location = HttpHelper.Post(PostGistUri, gist, authorizationHeader); if (this.shouldOpen.Checked) { Process.Start(location); } var format = ResourceHelper.GetString("CreateGist.GistSuccessFormat"); ASContext.SetStatusText((string.Format(format, location))); } catch (Exception ex) { ASContext.SetStatusText(ResourceHelper.GetString("CreateGist.GistErrorString")); Debug.WriteLine(ex); } this.SaveSettings(); this.Close(); }
private void onTimedDelete(object source, ElapsedEventArgs e) { Control ctrl = mainForm.CurDocument as Control; if (ctrl != null && ctrl.InvokeRequired) { ctrl.BeginInvoke(new ElapsedEventHandler(onTimedDelete), new object[] { source, e }); } else { if (File.Exists(fullWatchedPath)) { File.Delete(fullWatchedPath); mainForm.AddTraceLogEntry("Done(0)", -2); mainForm.DispatchEvent(new NotifyEvent(EventType.ProcessEnd)); ASContext.SetStatusText("Asc Done"); } } }
private void onTimedDelete(object source, ElapsedEventArgs e) { Control ctrl = PluginBase.MainForm.CurrentDocument as Control; if (ctrl != null && ctrl.InvokeRequired) { ctrl.BeginInvoke(new ElapsedEventHandler(onTimedDelete), new object[] { source, e }); } else { if (File.Exists(fullWatchedPath)) { File.Delete(fullWatchedPath); TraceManager.Add("Done(0)", -2); EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, "Done(0)")); ASContext.SetStatusText("Asc Done"); } } }
public void CheckAS3(string filename) { if (flex2Shell == null) { UpdateSettings(); } if (!sdkOk) { ErrorHandler.ShowInfo("Set the path to the Flex 2 SDK in the program settings."); return; } if (!File.Exists(filename)) { return; } mainForm.CallCommand("Save", null); try { mainForm.DispatchEvent(new NotifyEvent(EventType.ProcessStart)); if (ascRunner == null || !ascRunner.isRunning) { StartAscRunner(); } mainForm.AddTraceLogEntry("AscShell command: " + filename, -1); StringBuilder sb = new StringBuilder(filename.Length); GetShortPathName(filename, sb, (uint)filename.Length); string shortname = sb.ToString().Replace(".AS", ".as"); WatchFile(shortname); //filename); ASContext.SetStatusText("Asc Running"); notificationSent = false; ascRunner.process.StandardInput.WriteLine("clear"); ascRunner.process.StandardInput.WriteLine("asc -p " + shortname); } catch (Exception ex) { ErrorHandler.ShowError("Error while running the AS3 syntax checking.", ex); } }
public void CheckAS3(string filename) { if (!File.Exists(filename)) { return; } string ascPath = null; // Try Flex2SDK string flex2Path = ProjectManager.PluginMain.Settings.Flex2SdkPath; if (flex2Path != null && Directory.Exists(flex2Path)) { ascPath = Path.Combine(flex2Path, "lib\\asc.jar"); } // Try Flash CS3 if (ascPath == null) { ascPath = FindAscAuthoring(); } if (ascPath == null) { ErrorManager.ShowInfo(TextHelper.GetString("Info.SetFlex2OrCS3Path")); return; } try { EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart)); // direct execution instead of the shell ASContext.SetStatusText("Asc Running"); notificationSent = false; WatchFile(filename); StartAscRunner(ascPath, filename); } catch (Exception ex) { ErrorManager.ShowError(ex); } }
private void ascRunner_OutputError(object sender, string line) { Control ctrl = mainForm.CurDocument as Control; if (ctrl != null && ctrl.InvokeRequired) { ctrl.BeginInvoke(new ProcessOutputHandler(ascRunner_OutputError), new object[] { sender, line }); } else { mainForm.AddTraceLogEntry(line, -3); if (!notificationSent) { notificationSent = true; ASContext.SetStatusText("Asc Done"); mainForm.AddTraceLogEntry("Done(1)", -2); mainForm.DispatchEvent(new NotifyEvent(EventType.ProcessEnd)); mainForm.DispatchEvent(new TextEvent(EventType.Command, "ShowResults")); } } }
private void ascRunner_OutputError(object sender, string line) { Control ctrl = PluginBase.MainForm.CurrentDocument as Control; if (ctrl != null && ctrl.InvokeRequired) { ctrl.BeginInvoke(new ProcessOutputHandler(ascRunner_OutputError), new object[] { sender, line }); } else { TraceManager.Add(line, -3); if (!notificationSent) { notificationSent = true; ASContext.SetStatusText("Asc Done"); TraceManager.Add("Done(1)", -2); EventManager.DispatchEvent(this, new TextEvent(EventType.ProcessEnd, "Done(1)")); EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null)); } } }
public void RunMxmlc(string cmd) { if (flex2Shell == null) { UpdateSettings(); } if (!sdkOk) { ErrorHandler.ShowInfo("Set the path to the Flex 2 SDK in the program settings."); return; } // save modified files if needed bool check = ASContext.CheckOnSave; ASContext.CheckOnSave = false; mainForm.CallCommand("SaveAllModified", ".as"); ASContext.CheckOnSave = check; try { mainForm.DispatchEvent(new NotifyEvent(EventType.ProcessStart)); if (mxmlcRunner == null || !mxmlcRunner.isRunning) { StartMxmlcRunner(); } //cmd = mainForm.ProcessArgString(cmd); mainForm.AddTraceLogEntry("MxmlcShell command: " + cmd, -1); ASContext.SetStatusText("Mxmlc Running"); notificationSent = false; mxmlcRunner.process.StandardInput.WriteLine(cmd); } catch (Exception ex) { ErrorHandler.ShowError("Error while running the Flex 2 compiler.", ex); } }
/// <summary> /// Run the Flash IDE with the additional parameters provided /// </summary> /// <param name="parameters"></param> /// <returns>Operation successful</returns> static public bool Run(string pathToIDE, string cmdData) { if (BridgeManager.Active) { pathToIDE = "Flash"; } else { if (pathToIDE != null && Directory.Exists(pathToIDE)) { var exe = Path.Combine(pathToIDE, "Animate.exe"); if (!File.Exists(exe)) { exe = Path.Combine(pathToIDE, "Flash.exe"); } pathToIDE = exe; } if (pathToIDE == null || !File.Exists(pathToIDE)) { string msg = TextHelper.GetString("Info.ConfigureFlashPath"); string title = TextHelper.GetString("Info.ConfigurationRequired"); DialogResult result = MessageBox.Show(msg, title, MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash"); } return(false); } } TimeSpan diff = DateTime.Now.Subtract(lastRun); if (diff.Seconds < 1) { return(false); } lastRun = DateTime.Now; string args = null; if (cmdData != null) { args = PluginBase.MainForm.ProcessArgString(cmdData); if (args.IndexOf('"') < 0) { args = '"' + args + '"'; } } // execution ASContext.SetStatusText(TextHelper.GetString("Info.CallingFlashIDE")); PluginBase.MainForm.CallCommand("SaveAllModified", null); EventManager.DispatchEvent(null, new NotifyEvent(EventType.ProcessStart)); try { string file = args.StartsWith('\"') ? args.Substring(1, args.Length - 2) : args; if (BridgeManager.Active && BridgeManager.Settings.TargetRemoteIDE && File.Exists(file) && Path.GetExtension(file) == ".jsfl" && file[0] <= 'H') { string folder = Path.Combine(BridgeManager.Settings.SharedDrive, ".FlashDevelop\\flashide"); string[] logs = Directory.GetFiles(folder, "*.log"); foreach (string log in logs) { File.Delete(log); } string shared = Path.Combine(folder, Path.GetFileName(file)); File.Copy(file, shared, true); BridgeManager.RemoteOpen(shared); return(true); } } catch { } if (args != null) { ProcessHelper.StartAsync(pathToIDE, args); } else { ProcessHelper.StartAsync(pathToIDE); } return(true); }
public void CheckAS3(string filename, string flexPath, string src) { if (running || filename.EndsWith(".mxml")) { return; } string basePath = null; if (PluginBase.CurrentProject != null) { basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath); } flexPath = PathHelper.ResolvePath(flexPath, basePath); // asc.jar in Flex2SDK if (flexPath != null && Directory.Exists(flexPath)) { if (flexPath.EndsWith("bin", StringComparison.OrdinalIgnoreCase)) { flexPath = Path.GetDirectoryName(flexPath); } ascPath = Path.Combine(flexPath, "lib\\asc.jar"); } // asc_authoring.jar in Flash CS3 if (ascPath == null) { ascPath = FindAscAuthoring(); } if (ascPath == null) { if (src != null) { return; // silent checking } DialogResult result = MessageBox.Show(TextHelper.GetString("Info.SetFlex2OrCS3Path"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { IASContext context = ASContext.GetLanguageContext("as3"); if (context == null) { return; } PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK"); } else if (result == DialogResult.No) { PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash"); } return; } flexShellsPath = CheckResource("FlexShells.jar", flexShellsJar); if (!File.Exists(flexShellsPath)) { if (src != null) { return; // silent checking } ErrorManager.ShowInfo(TextHelper.GetString("Info.ResourceError")); return; } jvmConfig = JvmConfigHelper.ReadConfig(Path.Combine(flexPath ?? "", "bin\\jvm.config")); try { running = true; if (src == null) { EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart)); } if (ascRunner == null || !ascRunner.IsRunning) { StartAscRunner(); } notificationSent = false; if (src == null) { silentChecking = false; //TraceManager.Add("Checking: " + filename, -1); ASContext.SetStatusText(TextHelper.GetString("Info.AscRunning")); ascRunner.HostedProcess.StandardInput.WriteLine(filename); } else { silentChecking = true; ascRunner.HostedProcess.StandardInput.WriteLine(filename + "$raw$"); ascRunner.HostedProcess.StandardInput.WriteLine(src); ascRunner.HostedProcess.StandardInput.WriteLine(filename + "$raw$"); } } catch (Exception ex) { ErrorManager.ShowError(TextHelper.GetString("Info.CheckError"), ex); } }
public void CheckAS3(string filename, string flexPath, string src) { if (running) { return; } // let other plugins preprocess source/handle checking Hashtable data = new Hashtable(); data["filename"] = filename; data["src"] = src; data["ext"] = Path.GetExtension(filename); DataEvent de = new DataEvent(EventType.Command, "AS3Context.CheckSyntax", data); EventManager.DispatchEvent(this, de); if (de.Handled) { return; } src = (string)data["src"]; filename = (string)data["filename"]; if (".mxml" == (string)data["ext"]) // MXML not supported by ASC without preprocessing { return; } string basePath = null; if (PluginBase.CurrentProject != null) { basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath); } flexPath = PathHelper.ResolvePath(flexPath, basePath); // asc.jar in FlexSDK if (flexPath != null && Directory.Exists(Path.Combine(flexPath, "lib"))) { ascPath = Path.Combine(flexPath, "lib\\asc.jar"); } // included asc.jar if (ascPath == null || !File.Exists(ascPath)) { ascPath = PathHelper.ResolvePath(Path.Combine(PathHelper.ToolDir, "flexlibs/lib/asc.jar")); } if (ascPath == null) { if (src != null) { return; // silent checking } DialogResult result = MessageBox.Show(TextHelper.GetString("Info.SetFlex2OrCS3Path"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { IASContext context = ASContext.GetLanguageContext("as3"); if (context == null) { return; } PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK"); } else if (result == DialogResult.No) { PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash"); } return; } flexShellsPath = CheckResource("FlexShells.jar", flexShellsJar); if (!File.Exists(flexShellsPath)) { if (src != null) { return; // silent checking } ErrorManager.ShowInfo(TextHelper.GetString("Info.ResourceError")); return; } jvmConfig = JvmConfigHelper.ReadConfig(flexPath); try { running = true; if (src == null) { EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart)); } if (ascRunner == null || !ascRunner.IsRunning || currentSDK != flexPath) { StartAscRunner(flexPath); } notificationSent = false; if (src == null) { silentChecking = false; //TraceManager.Add("Checking: " + filename, -1); ASContext.SetStatusText(TextHelper.GetString("Info.AscRunning")); ascRunner.HostedProcess.StandardInput.WriteLine(filename); } else { silentChecking = true; ascRunner.HostedProcess.StandardInput.WriteLine(filename + "$raw$"); ascRunner.HostedProcess.StandardInput.WriteLine(src); ascRunner.HostedProcess.StandardInput.WriteLine(filename + "$raw$"); } } catch (Exception ex) { ErrorManager.AddToLog(TextHelper.GetString("Info.CheckError"), ex); TraceManager.AddAsync(TextHelper.GetString("Info.CheckError") + "\n" + ex.Message); } }
public void RunMxmlc(string cmd, string flexPath) { if (running) { return; } string basePath = null; if (PluginBase.CurrentProject != null) { basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath); } flexPath = PathHelper.ResolvePath(flexPath, basePath); if (flexPath != null && Directory.Exists(flexPath)) { if (flexPath.EndsWith("bin", StringComparison.OrdinalIgnoreCase)) { flexPath = Path.GetDirectoryName(flexPath); } mxmlcPath = Path.Combine(Path.Combine(flexPath, "lib"), "mxmlc.jar"); } if (mxmlcPath == null || !File.Exists(mxmlcPath)) { DialogResult result = MessageBox.Show(TextHelper.GetString("Info.OpenCompilerSettings"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { IASContext context = ASContext.GetLanguageContext("as3"); if (context == null) { return; } PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK"); } return; } flexShellsPath = CheckResource("FlexShells.jar", flexShellsJar); if (!File.Exists(flexShellsPath)) { ErrorManager.ShowInfo(TextHelper.GetString("Info.ResourceError")); return; } jvmConfig = JvmConfigHelper.ReadConfig(Path.Combine(flexPath, "bin\\jvm.config")); try { running = true; EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart)); if (mxmlcRunner == null || !mxmlcRunner.IsRunning) { StartMxmlcRunner(flexPath); } //cmd = mainForm.ProcessArgString(cmd); //TraceManager.Add("MxmlcShell command: "+cmd, -1); ASContext.SetStatusText(TextHelper.GetString("Info.MxmlcRunning")); notificationSent = false; mxmlcRunner.HostedProcess.StandardInput.WriteLine(cmd); } catch (Exception ex) { ErrorManager.ShowError(ex); } }