using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Firebase.Database.Http;
using Newtonsoft.Json;
namespace Firebase.Database.Streaming {
///
/// The firebase cache.
///
/// Type of top-level entities in the cache.
public class FirebaseCache : IEnumerable> {
private readonly IDictionary dictionary;
private readonly bool isDictionaryType;
private readonly JsonSerializerSettings serializerSettings = new JsonSerializerSettings {
ObjectCreationHandling = ObjectCreationHandling.Replace
};
///
/// Initializes a new instance of the class.
///
public FirebaseCache()
: this(new Dictionary()) {
}
///
/// Initializes a new instance of the class and populates it with existing data.
///
/// The existing items.
public FirebaseCache(IDictionary existingItems) {
dictionary = existingItems;
isDictionaryType = typeof(IDictionary).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo());
}
///
/// The push data.
///
/// The path of incoming data, separated by slash.
/// The data in json format as returned by firebase.
/// Collection of top-level entities which were affected by the push.
public IEnumerable> PushData(string path, string data, bool removeEmptyEntries = true) {
object obj = this.dictionary;
Action