示例#1
0
 private void Prepare()
 {
     try
     {
         var      files           = System.IO.Directory.GetFiles(Application.dataPath, "MOB.keypds", System.IO.SearchOption.AllDirectories);
         string   filePath        = files [0];
         FileInfo projectFileInfo = new FileInfo(filePath);
         if (projectFileInfo.Exists)
         {
             StreamReader sReader  = projectFileInfo.OpenText();
             string       contents = sReader.ReadToEnd();
             sReader.Close();
             sReader.Dispose();
             Hashtable datastore = (Hashtable)ShareSDKMiniJSON.jsonDecode(contents);
             appKey    = (string)datastore["MobAppKey"];
             appSecret = (string)datastore["MobAppSecret"];
         }
         else
         {
             Debug.LogWarning("MOB.keypds no find");
         }
     }
     catch (Exception e)
     {
         if (appKey.Length == 0)
         {
             appKey    = "287b2742f28ca";
             appSecret = "a66d8dcdfc0a8b332f3a311ae6738014";
         }
         Debug.LogException(e);
     }
 }
示例#2
0
        public override Hashtable GetAuthInfo(PlatformType platform)
        {
            //need modify,
            string    credStr  = __iosShareSDKGetCredential((int)platform);
            Hashtable authInfo = (Hashtable)ShareSDKMiniJSON.jsonDecode(credStr);

            return(authInfo);
        }
示例#3
0
 public override Hashtable GetAuthInfo(PlatformType platform)
 {
     Debug.Log("AndroidImpl  ===>>>  GetAuthInfo");
     if (ssdk != null)
     {
         String result = ssdk.Call <String>("getAuthInfo", (int)platform);
         return((Hashtable)ShareSDKMiniJSON.jsonDecode(result));
     }
     return(new Hashtable());
 }
示例#4
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)ShareSDKMiniJSON.jsonDecode(contents);
        }
示例#5
0
        /// <summary>
        /// callback the specified data.
        /// </summary>
        /// <param name='data'>
        /// Data.
        /// </param>
        private void _Callback(string data)
        {
            if (data == null)
            {
                return;
            }

            Hashtable res = (Hashtable)ShareSDKMiniJSON.jsonDecode(data);

            if (res == null || res.Count <= 0)
            {
                return;
            }

            int          status   = Convert.ToInt32(res["status"]);
            int          reqID    = Convert.ToInt32(res["reqID"]);
            PlatformType platform = (PlatformType)Convert.ToInt32(res["platform"]);
            int          action   = Convert.ToInt32(res["action"]);

            // Success = 1, Fail = 2, Cancel = 3
            switch (status)
            {
            case 1:
            {
                Console.WriteLine(data);
                Hashtable resp = (Hashtable)res["res"];
                OnComplete(reqID, platform, action, resp);
                break;
            }

            case 2:
            {
                Console.WriteLine(data);
                Hashtable throwable = (Hashtable)res["res"];
                OnError(reqID, platform, action, throwable);
                break;
            }

            case 3:
            {
                OnCancel(reqID, platform, action);
                break;
            }
            }
        }
示例#6
0
        //shareSDK
        private void checkPlatforms(DevInfoSet devInfo)
        {
            Type type = devInfo.GetType();

            FieldInfo[] devInfoFields   = type.GetFields();
            Hashtable   enablePlatforms = new Hashtable();

            foreach (FieldInfo devInfoField in devInfoFields)
            {
                DevInfo info = (DevInfo)devInfoField.GetValue(devInfo);
                if (info.Enable)
                {
                    int    platformId = (int)info.GetType().GetField("type").GetValue(info);
                    string appkey     = GetAPPKey(info, platformId);
                    enablePlatforms.Add(platformId, appkey);
                }
            }
            var      files           = System.IO.Directory.GetFiles(Application.dataPath, "ShareSDK.mobpds", System.IO.SearchOption.AllDirectories);
            string   filePath        = files [0];
            FileInfo projectFileInfo = new FileInfo(filePath);

            if (projectFileInfo.Exists)
            {
                StreamReader sReader  = projectFileInfo.OpenText();
                string       contents = sReader.ReadToEnd();
                sReader.Close();
                sReader.Dispose();
                Hashtable datastore = (Hashtable)ShareSDKMiniJSON.jsonDecode(contents);
                if (datastore.ContainsKey("ShareSDKPlatforms"))
                {
                    datastore["ShareSDKPlatforms"] = enablePlatforms;
                }
                else
                {
                    datastore.Add("ShareSDKPlatforms", enablePlatforms);
                }
                var          json    = ShareSDKMiniJSON.jsonEncode(datastore);
                StreamWriter sWriter = new StreamWriter(filePath);
                sWriter.WriteLine(json);
                sWriter.Close();
                sWriter.Dispose();
            }
        }
