예제 #1
0
        public static bool ReadPListToFile(string srcPath, string savePath)
        {
            try
            {
                if (!System.IO.File.Exists(savePath))
                {
                    return(false);
                }

                int mountResult = BPListDllCore.OpenPFile(srcPath);
                if (mountResult != 0)
                {
                    return(false);
                }

                int result = BPListDllCore.GetJsonFile(savePath);
                if (result != 0)
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(false);
            }
            finally
            {
                BPListDllCore.Close();
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
        }