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


C# Project.FileProjectItem类代码示例

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


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

示例1: FixtureSetUp

		public override void FixtureSetUp()
		{
			base.FixtureSetUp();
			// Set up the project.
			MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
			project.FileName = FileName.Create("c:\\projects\\test\\foo.csproj");
			
			// Web references item.
			WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);
			webReferencesItem.Include = "Web References\\";
			ProjectService.AddProjectItem(project, webReferencesItem);
			
			// Web reference url.
			WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project);
			webReferenceUrl.Include = "http://localhost/test.asmx";
			webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx";
			webReferenceUrl.RelPath = "Web References\\localhost";
			ProjectService.AddProjectItem(project, webReferenceUrl);
			
			FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None);
			discoFileItem.Include = "Web References\\localhost\\test.disco";
			ProjectService.AddProjectItem(project, discoFileItem);

			FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None);
			wsdlFileItem.Include = "Web References\\localhost\\test.wsdl";
			ProjectService.AddProjectItem(project, wsdlFileItem);
			
			// Proxy
			FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile);
			proxyItem.Include = "Web References\\localhost\\Reference.cs";
			proxyItem.DependentUpon = "Reference.map";
			ProjectService.AddProjectItem(project, proxyItem);
			
			// Reference map.
			FileProjectItem mapItem = new FileProjectItem(project, ItemType.None);
			mapItem.Include = "Web References\\localhost\\Reference.map";
			ProjectService.AddProjectItem(project, mapItem);
			
			// System.Web.Services reference.
			ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services");
			ProjectService.AddProjectItem(project, webServicesReferenceItem);
			
			// Set up the web reference.
			DiscoveryClientProtocol	protocol = new DiscoveryClientProtocol();
			DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
			discoveryRef.Url = "http://localhost/new.asmx";
			protocol.References.Add(discoveryRef);
			
			ContractReference contractRef = new ContractReference();
			contractRef.Url = "http://localhost/new.asmx?wsdl";
			contractRef.ClientProtocol = new DiscoveryClientProtocol();
			ServiceDescription desc = new ServiceDescription();
			contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
			protocol.References.Add(contractRef);
			
			WebReferenceTestHelper.InitializeProjectBindings();
			
			var webReference = new Gui.WebReference(project, "http://localhost/new.asmx", "localhost", "ProxyNamespace", protocol);
			changes = webReference.GetChanges(project);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:60,代码来源:WebReferenceChangesTest.cs

