public static NSDictionary DictionaryWithContentsOfURL(string path, FileUtils.ZipDelegate zip = null) { string text = FileUtils.ReadTextFileFromURL(path); if (zip != null) { text = zip.unZip(text); } return(DictionaryWithContentsOfString(text, zip)); }
public static NSArray ArrayWithContentsOfURL(string path, FileUtils.ZipDelegate zip = null) { string text = FileUtils.ReadTextFileFromURL(path); if (zip != null) { text = zip.unZip(text); } NSArray ary = ArrayWithContentsOfString(text); ary.zip = zip; return(ary); }
static NSDictionary DictionaryWithContentsOfString(string text, FileUtils.ZipDelegate zip = null) { if (text == null || text.Length == 0) { return(null); } try{ text = System.Text.RegularExpressions.Regex.Replace(text, "<.*\\.dtd\">", string.Empty); XmlReaderSettings settings = new XmlReaderSettings(); settings.ProhibitDtd = false; settings.ValidationType = ValidationType.None; XmlDocument xmlDoc = new XmlDocument(); using (StringReader sr = new StringReader(text)) using (XmlReader reader = XmlReader.Create(sr, settings)) { xmlDoc.Load(reader); } // XmlDocument xmlDoc = new XmlDocument(); // xmlDoc.LoadXml (text); XmlNode rootNode = xmlDoc.DocumentElement.ChildNodes[0]; if (rootNode.Name != "dict") { return(null); } NSDictionary dict = NSCollectionUtils.ParseDictionary(rootNode); if (dict != null) { dict.zip = zip; } return(dict); }catch (Exception e) { CCDebug.Warning("NSDicitonary:DictionaryWithContentsOfString:Error:{0}", e); return(null); } }
public NSArray(FileUtils.ZipDelegate zip = null) { _zip = zip; }
public static NSDictionary DictionaryWithContentsOfFileFromResources(string path, FileUtils.ZipDelegate zip = null) { string text = FileUtils.ReadTextFileFromResources(path); if (zip != null) { text = zip.unZip(text); } NSDictionary dict = DictionaryWithContentsOfString(text, zip); return(dict); }
public NSDictionary(FileUtils.ZipDelegate zip = null) { _zip = zip; }