public void Del(string path)
 {
     if (!validPath(path))
     {
         throw new Exception("Illegal path");
     }
     CSOCore.Delete(content, path, sep);
 }
        public void Update(string path, JValue value)
        {
            if (!validPath(path))
            {
                throw new Exception("Illegal path");
            }

            if (value is JContainer jc)
            {
                CSOCore.Update(ref content, path, sep, (jc).content);
            }
            else
            {
                CSOCore.Update(ref content, path, sep, value);
            }
        }
 public void RecursiveIterate(Action <string, JValue> callback)
 {
     CSOCore.Iterate("", (Container)content, (path, node) =>
     {
         if (node is StringContainer sc)
         {
             callback(path, JObject.CreateFromRef(sc));
         }
         else if (node is ArrayContainer ac)
         {
             callback(path, JArray.CreateFromRef(ac));
         }
         else
         {
             callback(path, (JValue)node);
         }
     });
 }
        public JValue QueryCopy(string path, out string foundPath)
        {
            object cpy = CSOCore.QueryRef(content, path, out foundPath, sep).DeepClone();

            if (cpy is JLeaf jl)
            {
                return(jl);
            }
            else
            {
                if (cpy is StringContainer sc)
                {
                    return(JObject.CreateFromRef(sc));
                }
                else
                {
                    return(JArray.CreateFromRef((ArrayContainer)cpy));
                }
            }
        }
        public JValue Query(string path, out string foundPath)
        {
            if (!validPath(path))
            {
                throw new Exception("Illegal path");
            }
            object ptr = CSOCore.QueryRef(content, path, out foundPath, sep);

            if (ptr is JLeaf jl)
            {
                return(jl);
            }
            else
            {
                if (ptr is StringContainer sc)
                {
                    return(JObject.CreateFromRef(sc));
                }
                else
                {
                    return(JArray.CreateFromRef((ArrayContainer)ptr));
                }
            }
        }
 public void CopyOnUpdate(string path, JValue value) => CSOCore.Update(ref content, path, sep, value.DeepClone());
 public bool Exists(string path) => CSOCore.Exists((Container)content, path, sep);