Add classified NTFS path template placeholders
This commit is contained in:
@@ -33,6 +33,9 @@ namespace C4IT_IAM_Engine
|
||||
public sealed class RootPathTemplateContext
|
||||
{
|
||||
public string Server { get; set; } = string.Empty;
|
||||
public string ServerName { get; set; } = string.Empty;
|
||||
public string DfsNamespaceName { get; set; } = string.Empty;
|
||||
public string ShareName { get; set; } = string.Empty;
|
||||
public string[] Segments { get; set; } = Array.Empty<string>();
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Path { get; set; } = string.Empty;
|
||||
@@ -109,6 +112,8 @@ namespace C4IT_IAM_Engine
|
||||
return new RootPathTemplateContext
|
||||
{
|
||||
Server = server,
|
||||
ServerName = server,
|
||||
ShareName = sanitizedPathSegments.Length == 0 ? string.Empty : sanitizedPathSegments[sanitizedPathSegments.Length - 1],
|
||||
Segments = sanitizedPathSegments,
|
||||
Name = sanitizedPathSegments.Length == 0 ? string.Empty : sanitizedPathSegments[sanitizedPathSegments.Length - 1],
|
||||
Path = sanitizedPathSegments.Length == 0 ? string.Empty : JoinSanitizedPathSegments(sanitizedPathSegments, groupNameSanitizeReplacement),
|
||||
@@ -308,6 +313,9 @@ namespace C4IT_IAM_Engine
|
||||
|
||||
var context = rootContext ?? new RootPathTemplateContext();
|
||||
var result = Regex.Replace(templateValue, @"{{\s*ROOT_SERVER\s*}}", context.Server ?? string.Empty, RegexOptions.IgnoreCase);
|
||||
result = Regex.Replace(result, @"{{\s*SERVER_NAME\s*}}", context.ServerName ?? context.Server ?? string.Empty, RegexOptions.IgnoreCase);
|
||||
result = Regex.Replace(result, @"{{\s*DFS_NAMESPACE_NAME\s*}}", context.DfsNamespaceName ?? string.Empty, RegexOptions.IgnoreCase);
|
||||
result = Regex.Replace(result, @"{{\s*SHARE_NAME\s*}}", context.ShareName ?? string.Empty, RegexOptions.IgnoreCase);
|
||||
result = Regex.Replace(result, @"{{\s*ROOT_NAME\s*}}", context.Name ?? string.Empty, RegexOptions.IgnoreCase);
|
||||
result = Regex.Replace(result, @"{{\s*ROOT_PATH(?:\s*\(\s*(\d+)\s*\))?\s*}}", match =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user