Exemple #1
0
        public List<Object> ArrayWithContentsOfFile(string pFileName)
        {
            CCSAXParser parser = new CCSAXParser();

            if (false == parser.Init("UTF-8"))
            {
                return null;
            }
            parser.SetDelegator(this);

            //byte[] root;

            StartElement(parser, "dict", null);
            StartElement(parser, "key", null);
            TextHandler(parser, System.Text.UTF8Encoding.UTF8.GetBytes("root"), 4);
            EndElement(parser, "key");

            parser.Parse(pFileName);

            EndElement(parser, "dict");

            return m_pRootDict["root"] as List<Object>;
        }
Exemple #2
0
        public bool ParseXmlString(string data)
        {
            var parser = new CCSAXParser();

            if (false == parser.Init("UTF-8"))
            {
                return false;
            }

            parser.SetDelegator(this);

            return parser.Parse(data, data.Length);
        }
Exemple #3
0
        public Dictionary<string, Object> DictionaryWithContentsOfFile(string pFileName)
        {
            CCSAXParser parser = new CCSAXParser();

            if (false == parser.Init("UTF-8"))
            {
                return null;
            }
            parser.SetDelegator(this);

            parser.Parse(pFileName);
            return m_pRootDict;
        }
Exemple #4
0
        /// <summary>
        /// initalises parsing of an XML file, either a tmx (Map) file or tsx (Tileset) file
        /// </summary>
        public bool ParseXmlFile(string xmlFilename)
        {
            var parser = new CCSAXParser();

            if (false == parser.Init("UTF-8"))
            {
                return false;
            }

            parser.SetDelegator(this);

            return parser.Parse(xmlFilename);
        }