-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVsReference.cs
More file actions
69 lines (61 loc) · 2.89 KB
/
VsReference.cs
File metadata and controls
69 lines (61 loc) · 2.89 KB
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
//*****************************************************************************
//* Code Factory SDK
//* Copyright (c) 2020 CodeFactory, LLC
//*****************************************************************************
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
namespace CodeFactory.VisualStudio
{
/// <summary>
/// Data model that presents a visual studio reference that has been loaded.
/// </summary>
public abstract class VsReference:VsModel,IVsReference
{
#region Property backing fields
private readonly string _filePath;
private readonly ProjectReferenceType _type;
private readonly IReadOnlyList<string> _aliases;
#endregion
/// <summary>
/// Constructor for the base class <see cref="VsModel"/>
/// </summary>
/// <param name="isLoaded">Flag that determines if the model is loaded.</param>
/// <param name="hasErrors">Flag that determines if errors occurred while loading the model.</param>
/// <param name="modelErrors">The list of errors that occurred if any.</param>
/// <param name="name">The name of the model.</param>
/// <param name="filePath">The fully qualified file path to the reference</param>
/// <param name="type">The type of reference that is set for the project.</param>
/// <param name="aliases">Readonly list of the aliases assigned to this reference.</param>
protected VsReference(bool isLoaded, bool hasErrors, IReadOnlyList<ModelException<VisualStudioModelType>> modelErrors,
string name,string filePath, ProjectReferenceType type, IReadOnlyList<string> aliases)
: base(isLoaded, hasErrors, modelErrors, VisualStudioModelType.Reference, name)
{
_filePath = filePath;
_type = type;
_aliases = aliases ?? ImmutableList<string>.Empty;
}
/// <summary>
/// The fully qualified path to the source reference.
/// </summary>
public string FilePath => _filePath;
/// <summary>
/// Flag that determines if the reference has aliases.
/// </summary>
public bool HasAliases => _aliases.Any();
/// <summary>
/// Readonly list of the aliases assigned to this reference.
/// </summary>
public IReadOnlyList<string> Aliases => _aliases;
/// <summary>
/// The type of the project reference.
/// </summary>
public ProjectReferenceType Type => _type;
/// <summary>
/// Gets the <see cref="VsProject"/> model for the project that represents this reference.
/// </summary>
/// <returns>The loaded project model or null if the reference does not support a project based reference.</returns>
public abstract Task<VsProject> GetReferencedProjectAsync();
}
}