public static string ConvertToJsonString(byte[] jsonBuffer, int size) { try { int openCode = BPListDllCore.OpenPBuffer(jsonBuffer, size); if (openCode != 0) { return(string.Empty); } IntPtr result = IntPtr.Zero; int resultCode = BPListDllCore.GetJsonBuffer(ref result); if (resultCode != 0) { return(string.Empty); } string jsonString = result.ToUTF8String(); BPListDllCore.Close(); return(jsonString); } catch (Exception ex) { Console.WriteLine(ex); return(string.Empty); } }
public static string ReadToJsonString(string plistFilePath) { try { int mountResult = BPListDllCore.OpenPFile(plistFilePath); if (mountResult != 0) { return(string.Empty); } IntPtr result = IntPtr.Zero; int resultCode = BPListDllCore.GetJsonBuffer(ref result); if (resultCode != 0) { return(string.Empty); } string jsonString = result.ToUTF8String(); BPListDllCore.Close(); return(jsonString); } catch (Exception ex) { Console.WriteLine(ex); } return(string.Empty); }