コード例 #1
0
        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));
        }