/**These methods write and load a json array. * This allows the app to load more quickly.*/ private void WriteJson(JsonArray data, MainActivity.MovieType type) { Task.Run(() => { File.WriteAllText(context.GetFileStreamPath(type.ToString() + ".json").ToString(), data.ToString()); var v = File.OpenWrite(""); }); }
private JsonArray LoadJson(MainActivity.MovieType type) { try { var str = File.ReadAllText(context.GetFileStreamPath(type.ToString() + ".json").AbsoluteFile.AbsolutePath); return((JsonArray)JsonArray.Parse(str)); } catch { return(new JsonArray()); } }
public void AddData(JsonArray a, MainActivity.MovieType type) { JsonArray write; switch (type) { case MainActivity.MovieType.ALSO: if (also.Equals(a)) { return; } write = also = a; break; case MainActivity.MovieType.OPEN: if (open.Equals(a)) { return; } write = open = a; break; case MainActivity.MovieType.TOP: if (top.Equals(a)) { return; } write = top = a; break; default: return; } WriteJson(write, type); NotifyDataSetChanged(); }