當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。