private static bool IsPackageExist(string pkgName) { try { // removing .unitypackage............. int index = pkgName.IndexOf(".unitypackage"); if (index > 0) { pkgName.Remove(index); } string fileRelativePath = Path.Combine("psdk", Path.Combine("versions", pkgName + ".unitypackage.version.txt")); string version = PsdkUtils.ReadStreamingAssetsFile(fileRelativePath); if (version == null) { return(false); } return(true); } catch (System.Exception e) { Debug.LogException(e); } return(false); }
private IDictionary <string, int> getISOValue() { IDictionary <string, int> ISO4217 = new Dictionary <string, int>(); string iso4217_file_to_string = PsdkUtils.ReadStreamingAssetsFile("iso_4217.xml"); using (XmlReader reader = XmlReader.Create(new StringReader(iso4217_file_to_string))) { bool expectingCode = false; bool expectingValue = false; string pulledCode = null; string pulledValue = null; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: if (reader.Name.Equals("Ccy")) { expectingCode = true; } else if (reader.Name.Equals("CcyMnrUnts")) { expectingValue = true; } break; case XmlNodeType.Text: if (expectingCode) { pulledCode = reader.Value; } else if (expectingValue) { pulledValue = reader.Value; } break; case XmlNodeType.EndElement: if (reader.Name.Equals("Ccy")) { expectingCode = false; } else if (reader.Name.Equals("CcyMnrUnts")) { expectingValue = false; } else if (reader.Name.Equals("CcyNtry")) { if (!string.IsNullOrEmpty(pulledCode) && !string.IsNullOrEmpty(pulledValue)) { int value; try { value = int.Parse(pulledValue); } catch (FormatException) { value = 0; } ISO4217[pulledCode] = value; } expectingCode = false; expectingValue = false; pulledCode = null; pulledValue = null; } break; } } } return(ISO4217); }
public static string ReadPsdkConfigFromFile() { string fileRelativePath; bool android = false; string json = null; if (RuntimePlatform.IPhonePlayer == Application.platform) { fileRelativePath = "psdk_ios.json"; } else { fileRelativePath = "psdk_google.json"; #if AMAZON fileRelativePath = "psdk_amazon.json"; #else json = PsdkUtils.ReadAndroidAssetsFile(fileRelativePath); if (null != json) { UnityEngine.Debug.Log("Read psdk_google.json directly from android assets folder !"); } #endif android = true; } if (json == null) { json = PsdkUtils.ReadStreamingAssetsFile(fileRelativePath); } if (json == null && android) { json = PsdkUtils.ReadStreamingAssetsFile("psdk_amazon.json"); } if (json == null) { json = PsdkUtils.ReadStreamingAssetsFile("psdk.json"); } if (null != json) { return(json); } if (RuntimePlatform.IPhonePlayer == Application.platform) { json = PsdkUtils.ReadStreamingAssetsFile("psdk_ios_.json"); } else { #if AMAZON json = PsdkUtils.ReadStreamingAssetsFile("psdk_amazon_.json"); #else json = PsdkUtils.ReadStreamingAssetsFile("psdk_google_.json"); #endif android = true; } if (null != json) { Debug.LogWarning("PSDK - You are using test json configuration file !!"); return(json); } Debug.LogError("PSDKMgr::ReadPsdkConfigFromFile failed reading json file Assets/StreamingAssets/psdk.json !!"); return("{}"); }