Пример #1
0
        public unsafe bool Exists(string path)
        {
            void *dict = null;
            int   num  = MobileDevice.AFCFileInfoOpen(hAFC, path, ref dict);

            if (num == 0)
            {
                MobileDevice.AFCKeyValueClose(dict);
            }
            return(num == 0);
        }
Пример #2
0
        /// <summary>
        /// 判断文件是否存在
        /// </summary>
        /// <param name="path">完整设备内路径</param>
        /// <returns>1为存在,0为不存在</returns>
        public unsafe bool Exists(string path)
        {
            void *dict = null;
            int   num  = MobileDevice.AFCFileInfoOpen(this.hAFC, System.Text.Encoding.UTF8.GetBytes(path), ref dict);

            if (num == 0)
            {
                //释放dict指针
                MobileDevice.AFCKeyValueClose(dict);
            }
            return(num == 0);
        }
Пример #3
0
        public unsafe Dictionary <string, string> GetFileInfo(string path)
        {
            var   dictionary = new Dictionary <string, string>();
            void *dict       = null;

            if ((MobileDevice.AFCFileInfoOpen(this.hAFC, path, ref dict) == 0) && (dict != null))
            {
                void *voidPtr2;
                void *voidPtr3;
                while (((MobileDevice.AFCKeyValueRead(dict, out voidPtr2, out voidPtr3) == 0) && (voidPtr2 != null)) && (voidPtr3 != null))
                {
                    string key  = Marshal.PtrToStringAnsi(new IntPtr(voidPtr2));
                    string str2 = Marshal.PtrToStringAnsi(new IntPtr(voidPtr3));
                    dictionary.Add(key, str2);
                }
                MobileDevice.AFCKeyValueClose(dict);
            }
            return(dictionary);
        }