private string ParseSpecificPath(string unresolvedPath, string specificValue, PathResolutionOptions options) { string wrappedSpecificValue = _specificProcessor.WrapSpecificValue(specificValue); bool containsSpecific = unresolvedPath.Contains( wrappedSpecificValue, StringComparison.InvariantCulture ); if (containsSpecific) { if (options.ReturnRelativePath) { string resolvedPath = unresolvedPath.Replace( wrappedSpecificValue, string.Empty ); return(PathHelper.TrimStartDirectorySeparatorChar(resolvedPath)); } string resolvedSpecificValue = _specificProcessor.ResolveSpecificValue( specificValue ); return(unresolvedPath.Replace(wrappedSpecificValue, resolvedSpecificValue)); } string message = "Failed to parse log folder path: invalid specific path value. " + $"Argument: {unresolvedPath}"; throw new ArgumentException(message, nameof(unresolvedPath)); }
public string CreateSpecificPath(string specificValue, string?additionalPath, PathCreationOptions?options) { specificValue.ThrowIfNullOrWhiteSpace(nameof(specificValue)); options ??= new PathCreationOptions(); string wrappedValue = _specificProcessor.WrapSpecificValue(specificValue); string mainPartOfPath = options.ShouldResolvePath ? _pathResolver.Resolve(wrappedValue) : wrappedValue; return(CombineFinalPath(mainPartOfPath, additionalPath, options)); }