public void WriteProject(Project project)
		{
			this.project = project;

			try { InternalWriteProject(); }
			finally { Close(); }
		}
示例#2
0
		/// <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;
		}
示例#3
0
		public LibraryAsset(Project project, string path)
		{
			Project = project;
			Path = path;
			ManualID = null;
			UpdatePath = null;
			FontGlyphs = null;
			Sharepoint = null;
			SwfMode = SwfAssetMode.Library;
		}
示例#4
0
		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;
		}
示例#5
0
		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();
		}
示例#6
0
		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));
		}
示例#7
0
		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);
		}
示例#8
0
		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);
		}
示例#9
0
		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);
		}
示例#10
0
		public void ToggleShowHidden(Project project)
		{
			project.ShowHiddenPaths = !project.ShowHiddenPaths;
			project.Save();
			OnProjectModified(null);
		}
示例#11
0
		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);
			}
		}
示例#12
0
		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.");
		}
示例#13
0
		public BuildEventRunner(Project project, string[] extraClasspaths)
		{
			this.project = project;
			this.vars = new BuildEventVars(project,extraClasspaths);
		}
示例#14
0
		/*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);
		}
示例#15
0
		public ProjectNode(Project project) : base(project.Directory)
		{
			isDraggable = false;
			isRenamable = false;
		}
示例#16
0
		public BuildEventVars(Project project, string[] extraClasspaths)
		{
			this.project = project;
			this.extraClasspaths = extraClasspaths;
		}
示例#17
0
		public ClasspathNode(Project project, string classpath, string text) : base(classpath)
		{
			isDraggable = false;
			isRenamable = false;
			Text = text;
		}
示例#18
0
		private void OpenProjectSilent(string projectPath)
		{
			Project project = projectActions.OpenProjectSilent(projectPath);
			if (project != null)
				Project = project;
		}
		public MtascArgumentBuilder(Project project)
		{
			this.project = project;
		}
示例#20
0
		public AssetCollection(Project project)
		{
			this.project = project;
		}
示例#21
0
		public ProjectReader(string filename) : base(filename)
		{
			project = new Project(filename);
			WhitespaceHandling = WhitespaceHandling.None;
		}
示例#22
0
		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);
		}
示例#23
0
		public PropertiesDialog(Project project)
		{
			this.project = project;

			InitializeComponent();
			BuildDisplay();
		}
示例#24
0
		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});
			}
		}
示例#25
0
		public ProjectWriter(Project project, string filename) : base(filename,Encoding.UTF8)
		{
			this.project = project;
			this.Formatting = Formatting.Indented;
		}
示例#26
0
		void OpenProject(object sender, EventArgs e)
		{
			Project project = projectActions.OpenProject();

			if (project != null)
				Project = project;
		}
示例#27
0
		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);
				}
			}
		}
示例#28
0
		void CloseProject(object sender, EventArgs e)
		{
			Project = null;
		}
示例#29
0
		public BuildEventDialog(Project project)
		{
			InitializeComponent();

			this.project = project;
			this.vars = new BuildEventVars(project,Settings.GlobalClasspaths.Split(';'));

			foreach (BuildEventInfo info in vars.GetVars())
				Add(info);
		}