示例#1
0
        public void AddProject(VBProject project)
        {
            if (project.Protection == vbext_ProjectProtection.vbext_pp_locked)
            {
                // adding protected project to parser state is asking for COMExceptions..
                return;
            }

            //assign a hashcode if no helpfile is present
            if (string.IsNullOrEmpty(project.HelpFile))
            {
                project.HelpFile = project.GetHashCode().ToString();
            }

            //loop until the helpfile is unique for this host session
            while (!IsProjectIdUnique(project.HelpFile))
            {
                project.HelpFile = (project.GetHashCode() ^ project.HelpFile.GetHashCode()).ToString();
            }

            var projectId = project.HelpFile;

            if (!_projects.ContainsKey(projectId))
            {
                _projects.Add(projectId, project);
            }

            foreach (VBComponent component in project.VBComponents)
            {
                _moduleStates.TryAdd(new QualifiedModuleName(component), new ModuleState(ParserState.Pending));
            }
        }
示例#2
0
        public static string AssignProjectId(this VBProject project)
        {
            //assign a hashcode if no helpfile is present
            if (string.IsNullOrEmpty(project.HelpFile))
            {
                project.HelpFile = project.GetHashCode().ToString();
            }

            //loop until the helpfile is unique for this host session
            while (!IsProjectIdUnique(project.HelpFile, project.VBE))
            {
                project.HelpFile = (project.GetHashCode() ^ project.HelpFile.GetHashCode()).ToString();
            }

            return(project.HelpFile);
        }
 public static string GetProjectId(VBProject project)
 {
     if (project == null)
     {
         return string.Empty;
     }
     return string.IsNullOrEmpty(project.HelpFile) ? project.GetHashCode().ToString() : project.HelpFile;
 }
示例#4
0
 public static string GetProjectId(VBProject project)
 {
     if (project == null)
     {
         return(string.Empty);
     }
     return(string.IsNullOrEmpty(project.HelpFile) ? project.GetHashCode().ToString() : project.HelpFile);
 }
示例#5
0
 public QualifiedModuleName(VBProject project)
 {
     _component       = null;
     _componentName   = null;
     _project         = project;
     _projectName     = project.Name;
     _projectHashCode = project.GetHashCode();
     _contentHashCode = 0;
 }
  public QualifiedModuleName(VBProject project)  
  {
      _component = null;
      _componentName = null;
      _project = project;
      _projectName = project.Name;
      _projectHashCode = project.GetHashCode();
      _contentHashCode = 0;  
 }
        public void AddProject(VBProject project)
        {
            if (project.Protection == vbext_ProjectProtection.vbext_pp_locked)
            {
                // adding protected project to parser state is asking for COMExceptions..
                return;
            }

            if (string.IsNullOrEmpty(project.HelpFile))
            {
                project.HelpFile = project.GetHashCode().ToString();
            }
            var projectId = project.HelpFile;

            if (!_projects.ContainsKey(projectId))
            {
                _projects.Add(projectId, () => project);
            }

            foreach (var component in project.VBComponents.Cast <VBComponent>())
            {
                _moduleStates.TryAdd(new QualifiedModuleName(component), ParserState.Pending);
            }
        }
 public void AddProject(VBProject project)
 {
     if (string.IsNullOrEmpty(project.HelpFile))
     {
         project.HelpFile = project.GetHashCode().ToString();
     }
     var projectId = project.HelpFile;
     if (!_projects.ContainsKey(projectId))
     {
         _projects.Add(projectId, () => project);
     }
 }