Esempio n. 1
0
        private bool TryAddProjectReference([NotNull] FileSystemPath path)
        {
            var project = ProjectReferenceResolver.TryResolveProject(path);

            if (project == null)
            {
                return(false);
            }
            MyProjectReferences.Add(path, project);
            return(true);
        }
Esempio n. 2
0
        private bool TryAddReference([NotNull] T4ResolvedPath pathWithMacros)
        {
            var path = AssemblyReferenceResolver.ResolveWithoutCaching(pathWithMacros);

            if (path == null)
            {
                return(false);
            }
            if (MyAssemblyReferences.ContainsKey(path))
            {
                return(false);
            }
            if (MyProjectReferences.ContainsKey(path))
            {
                return(false);
            }
            return(TryAddProjectReference(path) || TryAddAssemblyReference(path));
        }
        private bool TryAddReference(IT4PathWithMacros pathWithMacros)
        {
            var path = AssemblyReferenceResolver.Resolve(pathWithMacros);

            if (path == null)
            {
                return(false);
            }
            if (MyAssemblyReferences.ContainsKey(path))
            {
                return(false);
            }
            if (MyProjectReferences.ContainsKey(path))
            {
                return(false);
            }
            return(TryAddProjectReference(path) || TryAddAssemblyReference(path));
        }
Esempio n. 4
0
        private bool TryRemoveReference([NotNull] T4ResolvedPath pathWithMacros)
        {
            var path = AssemblyReferenceResolver.ResolveWithoutCaching(pathWithMacros);

            if (path == null)
            {
                return(false);
            }
            if (MyAssemblyReferences.TryGetValue(path, out var cookie))
            {
                MyAssemblyReferences.Remove(path);
                cookie.Dispose();
                return(true);
            }

            if (MyProjectReferences.ContainsKey(path))
            {
                MyProjectReferences.Remove(path);
                return(true);
            }

            return(false);
        }