Exemplo n.º 1
0
        public virtual void GenerateFiles(DotNetProject project, string namspace, string referenceName)
        {
            // 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 gacRef;

            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)
                {
                    gacRef = new ProjectReference(ReferenceType.Gac, targetName);
                    if (!project.References.Contains(gacRef))
                    {
                        project.References.Add(gacRef);
                    }
                }
            }
            WebReferencesService.NotifyWebReferencesChanged(project);
        }
		public virtual void Delete (WebReferenceItem item)
		{
			var toRemove = new List<ProjectFile> (item.Project.Files.GetFilesInPath (item.BasePath));
			foreach (ProjectFile file in toRemove)
				item.Project.Files.Remove (file);
			FileService.DeleteDirectory (item.BasePath);
		}
        public virtual void Delete(WebReferenceItem item)
        {
            List <ProjectFile> toRemove = new List <ProjectFile> (item.Project.Files.GetFilesInPath(item.BasePath));

            foreach (ProjectFile file in toRemove)
            {
                item.Project.Files.Remove(file);
            }
            FileService.DeleteDirectory(item.BasePath);
        }
		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);
		}
		public WebServiceDiscoveryResult (WebServiceEngine engine, WebReferenceItem item)
		{
			this.item = item;
			this.engine = engine;
		}
 public WebServiceDiscoveryResult(WebServiceEngine engine, WebReferenceItem item)
 {
     this.item   = item;
     this.engine = engine;
 }
 public abstract WebServiceDiscoveryResult Load(WebReferenceItem item);
Exemplo n.º 8
0
		public WebReferenceDialog (WebReferenceItem item, ClientOptions options)
		{
			Build ();
			this.isWebService = true;
			this.wcfOptions = options;
			this.namespacePrefix = item.Project.DefaultNamespace;

			ChangeState (DialogState.ModifyConfig);
			
			var service = item.Load ();
			var url = service.GetServiceURL ();

			if (service is WebServiceDiscoveryResultWCF)
				comboModel.Active = 0;
			else
				comboModel.Active = 1;

			UpdateService (service, url);

			tbxReferenceURL.Text = url;
			tbxReferenceName.Text = item.Name;
			tbxNamespace.Text = item.Project.DefaultNamespace;

			frmBrowser.Show ();
			this.Child.Show ();
		}
        public virtual async Task 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
            var 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 = await GenerateDescriptionFiles(project, basePath);

            // Generate the proxy class
            string proxySpec = await CreateProxyFile(project, basePath, namspace + "." + referenceName, "Reference");

            ProjectFile mapFile = project.Files.GetFile(mapSpec);

            if (mapFile == null)
            {
                mapFile = new ProjectFile(mapSpec)
                {
                    BuildAction = BuildAction.None,
                    Subtype     = Subtype.Code,
                    Generator   = ProxyGenerator
                };
                project.Files.Add(mapFile);
            }
            else
            {
                FileService.NotifyFileChanged(mapSpec);
            }

            ProjectFile proxyFile = project.Files.GetFile(proxySpec);

            if (proxyFile == null)
            {
                proxyFile = new ProjectFile(proxySpec)
                {
                    BuildAction = BuildAction.Compile,
                    Subtype     = Subtype.Code,
                    DependsOn   = mapFile.FilePath
                };
                project.Files.Add(proxyFile);
            }
            else
            {
                FileService.NotifyFileChanged(proxySpec);
            }

            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 = ProjectReference.CreateAssemblyReference(targetName);
                    if (!project.References.Contains(packageRef))
                    {
                        project.References.Add(packageRef);
                    }
                }
            }
            WebReferencesService.NotifyWebReferencesChanged(project);
        }
Exemplo n.º 10
0
		public abstract WebServiceDiscoveryResult Load (WebReferenceItem item);