コード例 #1
0
        public bool IsDependentOn(string OtherDocumentFile)
        {
            foreach (var deducedDependency in DocumentInfo.DeducedDependency.Values)
            {
                foreach (var dependencyFile in deducedDependency.BuildState.Keys)
                {
                    if (GR.Path.IsPathEqual(dependencyFile, OtherDocumentFile))
                    {
                        return(true);
                    }
                }
            }

            foreach (var dependency in ForcedDependency.DependentOnFile)
            {
                if (string.Compare(dependency.Filename, System.IO.Path.GetFileName(OtherDocumentFile), true) == 0)
                {
                    return(true);
                }

                // check indirect dependency
                ProjectElement elementDependency = DocumentInfo.Project.GetElementByFilename(dependency.Filename);
                if (elementDependency.IsDependentOn(OtherDocumentFile))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #2
0
        public bool IsDependentOn(string OtherDocumentFile)
        {
            // UGLY HACK to avoid racing condition when accessing the collection while it might be modified by pre parsing tasks
            lock (DocumentInfo.DeducedDependency)
            {
                foreach (var deducedDependency in DocumentInfo.DeducedDependency.Values)
                {
                    foreach (var dependencyFile in deducedDependency.BuildState.Keys)
                    {
                        if (GR.Path.IsPathEqual(dependencyFile, OtherDocumentFile))
                        {
                            return(true);
                        }
                    }
                }
            }

            lock (ForcedDependency.DependentOnFile)
            {
                foreach (var dependency in ForcedDependency.DependentOnFile)
                {
                    if (string.Compare(dependency.Filename, System.IO.Path.GetFileName(OtherDocumentFile), true) == 0)
                    {
                        return(true);
                    }

                    // check indirect dependency
                    ProjectElement elementDependency = DocumentInfo.Project.GetElementByFilename(dependency.Filename);
                    if ((elementDependency != null) &&
                        (elementDependency.IsDependentOn(OtherDocumentFile)))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }