XCMod.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.IO;
  4. namespace cn.sharesdk.unity3d.sdkporter
  5. {
  6. public class XCMod
  7. {
  8. // private string group;
  9. // private ArrayList patches;
  10. // private ArrayList libs;
  11. // private ArrayList frameworks;
  12. // private ArrayList headerpaths;
  13. // private ArrayList files;
  14. // private ArrayList folders;
  15. // private ArrayList excludes;
  16. private Hashtable _datastore;
  17. private ArrayList _libs;
  18. public string name { get; private set; }
  19. public string path { get; private set; }
  20. public string group {
  21. get {
  22. return (string)_datastore["group"];
  23. }
  24. }
  25. public ArrayList patches {
  26. get {
  27. return (ArrayList)_datastore["patches"];
  28. }
  29. }
  30. public ArrayList libs {
  31. get {
  32. if( _libs == null ) {
  33. _libs = new ArrayList( ((ArrayList)_datastore["libs"]).Count );
  34. foreach( string fileRef in (ArrayList)_datastore["libs"] ) {
  35. _libs.Add( new XCModFile( fileRef ) );
  36. }
  37. }
  38. return _libs;
  39. }
  40. }
  41. public ArrayList zipPaths {
  42. get{
  43. return (ArrayList)_datastore ["zips"];
  44. }
  45. }
  46. public ArrayList frameworks {
  47. get {
  48. return (ArrayList)_datastore["frameworks"];
  49. }
  50. }
  51. public ArrayList headerpaths {
  52. get {
  53. return (ArrayList)_datastore["headerpaths"];
  54. }
  55. }
  56. public ArrayList librarypaths {
  57. get {
  58. return (ArrayList)_datastore["librarypaths"];
  59. }
  60. }
  61. public Hashtable buildSettings {
  62. get {
  63. return (Hashtable)_datastore["buildSettings"];
  64. }
  65. }
  66. public ArrayList files {
  67. get {
  68. return (ArrayList)_datastore["files"];
  69. }
  70. }
  71. public ArrayList folders {
  72. get {
  73. return (ArrayList)_datastore["folders"];
  74. }
  75. }
  76. public ArrayList excludes {
  77. get {
  78. return (ArrayList)_datastore["excludes"];
  79. }
  80. }
  81. public XCMod( string filename )
  82. {
  83. FileInfo projectFileInfo = new FileInfo( filename );
  84. if( !projectFileInfo.Exists )
  85. {
  86. Debug.LogWarning( "File does not exist." );
  87. }
  88. name = System.IO.Path.GetFileNameWithoutExtension( filename );
  89. path = System.IO.Path.GetDirectoryName( filename );
  90. string contents = projectFileInfo.OpenText().ReadToEnd();
  91. _datastore = (Hashtable)MiniJSON.jsonDecode( contents );
  92. }
  93. }
  94. public class XCModFile
  95. {
  96. public string filePath { get; private set; }
  97. public bool isWeak { get; private set; }
  98. public XCModFile( string inputString )
  99. {
  100. isWeak = false;
  101. if( inputString.Contains( ":" ) ) {
  102. string[] parts = inputString.Split( ':' );
  103. filePath = parts[0];
  104. isWeak = ( parts[1].CompareTo( "weak" ) == 0 );
  105. }
  106. else
  107. {
  108. filePath = inputString;
  109. }
  110. }
  111. }
  112. }