当前位置: 首页>>代码示例>>C#>>正文


C# Projects.Project类代码示例

本文整理汇总了C#中MonoDevelop.Projects.Project的典型用法代码示例。如果您正苦于以下问题:C# Project类的具体用法?C# Project怎么用?C# Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Project类属于MonoDevelop.Projects命名空间,在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateContent

		public override string CreateContent (Project project, Dictionary<string, string> tags, string language)
		{
			if (language == null || language == "")
				throw new InvalidOperationException ("Language not defined in CodeDom based template.");
			
			var binding = GetLanguageBinding (language);
			
			CodeDomProvider provider = null;
			if (binding != null)
				provider = binding.GetCodeDomProvider ();
			
			if (provider == null)
				throw new InvalidOperationException ("The language '" + language + "' does not have support for CodeDom.");

			var xcd = new XmlCodeDomReader ();
			var cu = xcd.ReadCompileUnit (domContent);
			
			foreach (CodeNamespace cns in cu.Namespaces)
				cns.Name = StripImplicitNamespace (project, tags, cns.Name);
			
			CodeGeneratorOptions options = new CodeGeneratorOptions ();
			options.IndentString = "\t";
			options.BracingStyle = "C";
			
			StringWriter sw = new StringWriter ();
			provider.GenerateCodeFromCompileUnit (cu, sw, options);
			sw.Close ();
			
			return StripHeaderAndBlankLines (sw.ToString (), provider);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:30,代码来源:CodeDomFileDescriptionTemplate.cs

示例2: GetFolderContent

		void GetFolderContent (Project project, string folder, out ProjectFileCollection files, out ArrayList folders)
		{
			files = new ProjectFileCollection ();
			folders = new ArrayList ();
			string folderPrefix = folder + Path.DirectorySeparatorChar;
			
			foreach (ProjectFile file in project.Files)
			{
				string dir;

				if (file.Subtype != Subtype.Directory) {
					if (file.DependsOnFile != null)
						continue;
					
					dir = file.IsLink
						? project.BaseDirectory.Combine (file.ProjectVirtualPath).ParentDirectory
						: file.FilePath.ParentDirectory;
						
					if (dir == folder) {
						files.Add (file);
						continue;
					}
				} else
					dir = file.Name;
				
				// add the directory if it isn't already present
				if (dir.StartsWith (folderPrefix)) {
					int i = dir.IndexOf (Path.DirectorySeparatorChar, folderPrefix.Length);
					if (i != -1) dir = dir.Substring (0,i);
					if (!folders.Contains (dir))
						folders.Add (dir);
				}
			}
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:34,代码来源:FolderNodeBuilder.cs

示例3: GetProjectDiagnosticsAsync

		static Task<AnalyzersFromAssembly> GetProjectDiagnosticsAsync (Project project, string language, CancellationToken cancellationToken)
		{
			if (project == null)
				return Task.FromResult (AnalyzersFromAssembly.Empty);
			AnalyzersFromAssembly result;
			if (diagnosticCache.TryGetValue(project, out result)) 
				return Task.FromResult (result);

			result = new AnalyzersFromAssembly ();

			var dotNetProject = project as DotNetProject;
			if (dotNetProject != null) {
				var proxy = new DotNetProjectProxy (dotNetProject);
				if (proxy.HasPackages ()) {
					var packagesPath = new SolutionPackageRepositoryPath (proxy);
					foreach (var file in Directory.EnumerateFiles (packagesPath.PackageRepositoryPath, "*.dll", SearchOption.AllDirectories)) {
						cancellationToken.ThrowIfCancellationRequested ();
						try {
							var asm = Assembly.LoadFrom (file);
							result.AddAssembly (asm);
						} catch (Exception) {
						}
					}
				}
			}
			diagnosticCache[project] = result;
			return Task.FromResult (result);
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:28,代码来源:PackageCodeDiagnosticProvider.cs

示例4: Parse

		public override ParsedDocument Parse (bool storeAst, string fileName, TextReader reader, Project project = null)
		{
			var doc = new DefaultParsedDocument (fileName);
			doc.Flags |= ParsedDocumentFlags.NonSerializable;
			ProjectInformation pi = ProjectInformationManager.Instance.Get (project);
			
			string content = reader.ReadToEnd ();
			string[] contentLines = content.Split (new string[]{Environment.NewLine}, StringSplitOptions.None);
			
			var globals = new DefaultUnresolvedTypeDefinition ("", GettextCatalog.GetString ("(Global Scope)"));
			lock (pi) {
				// Add containers to type list
				foreach (LanguageItem li in pi.Containers ()) {
					if (null == li.Parent && FilePath.Equals (li.File, fileName)) {
						var tmp = AddLanguageItem (pi, globals, li, contentLines) as IUnresolvedTypeDefinition;
						if (null != tmp){ doc.TopLevelTypeDefinitions.Add (tmp); }
					}
				}
				
				// Add global category for unscoped symbols
				foreach (LanguageItem li in pi.InstanceMembers ()) {
					if (null == li.Parent && FilePath.Equals (li.File, fileName)) {
						AddLanguageItem (pi, globals, li, contentLines);
					}
				}
			}
			
			doc.TopLevelTypeDefinitions.Add (globals);
			return doc;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:30,代码来源:CDocumentParser.cs

示例5: ShouldEnableFor

		public override bool ShouldEnableFor (Project proj, string creationPath)
		{
			if (condition == ClrVersionCondition.None)
				return true;
			
			DotNetProject dnp = proj as DotNetProject;
			if (dnp != null) {
				ClrVersion pver = dnp.TargetFramework.ClrVersion;
				switch (condition) {
				case ClrVersionCondition.Equal:
					return (pver == clrVersion);
				case ClrVersionCondition.NotEqual:
					return (pver != clrVersion);
				case ClrVersionCondition.GreaterThan:
					return (pver > clrVersion);
				case ClrVersionCondition.GreaterThanOrEqual:
					return (pver >= clrVersion);
				case ClrVersionCondition.LessThan:
					return (pver < clrVersion);
				case ClrVersionCondition.LessThanOrEqual:
					return (pver <= clrVersion);							
				}
			}
			
			return false;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:26,代码来源:ClrVersionFileTemplateCondition.cs

示例6:

		void IDisposable.Dispose ()
		{
			if (project != null) {
				project.FilePropertyChangedInProject -= OnFilePropertyChangedInProject;
				project = null;
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:ProjectFileDescriptor.cs

示例7: PListEditorWidget

		public PListEditorWidget (IPlistEditingHandler handler, Project proj, PDictionary plist)
		{
			var summaryScrolledWindow = new PListEditorSection ();
			AppendPage (summaryScrolledWindow, new Label (GettextCatalog.GetString ("Summary")));
			
			var advancedScrolledWindow = new PListEditorSection ();
			AppendPage (advancedScrolledWindow, new Label (GettextCatalog.GetString ("Advanced")));
			
			foreach (var section in handler.GetSections (proj, plist)) {
				var expander = new MacExpander () {
					ContentLabel = section.Name,
					Expandable = true,
				};
				expander.SetWidget (section.Widget);
				
				if (section.IsAdvanced) {
					advancedScrolledWindow.AddExpander (expander);
				} else {
					summaryScrolledWindow.AddExpander (expander);
				}
				
				if (section.CheckVisible != null) {
					expander.Visible = section.CheckVisible (plist);
					//capture section for closure
					var s = section;
					plist.Changed += delegate {
						expander.Visible = s.CheckVisible (plist);
					};
				}
			}
			Show ();
		}
开发者ID:hduregger,项目名称:monodevelop,代码行数:32,代码来源:PListEditorWidget.cs

示例8: GeneralProjectOptionsWidget

		public GeneralProjectOptionsWidget (Project project, OptionsDialog dialog)
		{
			Build ();
			
			this.project = project;
			this.dialog = dialog;
			
			nameLabel.UseUnderline = true;
			
			descriptionLabel.UseUnderline = true;

			projectNameEntry.Text = project.Name;
			projectDescriptionTextView.Buffer.Text = project.Description;

			if (project is DotNetProject) {
				projectDefaultNamespaceEntry.Text = ((DotNetProject)project).DefaultNamespace;
			} else if (project is SharedAssetsProject) {
				projectDefaultNamespaceEntry.Text = ((SharedAssetsProject)project).DefaultNamespace;
			} else {
				defaultNamespaceLabel.Visible = false;
				projectDefaultNamespaceEntry.Visible = false;
			}
			
			entryVersion.Text = project.Version;
			checkSolutionVersion.Active = project.SyncVersionWithSolution;
			entryVersion.Sensitive = !project.SyncVersionWithSolution;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:27,代码来源:GeneralProjectOptions.cs

示例9: InstallPackages

		public void InstallPackages (
			string packageSourceUrl,
			Project project,
			IEnumerable<PackageManagementPackageReference> packages)
		{
			InstallPackages (packageSourceUrl, project, packages, licensesAccepted: false);
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:7,代码来源:PackageManagementProjectOperations.cs

示例10: GuiBuilderProject

		public GuiBuilderProject (Project project, string fileName)
		{
			this.fileName = fileName;
			this.Project = project;
			Counters.GuiProjectsLoaded++;
			//GuiBuilderService.NotifyGuiProjectLoaded ();
		}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:7,代码来源:GuiBuilderProject.cs

示例11: AddToProject

		public override bool AddToProject (SolutionItem parent, Project project, string language, string directory, string name)
		{
			// Replace template variables
			
			string cname = Path.GetFileNameWithoutExtension (name);
			string[,] tags = { 
				{"Name", cname},
			};
			
			string content = addinTemplate.OuterXml;
			content = StringParserService.Parse (content, tags);
			
			// Create the manifest
			
			XmlDocument doc = new XmlDocument ();
			doc.LoadXml (content);

			string file = Path.Combine (directory, "manifest.addin.xml");
			doc.Save (file);
			
			project.AddFile (file, BuildAction.EmbeddedResource);
			
			AddinData.EnableAddinAuthoringSupport ((DotNetProject)project);
			return true;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:25,代码来源:AddinFileDescriptionTemplate.cs

示例12: AddFileToProject

        public ProjectFile AddFileToProject(SolutionItem policyParent, Project project, string language, string directory, string name)
        {
            generatedFile = SaveFile (policyParent, project, language, directory, name);
            if (generatedFile != null) {
                string buildAction = this.buildAction ?? project.GetDefaultBuildAction (generatedFile);
                ProjectFile projectFile = project.AddFile (generatedFile, buildAction);

                if (!string.IsNullOrEmpty (dependsOn)) {
                    Dictionary<string,string> tags = new Dictionary<string,string> ();
                    ModifyTags (policyParent, project, language, name, generatedFile, ref tags);
                    string parsedDepName = StringParserService.Parse (dependsOn, tags);
                    if (projectFile.DependsOn != parsedDepName)
                        projectFile.DependsOn = parsedDepName;
                }

                if (!string.IsNullOrEmpty (customTool))
                    projectFile.Generator = customTool;

                DotNetProject netProject = project as DotNetProject;
                if (netProject != null) {
                    // Add required references
                    foreach (string aref in references) {
                        string res = netProject.AssemblyContext.GetAssemblyFullName (aref, netProject.TargetFramework);
                        res = netProject.AssemblyContext.GetAssemblyNameForVersion (res, netProject.TargetFramework);
                        if (!ContainsReference (netProject, res))
                            netProject.References.Add (new ProjectReference (ReferenceType.Package, aref));
                    }
                }

                return projectFile;
            } else
                return null;
        }
开发者ID:brantwedel,项目名称:monodevelop,代码行数:33,代码来源:SingleFileDescriptionTemplate.cs

示例13: GetProjectDeployFiles

		public override DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project, ConfigurationSelector config)
		{
			DeployFileCollection col = base.GetProjectDeployFiles (ctx, project, config);
			
			LinuxDeployData data = LinuxDeployData.GetLinuxDeployData (project);
			
			if (ctx.Platform == "Linux") {
				DotNetProject netProject = project as DotNetProject;
				if (netProject != null) {
					DotNetProjectConfiguration conf = netProject.GetConfiguration (config) as DotNetProjectConfiguration;
					if (conf != null) {
						if (conf.CompileTarget == CompileTarget.Exe || conf.CompileTarget == CompileTarget.WinExe) {
							if (data.GenerateScript) {
								col.Add (GenerateLaunchScript (ctx, netProject, data, conf));
							}
						}
						if (conf.CompileTarget == CompileTarget.Library || conf.CompiledOutputName.FileName.EndsWith (".dll")) {
							if (data.GeneratePcFile) {
								col.Add (GeneratePcFile (ctx, netProject, data, conf));
							}
						}
					}
				}
			}
			
			// If the project is deploying an app.desktop file, rename it to the name of the project.
			foreach (DeployFile file in col) {
				if (Path.GetFileName (file.RelativeTargetPath) == "app.desktop") {
					string dir = Path.GetDirectoryName (file.RelativeTargetPath);
					file.RelativeTargetPath = Path.Combine (dir, data.PackageName + ".desktop");
				}
			}
			
			return col;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:35,代码来源:LinuxDeployExtension.cs

示例14: ShowGettingStarted

		/// <summary>
		/// Shows the getting started page for the given project.
		/// </summary>
		/// <param name="project">The project for which the getting started page should be shown</param>
		/// <param name="pageHint">A hint to the getting started page for cases when the provide may need assistance in determining the correct content to show</param>
		public static void ShowGettingStarted (Project project, string pageHint = null)
		{
			var provider = project.GetGettingStartedProvider ();
			if (provider != null) {
				provider.ShowGettingStarted (project, pageHint);
			}
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:12,代码来源:GettingStarted.cs

示例15: LoadPanelContents

		public void LoadPanelContents (Project project, ItemConfiguration[] configurations)
		{
			this.configurations = configurations;
			
			int signAsm = -1;
			
			keyFile = null;
			foreach (DotNetProjectConfiguration c in configurations) {
				int r = c.SignAssembly ? 1 : 0;
				if (signAsm == -1)
					signAsm = r;
				else if (signAsm != r)
					signAsm = 2;
				if (keyFile == null)
					keyFile = c.AssemblyKeyFile;
				else if (keyFile != c.AssemblyKeyFile)
					keyFile = "?";
			}
			
			if (signAsm == 2)
				signAssemblyCheckbutton.Inconsistent = true;
			else {
				signAssemblyCheckbutton.Inconsistent = false;
				signAssemblyCheckbutton.Active = signAsm == 1;
			}
			
			if (keyFile == null || keyFile == "?")
				this.strongNameFileEntry.Path = string.Empty;
			else
				this.strongNameFileEntry.Path = keyFile;
			
			this.strongNameFileEntry.DefaultPath = project.BaseDirectory;
			this.strongNameFileLabel.Sensitive = this.strongNameFileEntry.Sensitive = signAsm != 0;
			this.signAssemblyCheckbutton.Toggled += new EventHandler (SignAssemblyCheckbuttonActivated);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:35,代码来源:CommonAssemblySigningPreferences.cs


注:本文中的MonoDevelop.Projects.Project类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。