Exemplo n.º 1
0
        public static string ReadToJsonString(string plistFilePath)
        {
            try
            {
                int mountResult = BPListToObjectDllCore.OpenPFile(plistFilePath);
                if (mountResult != 0)
                {
                    return(string.Empty);
                }

                IntPtr result     = IntPtr.Zero;
                int    resultCode = BPListToObjectDllCore.GetJsonBuffer(ref result);
                if (resultCode != 0)
                {
                    return(string.Empty);
                }

                string jsonString = result.ToGB2312String();
                BPListToObjectDllCore.Close();
                return(jsonString);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(string.Empty);
        }
Exemplo n.º 2
0
        public static string ConvertToJsonString(byte[] jsonBuffer, int size)
        {
            try
            {
                int openCode = BPListToObjectDllCore.OpenPBuffer(jsonBuffer, size);

                if (openCode != 0)
                {
                    return(string.Empty);
                }

                IntPtr result     = IntPtr.Zero;
                int    resultCode = BPListToObjectDllCore.GetJsonBuffer(ref result);
                if (resultCode != 0)
                {
                    return(string.Empty);
                }

                string jsonString = result.ToGB2312String();
                BPListToObjectDllCore.Close();
                return(jsonString);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(string.Empty);
            }
        }