MonoDevelop.Projects.ProjectFile.ResolveParent C# (CSharp) Method

ResolveParent() private method

private ResolveParent ( ) : bool
return bool
		internal bool ResolveParent ()
		{
			if (dependsOnFile == null && (!string.IsNullOrEmpty (dependsOn) && project != null)) {
				//NOTE also that the dependent files are always assumed to be in the same directory
				//This matches VS behaviour
				string parentPath = Path.Combine (Path.GetDirectoryName (FilePath), Path.GetFileName (DependsOn));

				//don't allow cyclic references
				if (parentPath == FilePath) {
					MonoDevelop.Core.LoggingService.LogWarning ("Cyclic dependency in project '{0}': file '{1}' depends on '{2}'", project == null ? "(none)" : project.Name, FilePath, parentPath);
					return true;
				}

				dependsOnFile = project.Files.GetFile (parentPath);
				if (dependsOnFile != null) {
					if (dependsOnFile.dependentChildren == null)
						dependsOnFile.dependentChildren = new List<ProjectFile> ();
					dependsOnFile.dependentChildren.Add (this);
					return true;
				} else {
					return false;
				}
			} else {
				return true;
			}
		}
		#endregion

Usage Example

Exemplo n.º 1
0
        internal void ResolveDependencies(ProjectFile file)
        {
            if (!DependencyResolutionEnabled)
            {
                return;
            }

            if (!file.ResolveParent())
            {
                unresolvedDeps.Add(file);
            }

            List <ProjectFile> resolved = null;

            foreach (ProjectFile unres in unresolvedDeps.GetUnresolvedFilesForPath(file.FilePath))
            {
                if (string.IsNullOrEmpty(unres.DependsOn))
                {
                    if (resolved == null)
                    {
                        resolved = new List <ProjectFile> ();
                    }
                    resolved.Add(unres);
                }
                if (unres.ResolveParent(file))
                {
                    if (resolved == null)
                    {
                        resolved = new List <ProjectFile> ();
                    }
                    resolved.Add(unres);
                }
            }
            if (resolved != null)
            {
                foreach (ProjectFile pf in resolved)
                {
                    unresolvedDeps.Remove(pf);
                }
            }
        }
All Usage Examples Of MonoDevelop.Projects.ProjectFile::ResolveParent