示例2: SetUpFixture

		public void SetUpFixture()
		{
			WixProject p = WixBindingTestsHelper.CreateEmptyWixProject();
			
			FileProjectItem item = new FileProjectItem(p, ItemType.None);
			item.Include = "readme.txt";
			ProjectService.AddProjectItem(p, item);
			
			ReferenceProjectItem referenceItem = new ReferenceProjectItem(p);
			referenceItem.Include = "System.Windows.Forms";
			ProjectService.AddProjectItem(p, referenceItem);
			
			item = new FileProjectItem(p, ItemType.Compile);
			item.Include = "setup.wxs";
			ProjectService.AddProjectItem(p, item);
			
			item = new FileProjectItem(p, ItemType.Compile);
			item.Include = "test.wxi";
			ProjectService.AddProjectItem(p, item);
			
			item = new FileProjectItem(p, ItemType.Compile);
			item.Include = "dialogs.wxs";
			ProjectService.AddProjectItem(p, item);
			
			wixFileProjectItemCount = 0;
			
			foreach (FileProjectItem fileItem in p.WixSourceFiles) {
				wixFileProjectItemCount++;
			}
			
			wixSetupFile = p.WixSourceFiles[0];
			wixDialogsFile = p.WixSourceFiles[1];
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:33,代码来源:GetWixSourceFileProjectItemsTestFixture.cs

示例3: GenerateCode

        public void GenerateCode(FileProjectItem item, CustomToolContext context)
        {
            LanguageOption languageToGenerateCode = LanguageOption.GenerateCSharpCode;

            if (item.Project.Language != "C#")
                languageToGenerateCode = LanguageOption.GenerateVBCode;

            XDocument edmxDocument = XDocument.Load(item.FileName);
            XElement conceptualModelsElement = EDMXIO.ReadSection(edmxDocument, EDMXIO.EDMXSection.CSDL);

            if (conceptualModelsElement == null)
                throw new ArgumentException("Input file is not a valid EDMX file.");

            XDocument csdlDocument = new XDocument(new XDeclaration("1.0", "utf-8", null), conceptualModelsElement.Element(XName.Get("Schema", csdlNamespace.NamespaceName)));
            
            string tempFileName = IO.GetTempFilenameWithExtension("csdl");
            csdlDocument.Save(tempFileName);

            string outputFileName = context.GetOutputFileName(item, "Designer");

            EntityCodeGenerator entityCodeGenerator = new EntityCodeGenerator(languageToGenerateCode);
            IList<EdmSchemaError> edmSchemaErrors = entityCodeGenerator.GenerateCode(tempFileName, outputFileName);
            File.Delete(tempFileName);
            
            context.EnsureOutputFileIsInProject(item, outputFileName);
        }
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:26,代码来源:EntityModelCodeGenerator.cs

示例4: TextTemplatingFilePreprocessor

        public TextTemplatingFilePreprocessor(
			ITextTemplatingHost host,
			FileProjectItem templateFile,
			ITextTemplatingCustomToolContext context)
            : base(host, templateFile, context)
        {
        }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:7,代码来源:TextTemplatingFilePreprocessor.cs

示例5: GenerateCode

		public void GenerateCode(FileProjectItem item, CustomToolContext context)
		{
			context.RunAsync(
				()=> {
					string fileName = item.FileName;
					var projectNode = item.Project;
					SpecFlowProject specFlowProject = CreateSpecFlowProjectFrom(projectNode);
					var specFlowGenerator = new SpecFlowGenerator(specFlowProject);
					
					string outputFile = context.GetOutputFileName(item, ".feature");
					
					var specFlowFeatureFile = specFlowProject.GetOrCreateFeatureFile(fileName);
					
					var fileContents = File.ReadAllText(fileName);
					string outputFileContents;
					using(var reader = new StringReader(fileContents)) {
						using (var writer = new StringWriter(new StringBuilder())) {
							specFlowGenerator.GenerateTestFile(specFlowFeatureFile, projectNode.LanguageProperties.CodeDomProvider, reader, writer);
							outputFileContents = writer.ToString();
						}
					}
					File.WriteAllText(outputFile, outputFileContents);
					
					WorkbenchSingleton.SafeThreadCall(
						() => context.EnsureOutputFileIsInProject(item, outputFile));
				});
		}
开发者ID:roffster,项目名称:SpecFlow,代码行数:27,代码来源:SpecFlowSingleFileGenerator.cs

示例6: IsInProjectRootFolder

		bool IsInProjectRootFolder(FileProjectItem item)
		{
			if (item.IsLink) {
				return !HasDirectoryInPath(item.VirtualName);
			}
			return !HasDirectoryInPath(item.Include);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:ProjectItemsInsideProject.cs

示例7: CreateProjectItems

		global::EnvDTE.ProjectItems CreateProjectItems(FileProjectItem projectItem)
		{
			if (projectItem.ItemType == ItemType.Folder) {
				return new DirectoryProjectItems(this);
			}
			return new FileProjectItems(this);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:ProjectItem.cs

示例8: ConvertFile

		protected override void ConvertFile(FileProjectItem sourceItem, FileProjectItem targetItem)
		{
			FixExtensionOfExtraProperties(targetItem, ".cs", ".boo");
			FixExtensionOfExtraProperties(targetItem, ".vb", ".boo");
			
			string ext = Path.GetExtension(sourceItem.FileName);
			if (".cs".Equals(ext, StringComparison.OrdinalIgnoreCase) || ".vb".Equals(ext, StringComparison.OrdinalIgnoreCase)) {
				Module module;
				IList<ICSharpCode.NRefactory.ISpecial> specials;
				CompileUnit compileUnit = new CompileUnit();
				using (StringReader r = new StringReader(ParserService.GetParseableFileContent(sourceItem.FileName))) {
					module = Parser.ParseModule(compileUnit, r, ConvertBuffer.ApplySettings(sourceItem.VirtualName, errors, warnings), out specials);
				}
				if (module == null) {
					conversionLog.AppendLine("Could not parse '" + sourceItem.FileName + "', see error list for details.");
					base.ConvertFile(sourceItem, targetItem);
				} else {
					using (StringWriter w = new StringWriter()) {
						BooPrinterVisitorWithComments printer = new BooPrinterVisitorWithComments(specials, w);
						printer.OnModule(module);
						printer.Finish();
						
						targetItem.Include = Path.ChangeExtension(targetItem.Include, ".boo");
						File.WriteAllText(targetItem.FileName, w.ToString());
					}
				}
			} else {
				base.ConvertFile(sourceItem, targetItem);
			}
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:30,代码来源:ConvertProject.cs

示例9: AddFileToProject

		public FileProjectItem AddFileToProject(string fileName)
		{
			var projectItem = new FileProjectItem(this, ItemType.Compile);
			projectItem.FileName = fileName;
			ProjectService.AddProjectItem(this, projectItem);
			return projectItem;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:7,代码来源:TestableProject.cs

示例10: CreateMvcProjectRazorFile

		public static MvcProjectFile CreateMvcProjectRazorFile(FileProjectItem fileProjectItem)
		{
			if (IsRazorFile(fileProjectItem)) {
				return new MvcProjectFile(fileProjectItem);
			}
			return null;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:7,代码来源:MvcProjectRazorFile.cs

示例11: CreateMvcProjectMasterPageFile

		public static MvcProjectFile CreateMvcProjectMasterPageFile(FileProjectItem fileProjectItem)
		{
			if (IsMasterPageFile(fileProjectItem)) {
				return new MvcProjectFile(fileProjectItem);
			}
			return null;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:MvcProjectMasterPageFile.cs

示例12: ProjectItem

		public ProjectItem(Project project, FileProjectItem projectItem)
		{
			this.projectItem = projectItem;
			this.ContainingProject = project;
			this.ProjectItems = new DirectoryProjectItems(this);
			CreateProperties();
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:7,代码来源:ProjectItem.cs

示例13: SetUpFixture

		public void SetUpFixture()
		{
			RubyMSBuildEngineHelper.InitMSBuildEngine();

			List<ProjectBindingDescriptor> bindings = new List<ProjectBindingDescriptor>();
			using (TextReader reader = RubyBindingAddInFile.ReadAddInFile()) {
				AddIn addin = AddIn.Load(reader, String.Empty);
				bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Ruby")));
			}
			ProjectBindingService.SetBindings(bindings);
			
			convertProjectCommand = new DerivedConvertProjectToRubyProjectCommand();
			parseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent()));
			convertProjectCommand.ParseInfo = parseInfo;
			convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode;
			
			sourceProject = new MockProject();
			sourceProject.Directory = @"d:\projects\test";
			source = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Program.cs");
			targetProject = (RubyProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject);
			target = new FileProjectItem(targetProject, source.ItemType, source.Include);
			source.CopyMetadataTo(target);
			
			textFileSource = new FileProjectItem(sourceProject, ItemType.None, @"src\readme.txt");
			textFileTarget = new FileProjectItem(targetProject, textFileSource.ItemType, textFileSource.Include);
			textFileSource.CopyMetadataTo(textFileTarget);
			
			convertProjectCommand.AddParseableFileContent(source.FileName, sourceCode);
			
			convertProjectCommand.CallConvertFile(source, target);
			convertProjectCommand.CallConvertFile(textFileSource, textFileTarget);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:32,代码来源:ConvertToRubyProjectCommandTestFixture.cs

示例14: SetUpFixture

		public void SetUpFixture()
		{
			project = WebReferenceTestHelper.CreateTestProject("C#");
			project.FileName = FileName.Create("C:\\projects\\test\\foo.csproj");

			protocol = new DiscoveryClientProtocol();
			DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
			discoveryRef.Url = updateFromUrl;
			protocol.References.Add(discoveryRef);
			
			ContractReference contractRef = new ContractReference();
			contractRef.Url = "http://localhost/test.asmx?wsdl";
			contractRef.ClientProtocol = new DiscoveryClientProtocol();
			ServiceDescription desc = new ServiceDescription();
			contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
			protocol.References.Add(contractRef);
			
			WebReferenceTestHelper.InitializeProjectBindings();
			
			webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
			
			webReferenceUrl = webReference.WebReferenceUrl;
			discoFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.disco", ItemType.None);
			referenceMapFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.map", ItemType.None);
			wsdlFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.wsdl", ItemType.None); 
			proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.cs", ItemType.Compile);
			webReferencesProjectItem = (WebReferencesProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, "Web References\\", ItemType.WebReferences);
			webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:29,代码来源:WebReferenceTests.cs

示例15: AreEqual

        public static void AreEqual(FileProjectItem expectedFileItem, FileProjectItem actualFileItem)
        {
            string[] expectedFileItemStrings = GetFileProjectItemAsString(expectedFileItem);
            string[] actualFileItemStrings = GetFileProjectItemAsString(actualFileItem);

            Assert.AreEqual(expectedFileItemStrings, actualFileItemStrings);
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:FileProjectItemAssert.cs


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