コード例 #1
0
		public void WriteProject(Project project)
		{
			this.project = project;

			try { InternalWriteProject(); }
			finally { Close(); }
		}
コード例 #2
0
ファイル: PluginData.cs プロジェクト: heon21st/flashdevelop
		/// <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
ファイル: LibraryAsset.cs プロジェクト: heon21st/flashdevelop
		public LibraryAsset(Project project, string path)
		{
			Project = project;
			Path = path;
			ManualID = null;
			UpdatePath = null;
			FontGlyphs = null;
			Sharepoint = null;
			SwfMode = SwfAssetMode.Library;
		}
コード例 #4
0
ファイル: Project.cs プロジェクト: heon21st/flashdevelop
		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
ファイル: BuildActions.cs プロジェクト: heon21st/flashdevelop
		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
ファイル: OtherNodes.cs プロジェクト: heon21st/flashdevelop
		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
ファイル: OtherNodes.cs プロジェクト: heon21st/flashdevelop
		public ClasspathNode(Project project, string classpath, string text) : base(classpath)
		{
			isDraggable = false;
			isRenamable = false;
			Text = text;
		}
コード例 #18
0
ファイル: PluginMain.cs プロジェクト: heon21st/flashdevelop
		private void OpenProjectSilent(string projectPath)
		{
			Project project = projectActions.OpenProjectSilent(projectPath);
			if (project != null)
				Project = project;
		}
コード例 #19
0
		public MtascArgumentBuilder(Project project)
		{
			this.project = project;
		}
コード例 #20
0
ファイル: LibraryAsset.cs プロジェクト: heon21st/flashdevelop
		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
ファイル: FileActions.cs プロジェクト: heon21st/flashdevelop
		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
ファイル: PluginMain.cs プロジェクト: heon21st/flashdevelop
		void OpenProject(object sender, EventArgs e)
		{
			Project project = projectActions.OpenProject();

			if (project != null)
				Project = project;
		}
コード例 #27
0
ファイル: FileActions.cs プロジェクト: heon21st/flashdevelop
		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
ファイル: PluginMain.cs プロジェクト: heon21st/flashdevelop
		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);
		}