Beispiel #1
0
        public XCMod(string filename)
        {
            FileInfo projectFileInfo = new FileInfo(filename);

            if (!projectFileInfo.Exists)
            {
                Debug.LogWarning("File does not exist.");
            }

            name = System.IO.Path.GetFileNameWithoutExtension(filename);
            path = System.IO.Path.GetDirectoryName(filename);

            string contents = projectFileInfo.OpenText().ReadToEnd();

            _datastore = (Hashtable)MiniJSON.jsonDecode(contents);
        }
Beispiel #2
0
        public XCMod(string filename)
        {
            FileInfo projectFileInfo = new FileInfo(filename);

            if (!projectFileInfo.Exists)
            {
                Debug.LogWarning("File does not exist.");
            }

            name = System.IO.Path.GetFileNameWithoutExtension(filename);
            path = System.IO.Path.GetDirectoryName(filename);

            string contents = projectFileInfo.OpenText().ReadToEnd();

            //Debug.Log (contents);
            _datastore = (Hashtable)MiniJSON.jsonDecode(contents);
            if (_datastore == null || _datastore.Count == 0)
            {
                Debug.Log(contents);
                throw new UnityException("Parse error in file " + System.IO.Path.GetFileName(filename) + "! Check for typos such as unbalanced quotation marks, etc.");
            }
        }
Beispiel #3
0
 public static Hashtable hashtableFromJson(this string json)
 {
     return(MiniJSON.jsonDecode(json) as Hashtable);
 }
Beispiel #4
0
 public static ArrayList arrayListFromJson(this string json)
 {
     return(MiniJSON.jsonDecode(json) as ArrayList);
 }