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


C# DotNetProject.GetDefaultNamespace方法代码示例

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


在下文中一共展示了DotNetProject.GetDefaultNamespace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateFiles

		public virtual void GenerateFiles (DotNetProject project, string namspace, string referenceName)
		{
			//make sure we have a valid value for the namespace
			if (string.IsNullOrEmpty (namspace)) {
				namspace = project.GetDefaultNamespace (null);
			}
			
			// Create the base directory if it does not exists
			FilePath basePath = GetReferencePath (project, referenceName).CanonicalPath;
			if (!Directory.Exists (basePath))
				Directory.CreateDirectory (basePath);
			
			// Remove old files from the service directory
			List<ProjectFile> toRemove = new List<ProjectFile>(project.Files.GetFilesInPath (basePath));
			foreach (ProjectFile f in toRemove)
				project.Files.Remove (f);
			
			// Generate the wsdl, disco and map files
			string mapSpec = GenerateDescriptionFiles (project, basePath);
			
			// Generate the proxy class
			string proxySpec = CreateProxyFile (project, basePath, namspace + "." + referenceName, "Reference");
			
			ProjectFile mapFile = new ProjectFile (mapSpec);
			mapFile.BuildAction = BuildAction.None;
			mapFile.Subtype = Subtype.Code;
			mapFile.Generator = ProxyGenerator;
			project.Files.Add (mapFile);
			
			ProjectFile proxyFile = new ProjectFile (proxySpec);
			proxyFile.BuildAction = BuildAction.Compile;
			proxyFile.Subtype = Subtype.Code;
			proxyFile.DependsOn = mapFile.FilePath;
			project.Files.Add (proxyFile);
			
			mapFile.LastGenOutput = proxyFile.FilePath.FileName;
			
			item = new WebReferenceItem (engine, project, referenceName, basePath, mapFile);
			
			// Add references to the project if they do not exist
			ProjectReference packageRef;
			
			foreach (string refName in GetAssemblyReferences ()) {
				string targetName = project.TargetRuntime.AssemblyContext.GetAssemblyNameForVersion (refName, null, project.TargetFramework);
				//FIXME: warn when we could not find a matching target assembly
				if (targetName != null) {
					packageRef = new ProjectReference (ReferenceType.Package, targetName);
					if (!project.References.Contains (packageRef))
						project.References.Add (packageRef);
				}
			}
			WebReferencesService.NotifyWebReferencesChanged (project);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:53,代码来源:WebServiceDiscoveryResult.cs


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