public void WriteProject(Project project) { this.project = project; try { InternalWriteProject(); } finally { Close(); } }
/// <summary> /// Returns the preferences object for the given project, creates a new one /// if necessary. /// </summary> public static ProjectPreferences GetPrefs(Project project) { string path = project.ProjectPath; if (!preferences.Contains(path)) preferences.Add(path,new ProjectPreferences(path)); return preferences[path] as ProjectPreferences; }
public LibraryAsset(Project project, string path) { Project = project; Path = path; ManualID = null; UpdatePath = null; FontGlyphs = null; Sharepoint = null; SwfMode = SwfAssetMode.Library; }
public static Project Create(string path) { Project project = new Project(path); // default values project.OutputPath = project.Name + ".swf"; project.Classpaths.Add("."); project.Save(); return project; }
public void Add(Project project) { string recentString = project.Name + "?" + project.ProjectPath; foreach (RecentProject recentProject in comboBox.Items) if (recentProject.Name != project.Name) recentString += ";" + recentProject.Name + "?" + recentProject.Path; Settings.RecentProjects = recentString; Rebuild(); }
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 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 void ToggleAlwaysCompile(Project project, string[] paths) { foreach (string path in paths) { bool isTarget = project.IsCompileTarget(path); project.SetCompileTarget(path, !isTarget); } project.Save(); OnProjectModified(paths); }
public void ToggleLibraryAsset(Project project, string[] paths) { foreach (string path in paths) { bool isResource = project.IsLibraryAsset(path); project.SetLibraryAsset(path, !isResource); } project.Save(); OnProjectModified(paths); }
public void ToggleShowHidden(Project project) { project.ShowHiddenPaths = !project.ShowHiddenPaths; project.Save(); OnProjectModified(null); }
public void MoveReferences(Project project, string fromPath, string toPath) { if (project.IsCompileTarget(fromPath)) { project.SetCompileTarget(fromPath,false); project.SetCompileTarget(toPath,true); } if (project.IsLibraryAsset(fromPath)) { project.ChangeAssetPath(fromPath,toPath); } }
public void InsertFile(IMainForm mainForm, Project project, string path, string textToInsert) { bool isInjectionTarget = (project.UsesInjection && path == project.GetAbsolutePath(project.InputPath)); if (!project.IsLibraryAsset(path) && !isInjectionTarget) { string caption = "Insert Resource"; string message = "In order to use this file in your project, " + "you must first embed it as a resource. " + "Would you like to do this now?"; DialogResult result = MessageBox.Show(owner, message, caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) ToggleLibraryAsset(project,new string[]{path}); else return; // cancel } if (textToInsert == null) textToInsert = project.GetAsset(path).ID; if (mainForm.CurSciControl != null) { mainForm.CurSciControl.AddText(textToInsert.Length, textToInsert); mainForm.CurSciControl.Focus(); } else ErrorHandler.ShowInfo("You must have a document open to insert a resource string."); }
public BuildEventRunner(Project project, string[] extraClasspaths) { this.project = project; this.vars = new BuildEventVars(project,extraClasspaths); }
/*public void ClearASCompletion(IMainForm mainForm) { mainForm.CallCommand("PluginCommand",COMMAND_CLEARCLASSCACHE); }*/ #endregion #region Project File Reference Updating public void RemoveAllReferences(Project project, string path) { if (project.IsLibraryAsset(path)) project.SetLibraryAsset(path,false); if (project.IsCompileTarget(path)) project.SetCompileTarget(path,false); }
public ProjectNode(Project project) : base(project.Directory) { isDraggable = false; isRenamable = false; }
public BuildEventVars(Project project, string[] extraClasspaths) { this.project = project; this.extraClasspaths = extraClasspaths; }
public ClasspathNode(Project project, string classpath, string text) : base(classpath) { isDraggable = false; isRenamable = false; Text = text; }
private void OpenProjectSilent(string projectPath) { Project project = projectActions.OpenProjectSilent(projectPath); if (project != null) Project = project; }
public MtascArgumentBuilder(Project project) { this.project = project; }
public AssetCollection(Project project) { this.project = project; }
public ProjectReader(string filename) : base(filename) { project = new Project(filename); WhitespaceHandling = WhitespaceHandling.None; }
public void ToggleHidden(Project project, string[] paths) { foreach (string path in paths) { bool isHidden = project.IsPathHidden(path); project.SetPathHidden(path, !isHidden); } project.Save(); OnProjectModified(null); }
public PropertiesDialog(Project project) { this.project = project; InitializeComponent(); BuildDisplay(); }
public void AddLibraryAsset(Project project, string inDirectory) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = "Add Library Asset"; dialog.Filter = "All files (*.*)|*.*"; dialog.Multiselect = false; if (dialog.ShowDialog() == DialogResult.OK) { string filePath = CopyFile(dialog.FileName,inDirectory); // null means the user cancelled if (filePath == null) return; // add as an asset project.SetLibraryAsset(filePath,true); // ask if you want to keep this file updated string caption = "FlashDevelop"; string message = "Would you like to keep this file updated from the source " + "location? (You can always change this in the 'Options' context menu)"; DialogResult result = MessageBox.Show(owner,message,caption, MessageBoxButtons.YesNo,MessageBoxIcon.Question); if (result == DialogResult.Yes) { LibraryAsset asset = project.GetAsset(filePath); asset.UpdatePath = project.GetRelativePath(dialog.FileName); } project.Save(); OnProjectModified(new string[]{filePath}); } }
public ProjectWriter(Project project, string filename) : base(filename,Encoding.UTF8) { this.project = project; this.Formatting = Formatting.Indented; }
void OpenProject(object sender, EventArgs e) { Project project = projectActions.OpenProject(); if (project != null) Project = project; }
public void AddClass(Project project, string inDirectory) { string caption = "Add New Class"; string label = "Class Name:"; string defaultLine = "NewClass"; LineEntryDialog dialog = new LineEntryDialog(caption, label, defaultLine); if (dialog.ShowDialog() == DialogResult.OK) { try { string name = Path.GetFileNameWithoutExtension(dialog.Line); string path = Path.Combine(inDirectory, name + ".as"); OnFileCreated(path); // figure out the best classpath to build from string classpath = project.AbsoluteClasspaths.GetClosestParent(path); // no luck? try the global classpaths! if (classpath == null) { PathCollection globalPaths = new PathCollection(); foreach (string cp in Settings.GlobalClasspaths.Split(';')) globalPaths.Add(cp); classpath = globalPaths.GetClosestParent(path); } // still no luck? nothing else we can do if (classpath == null) throw new Exception("An appropriate project classpath could not be located to create the class from."); // figure out the full class name cleverly string className = PathHelper.GetRelativePath(classpath,path); className = className.Replace(".as", ""); className = className.Replace(Path.DirectorySeparatorChar, '.'); string constructor = className; int p = className.LastIndexOf('.'); if (p >= 0) constructor = className.Substring(p+1); // MIKA: DETECT EOL AND ENCODING Encoding encoding = this.fdActions.GetDefaultEncoding(); string eolMarker = this.fdActions.GetDefaultEOLMarker(); using (FileStream stream = File.Open(path,FileMode.CreateNew)) { StreamWriter writer = new StreamWriter(stream, encoding); string code = eolMarker; code += "class " + className + eolMarker; code += "{" + eolMarker; code += "\tfunction " + constructor + "()" + eolMarker; code += "\t{" + eolMarker; code += "\t\t"; DocumentSeekRequest = code.Length; code += eolMarker; code += "\t}" + eolMarker; code += "}" + eolMarker; writer.Write(code); writer.Flush(); } OpenFile(path); } catch (Exception exception) { ErrorHandler.ShowInfo("Could not add the class: " + exception.Message); } } }
void CloseProject(object sender, EventArgs e) { Project = null; }
public BuildEventDialog(Project project) { InitializeComponent(); this.project = project; this.vars = new BuildEventVars(project,Settings.GlobalClasspaths.Split(';')); foreach (BuildEventInfo info in vars.GetVars()) Add(info); }