private static Boolean BuildDirectyEntry(BaseDirectoryEntry dirEntry, JsonHelper jh, IStorageProviderService service, IStorageProviderSession session) { // build the file entry part if (!BuildFileEntry(dirEntry, jh)) return false; // now take the content var content = jh.GetListProperty("contents"); if (content.Count == 0) return true; // remove all childs dirEntry.ClearChilds(); // add the childs foreach (var jsonContent in content) { // parse the item var jc = new JsonHelper(); if (!jc.ParseJsonMessage(jsonContent)) continue; // check if we have a directory var isDir = jc.GetBooleanProperty("is_dir"); BaseFileEntry fentry; if (isDir) { fentry = new BaseDirectoryEntry("Name", 0, DateTime.Now, service, session); } else { fentry = new BaseFileEntry("Name", 0, DateTime.Now, service, session); } // build the file attributes BuildFileEntry(fentry, jc); // establish parent child realtionship dirEntry.AddChild(fentry); } // set the length dirEntry.Length = dirEntry.Count; // go ahead return true; }
private static IEnumerable<ICloudFileSystemEntry> ParseListOfEntries(IStorageProviderSession session, String json, JsonHelper parser) { if (json == null) return null; if (parser == null) parser = CreateParser(json); if (ContainsError(json, false, parser)) return null; return parser.GetListProperty("data").Select(jsonEntry => ParseSingleEntry(session, jsonEntry)).Where(entry => entry != null); }