예제 #1
0
        // Token: 0x06000021 RID: 33 RVA: 0x0000274C File Offset: 0x0000094C
        public bool GetDevice()
        {
            this.Devices.Clear();
            int num = 0;
            ReadOnlyCollection <string> readOnlyCollection;
            iDeviceError iDeviceError = this.iDevice.idevice_get_device_list(out readOnlyCollection, ref num);
            bool         flag         = iDeviceError == iDeviceError.NoDevice;
            bool         result;

            if (flag)
            {
                result = false;
            }
            else
            {
                iDeviceError.ThrowOnError();
                foreach (string udid in readOnlyCollection)
                {
                    iDeviceHandle iDeviceHandle;
                    this.iDevice.idevice_new(out iDeviceHandle, udid).ThrowOnError();
                    LockdownClientHandle lockdownClientHandle;
                    this.lockdown.lockdownd_client_new_with_handshake(iDeviceHandle, out lockdownClientHandle, "Quamotion").ThrowOnError();
                    string deviceName;
                    this.lockdown.lockdownd_get_device_name(lockdownClientHandle, out deviceName).ThrowOnError();
                    string      version = "";
                    PlistHandle node;
                    bool        flag2 = this.lockdown.lockdownd_client_new_with_handshake(iDeviceHandle, out lockdownClientHandle, "waua") == LockdownError.Success && this.lockdown.lockdownd_get_value(lockdownClientHandle, null, "ProductVersion", out node) == LockdownError.Success;
                    if (flag2)
                    {
                        LibiMobileDevice.Instance.Plist.plist_get_string_val(node, out version);
                    }
                    iDeviceHandle.Dispose();
                    lockdownClientHandle.Dispose();
                    DeviceModel device = new DeviceModel
                    {
                        UDID    = udid,
                        Name    = deviceName,
                        Version = version
                    };
                    this.PrintMessage(string.Concat(new string[]
                    {
                        "发现设备: ",
                        deviceName,
                        "  ",
                        version,
                        "  ",
                        udid
                    }));
                    this.LoadDevelopmentTool(device);
                    this.Devices.Add(device);
                }
                result = true;
            }
            return(result);
        }
예제 #2
0
        public bool GetDevice()
        {
            Devices.Clear();
            var          num          = 0;
            iDeviceError iDeviceError = iDevice.idevice_get_device_list(out var readOnlyCollection, ref num);

            if (iDeviceError == iDeviceError.NoDevice)
            {
                return(false);
            }
            iDeviceError.ThrowOnError();
            foreach (string udid in readOnlyCollection)
            {
                //iDeviceHandle iDeviceHandle;
                iDevice.idevice_new(out var iDeviceHandle, udid).ThrowOnError();
                //LockdownClientHandle lockdownClientHandle;
                lockdown.lockdownd_client_new_with_handshake(iDeviceHandle, out var lockdownClientHandle, "Quamotion").ThrowOnError();
                //string deviceName;
                lockdown.lockdownd_get_device_name(lockdownClientHandle, out var deviceName).ThrowOnError();
                string      version = "";
                PlistHandle node;
                if (lockdown.lockdownd_client_new_with_handshake(iDeviceHandle, out lockdownClientHandle, "waua") == LockdownError.Success && lockdown.lockdownd_get_value(lockdownClientHandle, null, "ProductVersion", out node) == LockdownError.Success)
                {
                    LibiMobileDevice.Instance.Plist.plist_get_string_val(node, out version);
                }
                iDeviceHandle.Dispose();
                lockdownClientHandle.Dispose();
                var device = new DeviceModel
                {
                    UDID    = udid,
                    Name    = deviceName,
                    Version = version
                };

                PrintMessage($"发现设备: {deviceName}  {version}  {udid}");
                LoadDevelopmentTool(device);
                Devices.Add(device);
            }
            return(true);
        }