예제 #1
0
        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));
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
 public NSArray(FileUtils.ZipDelegate zip = null)
 {
     _zip = zip;
 }
예제 #5
0
        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);
        }
예제 #6
0
 public NSDictionary(FileUtils.ZipDelegate zip = null)
 {
     _zip = zip;
 }