Example #1
0
        public override void Delete(WebReferenceItem item)
        {
            base.Delete(item);
            DotNetProject   project = item.Project;
            WebReferenceUrl wru     = project.Items.GetAll <WebReferenceUrl> ().FirstOrDefault(m => m.RelPath.CanonicalPath == item.BasePath);

            if (wru != null)
            {
                project.Items.Remove(wru);
                if (!project.Items.GetAll <WebReferenceUrl> ().Any())
                {
                    WebReferencesDir dir = project.Items.GetAll <WebReferencesDir> ().FirstOrDefault();
                    if (dir != null)
                    {
                        project.Items.Remove(dir);
                    }
                }
            }
        }
        public override async Task Update()
        {
            WebReferenceUrl wru = Item.Project.Items.GetAll <WebReferenceUrl> ().FirstOrDefault(m => m.RelPath.CanonicalPath == Item.BasePath);

            if (wru == null)
            {
                return;
            }

            var wref = await Task.Run(() => (WebServiceDiscoveryResultWS)WebReferencesService.WsEngine.Discover(wru.UpdateFromURL));

            if (wref == null)
            {
                return;
            }

            protocol = wref.protocol;

            // Re-generate the proxy and map files
            await GenerateFiles(Item.Project, Item.Project.DefaultNamespace, Item.Name);
        }
Example #3
0
        public override void Update()
        {
            WebReferenceUrl wru = Item.Project.Items.GetAll <WebReferenceUrl> ().FirstOrDefault(m => m.RelPath.CanonicalPath == Item.BasePath);

            if (wru == null)
            {
                return;
            }

            WebServiceDiscoveryResultWS wref = (WebServiceDiscoveryResultWS)WebReferencesService.WsEngine.Discover(wru.UpdateFromURL);

            if (wref == null)
            {
                return;
            }

            protocol = wref.protocol;

            // Re-generate the proxy and map files
            GenerateFiles(Item.Project, Item.MapFile.Project.Name, Item.Name);
        }
        public override string GetServiceURL()
        {
            WebReferenceUrl wru = Item.Project.Items.GetAll <WebReferenceUrl> ().FirstOrDefault(m => m.RelPath.CanonicalPath == Item.BasePath);

            return(wru == null ? null : wru.ServiceLocationURL);
        }
		protected override string GenerateDescriptionFiles (DotNetProject project, FilePath basePath)
		{
			if (!project.Items.GetAll<WebReferencesDir> ().Any ()) {
				WebReferencesDir met = new WebReferencesDir ();
				met.Path = basePath.ParentDirectory;
				project.Items.Add (met);
			}
			
			WebReferenceUrl wru = project.Items.GetAll<WebReferenceUrl> ().FirstOrDefault (m => m.RelPath.CanonicalPath == basePath);
			if (wru == null) {
				wru = new WebReferenceUrl (protocol.Url);
				wru.RelPath = basePath;
				project.Items.Add (wru);
			}
			
			protocol.ResolveAll ();
			DiscoveryClientResultCollection files = protocol.WriteAll (basePath, "Reference.map");
			
			foreach (DiscoveryClientResult dr in files)
				project.AddFile (new FilePath (dr.Filename).ToAbsolute (basePath), BuildAction.None);
			
			return Path.Combine (basePath, "Reference.map");
		}
		protected override async Task<string> GenerateDescriptionFiles (DotNetProject dotNetProject, FilePath basePath)
		{
			if (!dotNetProject.Items.GetAll<WebReferencesDir> ().Any ()) {
				var met = new WebReferencesDir (basePath.ParentDirectory);
				dotNetProject.Items.Add (met);
			}

			DiscoveryClientResultCollection files = await Task.Run (() => {
				WebReferenceUrl wru = dotNetProject.Items.GetAll<WebReferenceUrl> ().FirstOrDefault (m => m.RelPath.CanonicalPath == basePath);
				if (wru == null) {
					wru = new WebReferenceUrl (protocol.Url);
					wru.RelPath = basePath;
					dotNetProject.Items.Add (wru);
				}

				protocol.ResolveAll ();
				return protocol.WriteAll (basePath, "Reference.map");
			});
			
			foreach (DiscoveryClientResult dr in files)
				dotNetProject.AddFile (new FilePath (Path.GetFileName (dr.Filename)).ToAbsolute (basePath), BuildAction.None);
			
			return Path.Combine (basePath, "Reference.map");
		}
Example #7
0
		static void ImportReferenceUrlItems (DotNetProject project)
		{
			FilePath refsDir = project.BaseDirectory.Combine ("Web References");
			
			foreach (ProjectFile file in project.Files.GetFilesInPath (refsDir)) {
				if (file.Subtype == Subtype.Directory)
					continue;
				if (file.FilePath.ParentDirectory.ParentDirectory != refsDir)
					continue;
				
				if (file.FilePath.Extension == ".map") {
					string url = GetUrl (file.FilePath);
					if (url == null)
						continue;
					var wru = new WebReferenceUrl (url);
					wru.RelPath = file.FilePath.ParentDirectory;
					project.Items.Add (wru);
				}
			}
		}