Exemplo n.º 1
0
        public unsafe string[] GetFiles(string path)
        {
            if (!this.IsConnected)
            {
                throw new Exception("Not connected to phone");
            }
            string str = this.FullPath(this.CurrentDirectory, path);
            void * dir = null;

            if (MobileDevice.AFCDirectoryOpen(this.hAFC, str, ref dir) != 0)
            {
                throw new Exception("Path does not exist");
            }
            string    buffer = null;
            ArrayList list   = new ArrayList();

            MobileDevice.AFCDirectoryRead(this.hAFC, dir, ref buffer);
            while (buffer != null)
            {
                if (!this.IsDirectory(this.FullPath(str, buffer)))
                {
                    list.Add(buffer);
                }
                MobileDevice.AFCDirectoryRead(this.hAFC, dir, ref buffer);
            }
            MobileDevice.AFCDirectoryClose(this.hAFC, dir);
            return((string[])list.ToArray(typeof(string)));
        }