void ShareResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result) { if (state == ResponseState.Success) { Debug.Log("---------------- share successfully - share result :"); Debug.Log(ShareSDKMiniJSON.jsonEncode(result)); EventDispatcher.Instance.TriggerEvent("ShareSDKReceiveMessageEvent", state); } else if (state == ResponseState.Fail) { #if UNITY_ANDROID Debug.Log("fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"]); #elif UNITY_IPHONE Debug.Log("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]); #endif EventDispatcher.Instance.TriggerEvent("ShareSDKReceiveMessageEvent", state); } else if (state == ResponseState.Cancel) { Debug.Log("cancel !"); EventDispatcher.Instance.TriggerEvent("ShareSDKReceiveMessageEvent", state); } }
private void Save() { try { var files = System.IO.Directory.GetFiles(Application.dataPath, "MOB.keypds", System.IO.SearchOption.AllDirectories); string filePath = files [0]; if (File.Exists(filePath)) { Hashtable datastore = new Hashtable(); datastore["MobAppKey"] = appKey; datastore["MobAppSecret"] = appSecret; var json = ShareSDKMiniJSON.jsonEncode(datastore); StreamWriter sWriter = new StreamWriter(filePath); sWriter.WriteLine(json); sWriter.Close(); sWriter.Dispose(); } else { Debug.LogWarning("MOB.keypds no find"); } } catch (Exception e) { Debug.LogWarning("error"); Debug.LogException(e); } }
public override void SetPlatformConfig(Hashtable configs) { String json = ShareSDKMiniJSON.jsonEncode(configs); Debug.Log("AndroidImpl ===>>> SetPlatformConfig === " + json); if (ssdk != null) { ssdk.Call("setPlatformConfig", json); } }
public Hashtable GetShareParams() { if (customizeShareParams.Count > 0) { shareParams["customizeShareParams"] = customizeShareParams; } String jsonStr = ShareSDKMiniJSON.jsonEncode(shareParams); Debug.Log("ParseShareParams ===>>> " + jsonStr); return(shareParams); }
public override void ShareContent(int reqID, PlatformType[] platforms, ShareContent content) { string platTypesStr = null; if (platforms != null) { List <int> platTypesArr = new List <int>(); foreach (PlatformType type in platforms) { platTypesArr.Add((int)type); } platTypesStr = ShareSDKMiniJSON.jsonEncode(platTypesArr.ToArray()); } __iosShareSDKOneKeyShare(reqID, platTypesStr, content.GetShareParamsStr(), _callbackObjectName); }
public override void ShowPlatformListWithContentName(int reqId, string contentName, Hashtable customFields, PlatformType[] platforms, int x, int y) { String customFieldsStr = ShareSDKMiniJSON.jsonEncode(customFields); string platTypesStr = null; if (platforms != null) { List <int> platTypesArr = new List <int>(); foreach (PlatformType type in platforms) { platTypesArr.Add((int)type); } platTypesStr = ShareSDKMiniJSON.jsonEncode(platTypesArr.ToArray()); } __iosShareSDKShowShareMenuWithContentName(reqId, contentName, customFieldsStr, platTypesStr, x, y, _callbackObjectName); }
//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(); } }
public override void SetPlatformConfig(Hashtable configs) { String json = ShareSDKMiniJSON.jsonEncode(configs); __iosShareSDKRegisterAppAndSetPltformsConfig(_appKey, json); }
public override void ShowShareContentEditorWithContentName(int reqId, PlatformType platform, string contentName, Hashtable customFields) { String customFieldsStr = ShareSDKMiniJSON.jsonEncode(customFields); __iosShareSDKShowShareViewWithContentName(reqId, (int)platform, contentName, customFieldsStr, _callbackObjectName); }
public static string toJson(this Dictionary <string, string> obj) { return(ShareSDKMiniJSON.jsonEncode(obj)); }
public static string toJson(this Hashtable obj) { return(ShareSDKMiniJSON.jsonEncode(obj)); }