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

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

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

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(false);
            }
            finally
            {
                BPListToObjectDllCore.Close();
            }
        }
Beispiel #2
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);
        }