123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- using UnityEngine;
- using System.Collections;
- using System.IO;
- namespace cn.sharesdk.unity3d.sdkporter
- {
- public class XCMod
- {
- // private string group;
- // private ArrayList patches;
- // private ArrayList libs;
- // private ArrayList frameworks;
- // private ArrayList headerpaths;
- // private ArrayList files;
- // private ArrayList folders;
- // private ArrayList excludes;
- private Hashtable _datastore;
- private ArrayList _libs;
-
- public string name { get; private set; }
- public string path { get; private set; }
-
- public string group {
- get {
- return (string)_datastore["group"];
- }
- }
-
- public ArrayList patches {
- get {
- return (ArrayList)_datastore["patches"];
- }
- }
-
- public ArrayList libs {
- get {
- if( _libs == null ) {
- _libs = new ArrayList( ((ArrayList)_datastore["libs"]).Count );
- foreach( string fileRef in (ArrayList)_datastore["libs"] ) {
- _libs.Add( new XCModFile( fileRef ) );
- }
- }
- return _libs;
- }
- }
- public ArrayList zipPaths {
- get{
- return (ArrayList)_datastore ["zips"];
- }
- }
- public ArrayList frameworks {
- get {
- return (ArrayList)_datastore["frameworks"];
- }
- }
-
- public ArrayList headerpaths {
- get {
- return (ArrayList)_datastore["headerpaths"];
- }
- }
- public ArrayList librarypaths {
- get {
- return (ArrayList)_datastore["librarypaths"];
- }
- }
- public Hashtable buildSettings {
- get {
- return (Hashtable)_datastore["buildSettings"];
- }
- }
-
- public ArrayList files {
- get {
- return (ArrayList)_datastore["files"];
- }
- }
-
- public ArrayList folders {
- get {
- return (ArrayList)_datastore["folders"];
- }
- }
-
- public ArrayList excludes {
- get {
- return (ArrayList)_datastore["excludes"];
- }
- }
-
- 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 );
- }
- }
-
- public class XCModFile
- {
- public string filePath { get; private set; }
- public bool isWeak { get; private set; }
-
- public XCModFile( string inputString )
- {
- isWeak = false;
-
- if( inputString.Contains( ":" ) ) {
- string[] parts = inputString.Split( ':' );
- filePath = parts[0];
- isWeak = ( parts[1].CompareTo( "weak" ) == 0 );
- }
- else
- {
- filePath = inputString;
- }
- }
- }
- }
|