Beispiel #1
0
        public unsafe int GetiphoneSize()
        {
            void *dict = null;
            int   num  = 0;

            if ((MobileDevice.AFCDeviceInfoOpen(this.hAFC, ref dict) == 0) && (dict != null))
            {
                num = *((int *)dict);
            }
            return(num);
        }
Beispiel #2
0
        unsafe public void RefreshFileSystemInfo()
        {
            void * dict = null;
            void * key;
            void * val;
            string skey;
            string sval;
            long   lval;
            int    ival;
            int    ret = MobileDevice.AFCDeviceInfoOpen(hAFC, ref dict);

            if (ret == 0)
            {
                try
                {
                    while ((MobileDevice.AFCKeyValueRead(dict, out key, out val) == 0) && (skey = Marshal.PtrToStringAnsi(new IntPtr(key))) != null && (sval = Marshal.PtrToStringAnsi(new IntPtr(val))) != null)
                    {
                        switch (skey)
                        {
                        case "FSFreeBytes":
                            long.TryParse(sval, out lval);
                            fileSystemFreeBytes = lval;
                            break;

                        case "FSTotalBytes":
                            long.TryParse(sval, out lval);
                            fileSystemTotalBytes = lval;
                            break;

                        case "FSBlockSize":
                            Int32.TryParse(sval, out ival);
                            fileSystemBlockSize = ival;
                            break;

                        default:
                            System.Diagnostics.Trace.WriteLine(skey + ":" + sval);
                            break;
                        }
                    }
                }
                catch (AccessViolationException ave) { }
                finally
                {
                    MobileDevice.AFCKeyValueClose(dict);
                }
            }
        }
Beispiel #3
0
        public unsafe Dictionary <string, string> GetDeviceInfo()
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            void *dict = null;

            if ((MobileDevice.AFCDeviceInfoOpen(this.hAFC, 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);
        }