Ejemplo n.º 1
0
		internal String GetEmptyPath()
		{
			if (_stackScope.Count == 0)
				return null;
			ScopeElem scope = _stackScope.Peek();
			String result = scope.Scope;
			if (scope.Replace != null)
				return scope.Replace(result);
			return result;
		}
Ejemplo n.º 2
0
        internal String GetEmptyPath()
        {
            if (_stackScope.Count == 0)
            {
                return(null);
            }
            ScopeElem scope  = _stackScope.Peek();
            String    result = scope.Scope;

            if (scope.Replace != null)
            {
                return(scope.Replace(result));
            }
            return(result);
        }
Ejemplo n.º 3
0
        private String GetNormalizedPathInternal(String path, Boolean isWrapped = false)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            const String rootKey = "Root.";

            if (_stackScope.Count == 0)
            {
                if (path == "Root")
                {
                    return("$data");
                }
                return(path.Replace(rootKey, "$data."));
            }
            if (path.StartsWith("Parent."))
            {
                return(path);
            }
            if (path.StartsWith(rootKey))
            {
                return("$data." + path.Substring(rootKey.Length));
            }
            ScopeElem scope  = _stackScope.Peek();
            String    result = scope.Scope;

            if (!String.IsNullOrEmpty(path))
            {
                if (isWrapped)
                {
                    result += $"['{path.Replace("'", "\\'")}']";
                }
                else
                {
                    result += "." + path;
                }
            }
            if (scope.Replace != null)
            {
                return(scope.Replace(result));
            }
            return(result);
        }
Ejemplo n.º 4
0
		private String GetNormalizedPathInternal(String path)
		{
			if (path == null)
				throw new ArgumentNullException(nameof(path));
			const String rootKey = "Root.";
			if (_stackScope.Count == 0)
			{
				if (path == "Root")
					return "$data";
				return path.Replace(rootKey, "$data.");
			}
			if (path.StartsWith("Parent."))
				return path;
			if (path.StartsWith(rootKey))
				return "$data." + path.Substring(rootKey.Length);
			ScopeElem scope = _stackScope.Peek();
			String result = scope.Scope;
			if (!String.IsNullOrEmpty(path))
				result += "." + path;
			if (scope.Replace != null)
				return scope.Replace(result);
			return result;
		}