示例#7
0
        //读取配置debug.logdebug.log
        private void ReadMobpds(string filePath, string appkey, string savefilePath)
        {
            FileInfo fileInfo = new FileInfo(filePath);

            if (fileInfo.Exists)
            {
                StreamReader sReader  = fileInfo.OpenText();
                string       contents = sReader.ReadToEnd();
                sReader.Close();
                sReader.Dispose();
                Hashtable datastore = (Hashtable)ShareSDKMiniJSON.jsonDecode(contents);
                //savefilePath
                int index = filePath.LastIndexOf("/");
                if (savefilePath == null)
                {
                    savefilePath = filePath;
                    savefilePath = savefilePath.Substring(0, index);
                }
//				Debug.LogWarning (savefilePath);
                //permissionsreplaceAppKeydebug.logdebug.log
                AddPrmissions(datastore);
                //LSApplicationQueriesSchemes
                AddLSApplicationQueriesSchemes(datastore, appkey);
                //folders
                AddFolders(datastore, savefilePath);
                //buildSettings
                AddBuildSettings(datastore);
                //系统库添加
                AddSysFrameworks(datastore);
                //添加非系统 Framework 配置需要设置指定参数
                AddFrameworks(datastore, savefilePath);
                //添加 URLSchemes
                AddURLSchemes(datastore, appkey);
                //添加 InfoPlistSet
                AddInfoPlistSet(datastore, appkey);
                //子平台
                AddPlatformConf(datastore, savefilePath);
                //添加 fileFlags 一些需要特殊设置编译标签的文件 如ARC下MRC
                AddFileFlags(datastore);
            }
        }
示例#8
0
 //for shareSDK
 private void SetPlatformConfList()
 {
     string[] files = Directory.GetFiles(Application.dataPath, "All.pltpds", SearchOption.AllDirectories);
     if (files.Length > 0)
     {
         string   filePath = files[0];
         FileInfo fileInfo = new FileInfo(filePath);
         if (fileInfo.Exists)
         {
             StreamReader sReader  = fileInfo.OpenText();
             string       contents = sReader.ReadToEnd();
             sReader.Close();
             sReader.Dispose();
             platformConfList = (Hashtable)ShareSDKMiniJSON.jsonDecode(contents);
         }
         else
         {
             platformConfList = new Hashtable();
         }
     }
 }
示例#9
0
    //在info.plist中添加 MOBAppkey MOBAppSecret
    private static void AddAPPKey(PlistElementDict plistElements)
    {
        var      files           = System.IO.Directory.GetFiles(Application.dataPath, "MOB.keypds", System.IO.SearchOption.AllDirectories);
        string   filePath        = files [0];
        FileInfo projectFileInfo = new FileInfo(filePath);

        if (projectFileInfo.Exists)
        {
            StreamReader sReader  = projectFileInfo.OpenText();
            string       contents = sReader.ReadToEnd();
            sReader.Close();
            sReader.Dispose();
            Hashtable datastore = (Hashtable)ShareSDKMiniJSON.jsonDecode(contents);
            string    appKey    = (string)datastore["MobAppKey"];
            string    appSecret = (string)datastore["MobAppSecret"];
            plistElements.SetString("MOBAppkey", appKey);
            plistElements.SetString("MOBAppSecret", appSecret);
        }
        else
        {
            Debug.LogWarning("MOB.keypds no find");
        }
    }
示例#10
0
 public static Hashtable hashtableFromJson(this string json)
 {
     return(ShareSDKMiniJSON.jsonDecode(json) as Hashtable);
 }
示例#11
0
 public static ArrayList arrayListFromJson(this string json)
 {
     return(ShareSDKMiniJSON.jsonDecode(json) as ArrayList);
 }