-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathProjectResource.cs
More file actions
59 lines (49 loc) · 1.81 KB
/
Copy pathProjectResource.cs
File metadata and controls
59 lines (49 loc) · 1.81 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
using RPGCore.Packages;
using System.Diagnostics;
namespace RPGCore.Projects;
public sealed class ProjectResource : IResource
{
public string Name { get; }
public string FullName { get; }
public string Extension { get; }
public ProjectExplorer Explorer { get; }
public ProjectResourceContent Content { get; internal set; }
public ProjectDirectory Directory { get; }
public ProjectResourceDependencies Dependencies { get; }
public ProjectResourceDependencies Dependants { get; }
public ProjectResourceTags Tags { get; }
[DebuggerBrowsable(DebuggerBrowsableState.Never)] IExplorer IResource.Explorer => Explorer;
[DebuggerBrowsable(DebuggerBrowsableState.Never)] IResourceContent IResource.Content => Content;
[DebuggerBrowsable(DebuggerBrowsableState.Never)] IDirectory IResource.Directory => Directory;
[DebuggerBrowsable(DebuggerBrowsableState.Never)] IResourceDependencyCollection IResource.Dependencies => Dependencies;
[DebuggerBrowsable(DebuggerBrowsableState.Never)] IResourceDependencyCollection IResource.Dependants => Dependants;
[DebuggerBrowsable(DebuggerBrowsableState.Never)] IResourceTags IResource.Tags => Tags;
internal ProjectResource(ProjectExplorer explorer, ProjectDirectory directory, string fullName)
{
Explorer = explorer;
Directory = directory;
FullName = fullName;
Name = MakeName(fullName);
Extension = fullName.Substring(fullName.LastIndexOf('.'));
Tags = new ProjectResourceTags();
Dependencies = new ProjectResourceDependencies(Explorer);
Dependants = new ProjectResourceDependencies(Explorer);
}
/// <inheritdoc/>
public override string ToString()
{
return FullName;
}
private string MakeName(string fullname)
{
int pathIndex = fullname.LastIndexOf('/');
if (pathIndex == -1)
{
return fullname;
}
else
{
return fullname.Substring(pathIndex + 1);
}
}
}