-
Notifications
You must be signed in to change notification settings - Fork 309
/
Copy pathProjectDeclaration.cs
78 lines (69 loc) · 2.19 KB
/
ProjectDeclaration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using Rubberduck.Parsing.ComReflection;
using Rubberduck.VBEditor;
using System.Collections.Generic;
using System.Linq;
namespace Rubberduck.Parsing.Symbols
{
public sealed class ProjectDeclaration : Declaration, IDisposable
{
private readonly List<ProjectReference> _projectReferences;
public ProjectDeclaration(
QualifiedMemberName qualifiedName,
string name,
bool isUserDefined)
: base(
qualifiedName,
null,
(Declaration)null,
name,
null,
false,
false,
Accessibility.Implicit,
DeclarationType.Project,
null,
null,
Selection.Home,
false,
null,
isUserDefined)
{
_projectReferences = new List<ProjectReference>();
}
public ProjectDeclaration(ComProject project, QualifiedModuleName module)
: this(module.QualifyMemberName(project.Name), project.Name, false)
{
Guid = project.Guid;
MajorVersion = project.MajorVersion;
MinorVersion = project.MinorVersion;
}
public Guid Guid { get; }
public long MajorVersion { get; }
public long MinorVersion { get; }
public IReadOnlyList<ProjectReference> ProjectReferences
{
get
{
return _projectReferences.OrderBy(reference => reference.Priority).ToList();
}
}
public void AddProjectReference(string referencedProjectId, int priority)
{
if (_projectReferences.Any(p => p.ReferencedProjectId == referencedProjectId))
{
return;
}
_projectReferences.Add(new ProjectReference(referencedProjectId, priority));
}
public void ClearProjectReferences()
{
_projectReferences.Clear();
}
public bool IsDisposed { get; private set; }
public void Dispose()
{
IsDisposed = true;
}
}
}