forked from sarbian/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProtoUrlConfig.cs
More file actions
37 lines (32 loc) · 1.06 KB
/
Copy pathProtoUrlConfig.cs
File metadata and controls
37 lines (32 loc) · 1.06 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
using System;
namespace ModuleManager
{
public interface IUrlConfigIdentifier
{
string FileUrl { get; }
string NodeType { get; }
string FullUrl { get; }
}
public interface IProtoUrlConfig : IUrlConfigIdentifier
{
UrlDir.UrlFile UrlFile { get; }
ConfigNode Node { get; }
}
public class ProtoUrlConfig : IProtoUrlConfig
{
public UrlDir.UrlFile UrlFile { get; }
public ConfigNode Node { get; }
public string FileUrl { get; }
public string NodeType => Node.name;
public string FullUrl { get; }
public ProtoUrlConfig(UrlDir.UrlFile urlFile, ConfigNode node)
{
UrlFile = urlFile ?? throw new ArgumentNullException(nameof(urlFile));
Node = node ?? throw new ArgumentNullException(nameof(node));
FileUrl = UrlFile.url + '.' + urlFile.fileExtension;
FullUrl = FileUrl + '/' + Node.name;
if (node.GetValue("name") is string nameValue)
FullUrl += '[' + nameValue + ']';
}
}
}