public void UpdateASCompletion(IMainForm mainForm, Project project) { if (project == null) { return; // nothing to do } ArrayList classPaths = new ArrayList(); // add player version classPaths.Add(project.MovieOptions.Version.ToString()); // add project classpaths foreach (string cp in project.AbsoluteClasspaths) { if (Directory.Exists(cp)) { classPaths.Add(cp); } } string[] cpArray = classPaths.ToArray(typeof(string)) as string[]; string cps = string.Join(";", cpArray); mainForm.CallCommand("PluginCommand", "ASCompletion;ClassPath;" + cps); }
private static bool Build(Project project, bool runOutput) { // save modified files mainForm.CallCommand("SaveAllModified", null); string compiler = null; if (project.NoOutput) { // get the compiler for as3 projects, or else the FDBuildCommand pre/post command in FDBuild will fail on "No Output" projects if (project.Language == "as3") { compiler = GetCompilerPath(project); } if (project.PreBuildEvent.Trim().Length == 0 && project.PostBuildEvent.Trim().Length == 0) { // no output and no build commands if (project is AS2Project || project is AS3Project) { ErrorManager.ShowInfo("このプロジェクトはなにも出力せず、コマンドも実行しません。"); } else { ErrorManager.ShowInfo("このプロジェクトは有効な AS2 / AS3 プロジェクトではありません。"); } return(false); } } else { // Ask the project to validate itself string error; project.ValidateBuild(out error); if (error != null) { ErrorManager.ShowInfo(TextHelper.GetString(error)); return(false); } // 出力先が空だったとき if (project.OutputPath.Length < 1) { String info = "プロジェクトをビルドするには、プロジェクトプロパティに SWF ファイルの有効な出力先を設定する必要があります。"; ErrorManager.ShowInfo(info); return(false); } compiler = GetCompilerPath(project); if (compiler == null || (!Directory.Exists(compiler) && !File.Exists(compiler))) { MessageBox.Show("Flex SDK へのパスが間違っています。プロジェクトプロパティのコンパイル設定を修正してください。", "エラー", MessageBoxButtons.OK); return(false); } } return(FDBuild(project, runOutput, compiler)); }
public void Build(Project project, bool runOutput, bool noTrace) { this.runOutput = runOutput; this.project = project; if (project.CompilerOptions.UseMain && project.CompileTargets.Count == 0) { ErrorHandler.ShowInfo("In order to build this project, you must mark one or more classes as \"Always Compile\" in the project Explorer, or turn off the 'UseMain' compiler option."); return; } if (project.OutputPath.Length < 1) { ErrorHandler.ShowInfo("In order to build this project, you must specify a valid Output SWF in the Project Properties."); return; } // save modified files mainForm.CallCommand("SaveAllModified", null); string toolsPath = Path.Combine(Application.StartupPath, "tools"); string fdBuildDir = Path.Combine(toolsPath, "fdbuild"); string fdBuildPath = Path.Combine(fdBuildDir, "fdbuild.exe"); string arguments = ""; if (noTrace) { arguments += " -notrace"; } if (Settings.GlobalClasspaths != null) { foreach (string cp in Environment.ExpandEnvironmentVariables(Settings.GlobalClasspaths).Split(';')) { arguments += " -cp \"" + cp + "\""; } } arguments = arguments.Replace("\\\"", "\""); // c# console args[] bugfix SetStatusBar("Build started..."); // track what classpaths, if any, were missing before the build missingClasspaths.Clear(); foreach (string cp in project.AbsoluteClasspaths) { if (!Directory.Exists(cp)) { missingClasspaths.Add(cp); } } fdProcess.StartProcess(fdBuildPath, "\"" + project.ProjectPath + "\"" + arguments, project.Directory, new ProcessEndedHandler(BuildCallback)); }
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 StartProcess(string process, string arguments, string startupDirectory, ProcessEndedHandler callback) { // change current directory savedDirectory = Environment.CurrentDirectory; Environment.CurrentDirectory = startupDirectory; // save callback processEndedHandler = callback; runningProcessNameRequest = process; mainForm.CallCommand("RunProcessCaptured", process + ";" + arguments); // ProcessStartedEventCaught() is called runningProcessNameRequest = null; }
public void UpdateASCompletion(IMainForm mainForm, Project project) { if (project == null) return; // nothing to do ArrayList classPaths = new ArrayList(); // add player version classPaths.Add(project.MovieOptions.Version.ToString()); // add project classpaths foreach (string cp in project.AbsoluteClasspaths) if (Directory.Exists(cp)) classPaths.Add(cp); string[] cpArray = classPaths.ToArray(typeof(string)) as string[]; string cps = string.Join(";", cpArray); mainForm.CallCommand("PluginCommand", "ASCompletion;ClassPath;" + cps); }
public bool Build(Project project, bool runOutput, bool releaseMode) { // save modified files mainForm.CallCommand("SaveAllModified", null); string compiler = null; InstalledSDK sdk = null; if (project.IsCompilable) { sdk = GetProjectSDK(project); compiler = GetCompilerPath(project, sdk); } project.TraceEnabled = !releaseMode; if (project.OutputType == OutputType.OtherIDE) { // compile using associated IDE string error; string command = project.GetOtherIDE(runOutput, releaseMode, out error); if (error != null) { ErrorManager.ShowInfo(TextHelper.GetString(error)); } else { if (command == "FlashIDE") { RunFlashIDE(project, runOutput, releaseMode); } else { Hashtable data = new Hashtable(); data["command"] = command; data["project"] = project; data["runOutput"] = runOutput; data["releaseMode"] = releaseMode; DataEvent de = new DataEvent(EventType.Command, "ProjectManager.RunWithAssociatedIDE", data); EventManager.DispatchEvent(project, de); if (de.Handled) { return(true); } } } return(false); } else if (project.OutputType == OutputType.CustomBuild) { // validate commands not empty if (project.PreBuildEvent.Trim().Length == 0 && project.PostBuildEvent.Trim().Length == 0) { String info = TextHelper.GetString("Info.NoOutputAndNoBuild"); TraceManager.Add(info); } } else if (project.IsCompilable) { // ask the project to validate itself string error; project.ValidateBuild(out error); if (error != null) { ErrorManager.ShowInfo(TextHelper.GetString(error)); return(false); } if (project.OutputPath.Length < 1) { String info = TextHelper.GetString("Info.SpecifyValidOutputSWF"); ErrorManager.ShowInfo(info); return(false); } if (compiler == null || (!Directory.Exists(compiler) && !File.Exists(compiler))) { string info = TextHelper.GetString("Info.CheckSDKSettings"); MessageBox.Show(info, TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OK); return(false); } } // close running AIR projector if (project.MovieOptions.Platform == AS3MovieOptions.AIR_PLATFORM || project.MovieOptions.Platform == AS3MovieOptions.AIR_MOBILE_PLATFORM) { foreach (Process proc in Process.GetProcessesByName("adl")) { try { proc.Kill(); proc.WaitForExit(10 * 1000); } catch { } } } return(FDBuild(project, runOutput, releaseMode, sdk)); }
/** * Handles the incoming events * Receives only events in EventMask */ public void HandleEvent(object sender, NotifyEvent e) { if (e.Type == EventType.Command) { string command = ((TextEvent)e).Text; // Run a process captured relative to the project root if (command.StartsWith("Run;")) { string action = mainForm.ProcessArgString(command.Substring(4)); // environment string projectDir = mainForm.ProcessArgString("@PROJECTDIR"); if (!Directory.Exists(projectDir)) { ErrorHandler.ShowInfo("RunCommand error: no active project."); return; } string cmdPath = Environment.SystemDirectory + @"\cmd.exe"; if (!File.Exists(cmdPath)) { ErrorHandler.ShowInfo("RunCommand error: cmd.exe not found."); return; } string currentDir = Directory.GetCurrentDirectory(); // save files? if (action.StartsWith("SaveAS;")) { action = action.Substring(7); mainForm.CallCommand("SaveAllModified", ".as"); } else if (action.StartsWith("SaveAll;")) { action = action.Substring(8); mainForm.CallCommand("SaveAllModified", null); } // run process try { System.IO.Directory.SetCurrentDirectory(projectDir); mainForm.CallCommand("RunProcessCaptured", cmdPath + ";/c " + action); } catch (Exception ex) { ErrorHandler.ShowError("RunCommand error: " + ex.Message, ex); } finally { System.IO.Directory.SetCurrentDirectory(currentDir); } } // Edit a file in FlashDevelop else if (command.StartsWith("Edit;")) { string file = mainForm.ProcessArgString(command.Substring(5)); if (!File.Exists(file)) { ErrorHandler.ShowInfo("Edit error: File not found.\n" + file); return; } mainForm.OpenSelectedFile(file); } } }
public bool Build(Project project, bool runOutput, bool noTrace) { // save modified files mainForm.CallCommand("SaveAllModified", null); string compiler = null; project.TraceEnabled = !noTrace; if (project.NoOutput) { // get the compiler for as3 projects, or else the FDBuildCommand pre/post command in FDBuild will fail on "No Output" projects if (project.Language == "as3") { compiler = GetCompilerPath(project); } if (project.PreBuildEvent.Trim().Length == 0 && project.PostBuildEvent.Trim().Length == 0) { // no output and no build commands if (project is AS2Project || project is AS3Project) { RunFlashIDE(runOutput, noTrace); } else { String info = TextHelper.GetString("Info.NoOutputAndNoBuild"); ErrorManager.ShowInfo(info); } return(false); } } else { // Ask the project to validate itself string error; project.ValidateBuild(out error); if (error != null) { ErrorManager.ShowInfo(TextHelper.GetString(error)); return(false); } if (project.OutputPath.Length < 1) { String info = TextHelper.GetString("Info.SpecifyValidOutputSWF"); ErrorManager.ShowInfo(info); return(false); } compiler = GetCompilerPath(project); if (compiler == null || (!Directory.Exists(compiler) && !File.Exists(compiler))) { if (usingProjectDefinedCompiler) { string info = TextHelper.GetString("Info.InvalidCustomCompiler"); MessageBox.Show(info, TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OK); } else { string info = String.Format(TextHelper.GetString("Info.SpecifyCompilerPath"), project.Language.ToUpper()); DialogResult result = MessageBox.Show(info, TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { DataEvent de = new DataEvent(EventType.Command, "ASCompletion.ShowSettings", project.Language); EventManager.DispatchEvent(this, de); } } return(false); } } return(FDBuild(project, runOutput, noTrace, compiler)); }