/// <summary> /// Called when IDE performs running of compiled programs. /// </summary> /// <param name="project">Project descriptor.</param> /// <returns>True if successful.</returns> public bool onRunProject(IdeProject project) { String projDir = mBridge.GetProjectPath(); if (String.IsNullOrEmpty(projDir)) { return(false); } String binDir = Path.GetFullPath(projDir + @"\" + project.outputDir); if (!Directory.Exists(binDir)) { return(false); } String[] bins = GetListOfBinaries(binDir, "*.itc"); String bin = bins.Length > 0 ? ( bins.Length == 1 ? bins[0] : mBridge.onSelectProgram(bins) // if there is only one compiled program, run it, otherwise use binary selection dialog from IDE. ) : null; if (!String.IsNullOrEmpty(bin)) { return(mBridge.RunIntuicioProgram(bin, true)); // run Intuicio Program if found. } return(false); }
/// <summary> /// Called when new project is created. /// Here just create and fill project descriptor. /// </summary> /// <param name="name">Project name.</param> /// <param name="dir">Project location (directory path)</param> /// <returns></returns> public IdeProject onNewProject(String name, String dir) { // create new project descriptor and fill it with default data. IdeProject proj = new IdeProject(); proj.type = Constants.NAME; // plugin name as project type. proj.name = name; proj.outputDir = "bin"; // compiled binaries output directory. return(proj); }
/// <summary> /// Called after project creation. /// Here you should initialize your project content. /// </summary> /// <param name="project">Project descriptor.</param> /// <returns>True if successful.</returns> public bool onProjectCreated(IdeProject project) { // create main project file. IdeProject.File f = new IdeProject.File(); // file uppercased extension as file type. It can be anything, but that way it's simple to manage. f.type = "BAS"; // file path relative to project directory. f.relativePath = "main.bas"; // add created file to project files list. project.files.Add(f); // then notify IDE (using bridge) to update views with new project content. mBridge.onProjectChanged(project); return(true); }
/// <summary> /// Called when IDE performs project compilation. /// </summary> /// <param name="project">Project descriptor.</param> /// <returns>True if successful.</returns> public bool onBuildProject(IdeProject project) { String projDir = mBridge.GetProjectPath(); if (String.IsNullOrEmpty(projDir)) { return(false); } // iterate over all project script files. foreach (IdeProject.File file in project.files) { // skip script if is not compilable. if (!file.compile) { continue; } // prepare source Tiny BASIC file path. String srcPath = Path.GetFullPath(projDir + @"\" + file.relativePath); // make source path relative to project directory. String relPath = Utils.MakeRelativePath(projDir + @"\", srcPath); // prepare destination Intuicio Assembly script path. String destIscPath = Path.ChangeExtension(Path.GetFullPath(projDir + @"\" + project.outputDir + @"\" + relPath), "isc"); // prepare destination immediate (precompiled) Intuicio Assembly script path. String destImmPath = Path.ChangeExtension(Path.GetFullPath(projDir + @"\" + project.outputDir + @"\" + relPath), "imm"); // prepare destination Intuicio Program path. String destItcPath = Path.ChangeExtension(Path.GetFullPath(projDir + @"\" + project.outputDir + @"\" + relPath), "itc"); // make sure that destination directory exists. Directory.CreateDirectory(Path.GetDirectoryName(destItcPath)); // compile Tiny BASIC script to Intuicio Assembly script. if (!CompileTinyBasic(srcPath, destIscPath)) { return(false); } // compile Intuicio Assembly script to Intuicio Program. if (!mBridge.CompileIntuicioAssembly( destIscPath, // source script path. destItcPath, // destination program path. destImmPath, // immediate file path. new String[] { mBridge.GetSdksPath() // here you can add another search path. })) { return(false); } } return(true); }
/// <summary> /// Called when project is saved. /// </summary> /// <param name="project">Project descriptor.</param> /// <returns>True if succesful.</returns> public bool onSaveProject(IdeProject project) { return(true); }
/// <summary> /// Called when project exists and it was loaded into IDE. /// </summary> /// <param name="project">Project descriptor.</param> /// <returns>True if successful.</returns> public bool onLoadProject(IdeProject project) { return(true); }