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);
            }

            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);
            }

            DiscoveryClientResultCollection files = await Task.Run(() => {
                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"));
        }
Esempio n. 2
0
        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"));
        }
Esempio n. 3
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);
                    }
                }
            }
        }
		protected override string GenerateDescriptionFiles (DotNetProject dotNetProject, FilePath basePath)
		{
			if (!dotNetProject.Items.GetAll<WebReferencesDir> ().Any ()) {
				var met = new WebReferencesDir (basePath.ParentDirectory);
				dotNetProject.Items.Add (met);
			}
			
			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 ();
			DiscoveryClientResultCollection files = protocol.WriteAll (basePath, "Reference.map");
			
			foreach (DiscoveryClientResult dr in files)
				dotNetProject.AddFile (new FilePath (dr.Filename).ToAbsolute (basePath), BuildAction.None);
			
			return Path.Combine (basePath, "Reference.map");
		}