Beispiel #1
0
        private string NormalizeDirPath(string path)
        {
            path = DirPrefix + PathMap <object> .NormalizePath(path).Replace("/", $"/{DirPrefix}");

            path = Path.GetFullPath(Path.Combine(_rootPath, path));
            return(path);
        }
Beispiel #2
0
        private string NormalizeDirJsonPath(string path)
        {
            if (path.Contains("'"))
            {
                throw new InvalidDataException("path cannot contain quotes");
            }

            path = PathMap <object> .NormalizePath(path);

            path = $"['{DirPrefix}" + path.Replace("/", $"'].['{DirPrefix}") + "']";
            return(path);
        }
Beispiel #3
0
        private string NormalizeFilePath(string path)
        {
            path = PathMap <object> .NormalizePath(path);

            // Start by assuming a single path segment, so just the file and no dir
            var dir  = string.Empty;
            var file = path;
            var ndx  = path.LastIndexOf("/");

            if (ndx > 0)
            {
                // Extract out the dir path and the file segment
                dir  = path.Substring(0, ndx);
                file = path.Substring(ndx + 1);
            }

            path = DirPrefix + dir.Replace("/", $"/{DirPrefix}") + $"/{FilePrefix}" + file;
            path = Path.GetFullPath(Path.Combine(_rootPath, path));
            return(path);
        }
Beispiel #4
0
        private string NormalizeFileJsonPath(string path)
        {
            if (path.Contains("'"))
            {
                throw new InvalidDataException("path cannot contain quotes");
            }

            path = PathMap <object> .NormalizePath(path);

            // Start by assuming a single path segment, so just the file and no dir
            var dir  = string.Empty;
            var file = path;
            var ndx  = path.LastIndexOf("/");

            if (ndx > 0)
            {
                // Extract out the dir path and the file segment
                dir  = path.Substring(0, ndx);
                file = path.Substring(ndx + 1);
            }

            path = $"['{DirPrefix}" + dir.Replace("/", $"'].['{DirPrefix}") + $"'].['{FilePrefix}" + file + "']";
            return(path);
        }