コード例 #1
0
        // Token: 0x06000082 RID: 130 RVA: 0x000056A8 File Offset: 0x000038A8
        public static XEFileInfo Open(iPhoneXE phone, string path, FileAccess openmode)
        {
            OpenMode openMode;
            long     num2;

            lock (phone)
            {
                openMode = OpenMode.None;
                switch (openmode)
                {
                case FileAccess.Read:
                    openMode = OpenMode.Read;
                    break;

                case FileAccess.Write:
                    openMode = OpenMode.Write;
                    break;

                case FileAccess.ReadWrite:
                    throw new NotImplementedException("Read+Write not (yet) implemented");
                }
                int num = MobileDeviceBase.AFCFileRefOpen(phone.AFCHandle, Encoding.UTF8.GetBytes(path), (ulong)((long)openMode), out num2);
                if (num != 0 && num != 0)
                {
                    LogViewer.LogEvent(0, "**ERROR:  " + path);
                    throw new IOException("AFCFileRefOpen failed with error " + num.ToString());
                }
            }
            return(new XEFileInfo(phone, num2, openMode));
        }
コード例 #2
0
 // Token: 0x060000F2 RID: 242 RVA: 0x000066A0 File Offset: 0x000048A0
 private unsafe void doConstruction()
 {
     this.dnc  = new DeviceNotificationCallback(this.NotifyCallback);
     this.drn1 = new DeviceRestoreNotificationCallback(this.DfuConnectCallback);
     this.drn2 = new DeviceRestoreNotificationCallback(this.RecoveryConnectCallback);
     this.drn3 = new DeviceRestoreNotificationCallback(this.DfuDisconnectCallback);
     this.drn4 = new DeviceRestoreNotificationCallback(this.RecoveryDisconnectCallback);
     try
     {
         void *ptr;
         int   num = MobileDeviceBase.AMDeviceNotificationSubscribe(this.dnc, 0u, 0u, 0u, out ptr);
         if (num != 0)
         {
             throw new Exception("AMDeviceNotificationSubscribe failed with error " + num);
         }
         num = MobileDeviceBase.AMRestoreRegisterForDeviceNotifications(this.drn1, this.drn2, this.drn3, this.drn4, 0u, null);
         if (num != 0)
         {
             throw new Exception("AMRestoreRegisterForDeviceNotifications failed with error " + num);
         }
     }
     catch (Exception ex)
     {
         throw ex;
         //MessageBox.Show(LocalizedResources.txtUnableToStartIPhoneListner + "\r\n\r\n  Error Code: " + ex.Message.ToString());
     }
 }
コード例 #3
0
        public unsafe static string AMDeviceCopyValue(void *device, string name)
        {
            string result;

            try
            {
                MobileDeviceBase.__CFString *ptr = MobileDeviceBase.AMDeviceCopyValue_1(device, 0u, MobileDeviceBase.__CFStringMakeConstantString(MobileDeviceBase.StringToCString(name)));
                if (ptr != null)
                {
                    uint   num   = (uint)MobileDeviceBase.CFStringGetLength(ptr);
                    uint   num2  = 4u * num + 2u;
                    sbyte *value = (sbyte *)MobileDevice32.malloc(num2);
                    MobileDeviceBase.CFStringGetCString(ptr, (void *)value, (int)num2, 134217984u);
                    UTF8Marshaler uTF8Marshaler = new UTF8Marshaler();
                    result = (string)uTF8Marshaler.MarshalNativeToManaged(new IntPtr((void *)value));
                    return(result);
                }
            }
            catch (Exception ex)
            {
                LogViewer.LogEvent(0, "AMDeviceCopyValue Error: " + ex.ToString());
                result = "Unknown";
                return(result);
            }
            result = string.Empty;
            return(result);
        }
コード例 #4
0
 // Token: 0x06000080 RID: 128 RVA: 0x00005644 File Offset: 0x00003844
 public override long Seek(long offset, SeekOrigin origin)
 {
     lock (this.phone)
     {
         MobileDeviceBase.AFCFileRefSeek(this.phone.AFCHandle, this.handle, (long)((ulong)((uint)offset)), 0L);
     }
     return(offset);
 }
