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)MiniJSON.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 = "moba6b6c6d6"; appSecret = "b89d2427a3bc7ad1aea1e1e8c1d36bf3"; } Debug.LogException(e); } }
public override Hashtable GetAuthInfo(PlatformType platform) { //need modify, string credStr = __iosShareSDKGetCredential((int)platform); Hashtable authInfo = (Hashtable)MiniJSON.jsonDecode(credStr); return(authInfo); }
public override Hashtable GetAuthInfo(PlatformType platform) { Debug.Log("AndroidImpl ===>>> GetAuthInfo"); if (ssdk != null) { String result = ssdk.Call <String>("getAuthInfo", (int)platform); return((Hashtable)MiniJSON.jsonDecode(result)); } return(new Hashtable()); }
/// <summary> /// callback the specified data. /// </summary> /// <param name='data'> /// Data. /// </param> private void _Callback(string data) { if (data == null) { return; } Hashtable res = (Hashtable)MiniJSON.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); //LoopShareOnComplete(action, resp); break; } case 2: { Console.WriteLine(data); Hashtable throwable = (Hashtable)res["res"]; OnError(reqID, platform, action, throwable); //LoopShareOnError(action, throwable); break; } case 3: { OnCancel(reqID, platform, action); break; } } }
public override Hashtable GetAuthInfo(PlatformType platform) { Debug.Log("AndroidImpl ===>>> GetAuthInfo"); if (this.ssdk != null) { string json = this.ssdk.Call <string>("getAuthInfo", new object[] { (int)platform }); return((Hashtable)MiniJSON.jsonDecode(json)); } return(new Hashtable()); }
private void _Callback(string data) { if (data == null) { return; } Hashtable res = (Hashtable)MiniJSON.jsonDecode(data); if (res == null || res.Count <= 0) { return; } int status = Convert.ToInt32(res["status"]); int action = Convert.ToInt32(res["action"]); switch (status) { case 1: { Console.WriteLine(data); Hashtable resp = (Hashtable)res["res"]; if (action == 1) { if (getPolicy != null) { getPolicy((string)resp["url"]); } } //LoopShareOnComplete(action, resp); break; } case 2: { //LoopShareOnError(action, throwable); break; } case 3: { break; } } }
private void _RestoreCallBack(string data) { Debug.Log("[sharesdk-unity]_RestoreCallBack:" + data); Hashtable res = (Hashtable)MiniJSON.jsonDecode(data); if (res == null || res.Count <= 0) { return; } string path = res ["path"].ToString(); Hashtable customParams = (Hashtable)res ["params"]; RestoreSceneInfo scene = new RestoreSceneInfo(path, customParams); onRestoreScene(scene); }
private void checkRestoreScene(RestoreSceneConfigure restoreSceneConfig) { Hashtable enableRestoreScene = new Hashtable(); if (restoreSceneConfig != null && restoreSceneConfig.Enable) { enableRestoreScene.Add("open", "1"); if (restoreSceneConfig.capabilititesAssociatedDomain != null) { enableRestoreScene.Add("Capabilitites_AssociatedDomain", restoreSceneConfig.capabilititesAssociatedDomain); enableRestoreScene.Add("Capabilitites_EntitlementsPath", restoreSceneConfig.capabilititesEntitlementsPathInXcode); } else { enableRestoreScene.Add("Capabilitites_AssociatedDomain", ""); enableRestoreScene.Add("Capabilitites_EntitlementsPath", ""); } } 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)MiniJSON.jsonDecode(contents); if (datastore.ContainsKey("ShareSDKRestoreScene")) { datastore["ShareSDKRestoreScene"] = enableRestoreScene; } else { datastore.Add("ShareSDKRestoreScene", enableRestoreScene); } var json = MiniJSON.jsonEncode(datastore); StreamWriter sWriter = new StreamWriter(filePath); sWriter.WriteLine(json); sWriter.Close(); sWriter.Dispose(); } }
//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)MiniJSON.jsonDecode(contents); if (datastore.ContainsKey("ShareSDKPlatforms")) { datastore["ShareSDKPlatforms"] = enablePlatforms; } else { datastore.Add("ShareSDKPlatforms", enablePlatforms); } var json = MiniJSON.jsonEncode(datastore); StreamWriter sWriter = new StreamWriter(filePath); sWriter.WriteLine(json); sWriter.Close(); sWriter.Dispose(); } }
private void _Callback(string data) { if (data == null) { return; } Hashtable hashtable = (Hashtable)MiniJSON.jsonDecode(data); if (hashtable == null || hashtable.Count <= 0) { return; } int num = Convert.ToInt32(hashtable["status"]); int num2 = Convert.ToInt32(hashtable["reqID"]); PlatformType platform = (PlatformType)Convert.ToInt32(hashtable["platform"]); int action = Convert.ToInt32(hashtable["action"]); switch (num) { case 1: { Console.WriteLine(data); Hashtable res = (Hashtable)hashtable["res"]; this.OnComplete(num2, platform, action, res); break; } case 2: { Console.WriteLine(data); Hashtable throwable = (Hashtable)hashtable["res"]; this.OnError(num2, platform, action, throwable); break; } case 3: this.OnCancel(num2, platform, action); break; } }
/// <summary> /// Java callback. /// </summary> /// <param name="message">Message.</param> public void onActionCallback(string message) { if (message == null) { return; } Hashtable res = (Hashtable)MiniJSON.jsonDecode(message); if (res == null || res.Count <= 0) { return; } int status = Convert.ToInt32(res["status"]); int platform = Convert.ToInt32(res["platform"]); int action = Convert.ToInt32(res["action"]); // Success = 1, Fail = 2, Cancel = 3 switch (status) { case 1: { Console.WriteLine(message); Hashtable resp = (Hashtable)res["res"]; OnComplete(platform, action, resp); } break; case 2: { Console.WriteLine(message); Hashtable throwable = (Hashtable)res["res"]; OnError(platform, action, throwable); } break; case 3: { OnCancel(platform, action); } break; } }
//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); if (info.GetType().GetField("app_universalLink") != null) { string app_universalLink = GetValueByName(info, "app_universalLink"); if (app_universalLink != null && app_universalLink.Length > 0) { app_universalLink = app_universalLink.Trim().TrimEnd('/'); if (app_universalLink.Contains("://")) { string[] links = app_universalLink.Split(new[] { "://" }, StringSplitOptions.None); app_universalLink = "applinks:" + links[1]; associatedDomains.Add(app_universalLink); } else { if (app_universalLink.Contains(":")) { associatedDomains.Add(app_universalLink); } else { app_universalLink = "applinks:" + app_universalLink; associatedDomains.Add(app_universalLink); } } } } } } 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)MiniJSON.jsonDecode(contents); if (datastore.ContainsKey("ShareSDKPlatforms")) { datastore["ShareSDKPlatforms"] = enablePlatforms; } else { datastore.Add("ShareSDKPlatforms", enablePlatforms); } //Debug.LogWarning("======================="); Debug.LogWarning(associatedDomains.ToArray()); //if (associatedDomains.Count > 0) //{ var associatedDomains_t = associatedDomains.Distinct(); if (datastore.ContainsKey("AssociatedDomains")) { datastore["AssociatedDomains"] = associatedDomains_t.ToArray(); } else { datastore.Add("AssociatedDomains", associatedDomains_t.ToArray()); } //} var json = MiniJSON.jsonEncode(datastore); StreamWriter sWriter = new StreamWriter(filePath); sWriter.WriteLine(json); sWriter.Close(); sWriter.Dispose(); } }
public static Hashtable hashtableFromJson(this string json) { return(MiniJSON.jsonDecode(json) as Hashtable); }
public static ArrayList arrayListFromJson(this string json) { return(MiniJSON.jsonDecode(json) as ArrayList); }