public IDataSnapshot Child(string childName) { JToken next = _token; if (next != null) { foreach (string childPath in new FirebasePath(childName).Segments) { switch (next.Type) { case JTokenType.Property: JProperty prop = (JProperty)next; next = prop.Name == childPath ? prop : null; break; case JTokenType.Object: next = next[childPath]; break; default: next = null; break; } if (next == null) { break; } } } return(new DataSnapshot(_app, _path.Child(childName), next)); }
private bool DeleteFromTarget(FirebasePath targetPath, JToken newData, string path) { if (newData[path].Type == JTokenType.Null) { Delete(targetPath.Child(path)); return(true); } return(false); }
public string Push(FirebasePath path, string data, FirebaseStatusCallback callback) { string childPath = _idGenerator.Next(); if (data != null) { Set(path.Child(childPath), data, callback); } return(childPath); }
private void Merge(FirebasePath root, JToken newData) { JToken found; if (TryGetChild(root, out found)) { if (!UpdateValues(found, newData)) { foreach (var newChild in newData.Children()) { if (DeleteFromTarget(root, newData, newChild.Path)) { continue; } InsertAt(root.Child(newChild.Path), newChild); } } } else { InsertAt(root, newData); } }
public IFirebase Child(string childPath) { return(_app.Child(_path.Child(childPath))); }
internal void SetPriority(FirebasePath path, FirebasePriority priority, FirebaseStatusCallback callback) { Set(path.Child(".priority"), priority.JsonValue, callback); }