public void Get(string key, DbContainerAction<string> cb) { Exists (key, delegate (bool exists) { var value = exists ? File.ReadAllText(Path(key)) : ""; cb.Invoke(value); }); }
public void Clear(string key, DbContainerAction<bool> cb) { Exists (key, delegate (bool exists) { if (exists) File.Delete(Path (key)); cb.Invoke(true); }); }
public void Get(string key, DbContainerAction<string> cb) { var request = @" (function(key) { if(typeof(Storage)!=='undefined') { return localStorage[key]; } else { alert('Your browser does not support local storage.'); return ''; } })('" + key + "');"; _comms.Invoke(request, delegate (string response) { cb.Invoke(response); }); }
public void Clear(string key, DbContainerAction<bool> cb) { var request = @" (function(key) { if(typeof(Storage)!=='undefined') { localStorage[key] = null; return 'done'; } else { alert('Your browser does not support local storage.'); return 'fail'; } })('" + key + "');"; _comms.Invoke(request, delegate (string response) { var rtn = response == "done" ? true : false; cb.Invoke(rtn); }); }
public void Set(string key, string value, DbContainerAction<bool> cb) { System.IO.File.WriteAllText(Path(key), value); nLog.Debug ("Wrote file: " + Path (key)); cb.Invoke(true); }
public void Exists(string key, DbContainerAction<bool> cb) { var rtn = File.Exists (Path (key)); cb.Invoke(rtn); }