コード例 #5
0
 // Token: 0x0600007D RID: 125 RVA: 0x000054C0 File Offset: 0x000036C0
 protected override void Dispose(bool disposing)
 {
     if (disposing && this.handle != 0L)
     {
         MobileDeviceBase.AFCFileRefClose(this.phone.AFCHandle, this.handle);
         this.handle = 0L;
     }
     base.Dispose(disposing);
 }
コード例 #6
0
        public unsafe static int IDDirectoryRead(void *conn, void *dir, ref string itemName)
        {
            void *ptr    = null;
            int   result = MobileDeviceBase.AFCDirectoryRead(conn, dir, ref ptr);

            if (ptr != null)
            {
                IntPtr ptr2 = new IntPtr(ptr);
                itemName = MobileDeviceBase.PointerToString(ptr2);
            }
            else
            {
                itemName = null;
            }
            return(result);
        }
コード例 #7
0
 // Token: 0x0600007F RID: 127 RVA: 0x000055BC File Offset: 0x000037BC
 public override void Write(byte[] buffer, int offset, int count)
 {
     lock (this.phone)
     {
         if (!this.CanWrite)
         {
             throw new NotImplementedException("Stream open for reading only");
         }
         byte[] array;
         if (offset == 0)
         {
             array = buffer;
         }
         else
         {
             array = new byte[count];
             Buffer.BlockCopy(buffer, offset, array, 0, count);
         }
         MobileDeviceBase.AFCFileRefWrite(this.phone.AFCHandle, this.handle, array, (uint)count);
     }
 }
コード例 #8
0
        // Token: 0x0600007E RID: 126 RVA: 0x00005514 File Offset: 0x00003714
        public override int Read(byte[] buffer, int offset, int count)
        {
            if (!this.CanRead)
            {
                throw new NotImplementedException("Stream open for writing only");
            }
            int result;

            lock (this.phone)
            {
                if (offset != 0)
                {
                    MobileDeviceBase.AFCFileRefSeek(this.phone.AFCHandle, this.handle, (long)offset, 0L);
                }
                uint num = (uint)count;
                if (MobileDeviceBase.AFCFileRefRead(this.phone.AFCHandle, this.handle, buffer, ref num) != 0)
                {
                    throw new IOException("AFCFileRefRead error..");
                }
                result = (int)num;
            }
            return(result);
        }
コード例 #9
0
 // Token: 0x06000081 RID: 129 RVA: 0x000020CF File Offset: 0x000002CF
 public override void Flush()
 {
     MobileDeviceBase.AFCFlushData(this.phone.AFCHandle, this.handle);
 }
コード例 #10
0
 // Token: 0x0600007C RID: 124 RVA: 0x00005498 File Offset: 0x00003698
 public override void SetLength(long value)
 {
     MobileDeviceBase.AFCFileRefSetFileSize(this.phone.AFCHandle, this.handle, (uint)value);
 }
コード例 #11
0
		public unsafe static extern int CFStringGetLength(MobileDeviceBase.__CFString* thisString);
コード例 #12
0
		public unsafe static extern byte CFStringGetCString(MobileDeviceBase.__CFString* thisString, void* value, int length, uint format);
コード例 #13
0
		public unsafe static extern int CFDictionaryGetKeysAndValues(MobileDeviceBase.__CFDictionary* CFDictionary, ref MobileDeviceBase.__CFArray* CFArrayKeys, ref MobileDeviceBase.__CFArray* CFArrayValues);
コード例 #14
0
		public unsafe static extern uint CFDictionaryGetCount(MobileDeviceBase.__CFDictionary* CFDictionary);
コード例 #15
0
		public unsafe static extern int AMDeviceLookupApplications(void* device, void* options, ref MobileDeviceBase.__CFDictionary* appBundles);