private void loadButton_Clicked(object sender, EventArgs e) { ReadOnlyCollection <string> udids; ReadOnlyCollection <string> info; NativeLibraries.Load(); int count = 0; var idevice = LibiMobileDevice.Instance.iDevice; var lockdown = LibiMobileDevice.Instance.Lockdown; var shit = LibiMobileDevice.Instance.Plist; var ret = idevice.idevice_get_device_list(out udids, ref count); if (ret == iDeviceError.NoDevice) { // Not actually an error in our case statusLabel.Text = "NO DEVICE ERROR"; return; } ret.ThrowOnError(); if (udids.Count == 0) { statusLabel.Text = "NO DEVICE DETECTED"; } try { // Get the device name foreach (var udid in udids) { string t1; string t2; string t3; string t4; string t5; string t6; string t7; string t8; string t9; string t10; string t11; string t20; string totalSize = "0"; PlistHandle tested1; PlistHandle tested2; PlistHandle tested3; PlistHandle tested4; PlistHandle tested5; PlistHandle tested6; PlistHandle tested7; PlistHandle tested8; PlistHandle tested9; PlistHandle tested10; PlistHandle tested11; LockdownClientHandle lockdownHandle; LockdownServiceDescriptorHandle mcLdsHandle; iDeviceHandle deviceHandle; LockdownServiceDescriptorHandle ldsHandle; AfcClientHandle afcClient; ReadOnlyCollection <string> deviceInfo; int va = 100; uint u = 0; idevice.idevice_new(out deviceHandle, udid).ThrowOnError(); lockdown.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, "Quamotion").ThrowOnError(); lockdown.lockdownd_start_service(lockdownHandle, "com.apple.afc", out ldsHandle); ldsHandle.Api.Afc.afc_client_new(deviceHandle, ldsHandle, out afcClient); ldsHandle.Api.Afc.afc_get_device_info_key(afcClient, "FSTotalBytes", out totalSize); //Find serial number in plist lockdown.lockdownd_get_value(lockdownHandle, null, "SerialNumber", out tested1); lockdown.lockdownd_get_value(lockdownHandle, null, "InternationalMobileEquipmentIdentity", out tested2); lockdown.lockdownd_get_value(lockdownHandle, null, "ModelNumber", out tested3); lockdown.lockdownd_get_value(lockdownHandle, null, "MobileEquipmentIdentifier", out tested4); lockdown.lockdownd_get_value(lockdownHandle, null, "MobileSubscriberNetworkCode", out tested5); lockdown.lockdownd_get_value(lockdownHandle, null, "IntegratedCircuitCardIdentity", out tested6); lockdown.lockdownd_get_value(lockdownHandle, null, "RegulatoryModelNumber", out tested7); lockdown.lockdownd_get_value(lockdownHandle, null, "MarketingName", out tested8); //lockdown.lockdownd_get_value(lockdownHandle, "com.apple.disk_usage", "TotalDiskCapacity", out tested9); lockdown.lockdownd_get_value(lockdownHandle, null, "RegionInfo", out tested11); lockdown.lockdownd_get_value(lockdownHandle, null, "DeviceEnclosureColor", out tested10); //Get string values from plist tested1.Api.Plist.plist_get_string_val(tested1, out t1); tested2.Api.Plist.plist_get_string_val(tested2, out t2); tested3.Api.Plist.plist_get_string_val(tested3, out t3); tested4.Api.Plist.plist_get_string_val(tested4, out t4); tested5.Api.Plist.plist_get_string_val(tested5, out t5); tested6.Api.Plist.plist_get_string_val(tested6, out t6); tested7.Api.Plist.plist_get_string_val(tested7, out t7); tested8.Api.Plist.plist_get_string_val(tested8, out t8); //tested9.Api.Plist.plist_get_string_val(tested9, out t9); tested10.Api.Plist.plist_get_string_val(tested10, out t10); tested11.Api.Plist.plist_get_string_val(tested11, out t11); if (totalSize != null) { if (totalSize.Length != 0) { double si = Math.Round(double.Parse(totalSize) / 1000000000); var bitmap = new Bitmap(16, 16); using (var g = Graphics.FromImage(bitmap)) { var colorCode = t10; if (colorCode != null) { var color = ColorTranslator.FromHtml(colorCode); using (var brush = new SolidBrush(color)) { g.FillRectangle(brush, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); } } } object[] row = { t8 + " " + si + "GB", t1, t2, t4, t3 + " " + t11 + " " + t7, bitmap }; //var listViewItem = new ListViewItem(row); deviceList.Rows.Add(row); } } deviceHandle.Dispose(); lockdownHandle.Dispose(); } ////////////////////////////////////////// foreach (aDevice ad in AndroidMgr.LoadDevices(AndroidMgr.GetConnectedDevices())) { object[] row = { ad.manufacturer + " " + ad.deviceName + " GB", ad.serialNo, ad.imeiNo, " ", ad.model, null }; //var listViewItem = new ListViewItem(row); deviceList.Rows.Add(row); } ////////////////////////////////////////// deviceList.ClearSelection(); serialInputBox.Text = ""; UpdateNumSelected(deviceList); } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
public Form1() { InitializeComponent(); deviceList.SelectionMode = DataGridViewSelectionMode.FullRowSelect; updateThread = new BackgroundWorker(); updateThread.DoWork += UpdateThread_DoWork; updateThread.RunWorkerCompleted += UpdateThread_RunUpdateCompleted; updateThread.ProgressChanged += UpdateThread_ProgressChanged; updateThread.WorkerReportsProgress = true; updateThread.WorkerSupportsCancellation = true; settingFields = new List <object>(); settingFields.Add(dataLocation); settingFields.Add(labelerLocation); settingFields.Add(labelLocation); settingFields.Add(databaseLocation); mainString = new StringBuilder(); mainString2 = new StringBuilder(); selectOptionCB.SelectedIndex = 0; this.KeyPreview = true; LoadSettings(); SKUDBMgr.ConnectToDatabase(databaseLocation.Text.Trim()); object[] row = { "iphone 5s 16gb", "1234asf1234df", "11111333333444", "111113333334445555", "M123 LL/A 2345", null }; object[] row2 = { "iphone 7s 32gb", "345gfg43tt3vv", "111155333444", "1111553334447777", "M456 LL/A rwrt", null }; object[] row3 = { "iphone 11 pro 128gb", "7u7u7u7u7u7u", "00000088677774", "000006555333", "M765 LL/A feef", null }; object[] row4 = { "iphone 6s 64gb", "8i8i8i8i8i8i", "222223333445", "6664446464646", "M353 LL/A f33g", null }; object[] row5 = { "iphone 8 16gb", "9o9o6u6y5t4t4t", "57575757575757", "5757575757", "M634 LL/A aa4g", null }; //var listViewItem = new ListViewItem(row); deviceList.Rows.Add(row); deviceList.Rows.Add(row2); deviceList.Rows.Add(row3); deviceList.Rows.Add(row4); deviceList.Rows.Add(row5); //ProcessLabels("THIS IS TITLE ENJOY", "whats going on man", null, @"C:\Users\Vince\Documents\QrCodeLabelTemp2.dotx", true); //doc.Close(ref saveChanges, ref missing, ref missing); //AndroidMgr.GetConnectedDevices(); /* * ImageConverter conv = new ImageConverter(); * System.Drawing.Image im = Bitmap.FromFile(@"C:\Users\Vince\Pictures\maxresdefault.jpg"); * byte[] xByte = (byte[])conv.ConvertTo(im, typeof(byte[])); * * * * //SKUDBMgr.ExecuteQuery($"INSERT INTO Pics (Data) VALUES ('{"efe"}')",null); * * //SKUDBMgr.ExecuteQuery("SELECT F1 FROM Table1 WHERE F2='23456'"); * * string qry = "INSERT INTO Pics (Data) VALUES(@Data)"; * * using (SKUDBMgr.conn) * { * OleDbCommand cmd = new OleDbCommand(qry, SKUDBMgr.conn); * cmd.Parameters.AddWithValue("@Data", xByte); * * //SKUDBMgr.conn.Open(); * cmd.ExecuteNonQuery(); * } * * List<KeyValuePair<string, object>> values = new List<KeyValuePair<string, object>>(); * * values.Add(new KeyValuePair<string, object>("F9", "00500")); * values.Add(new KeyValuePair<string, object>("F11", "44444")); * * SKUDBMgr.ExecuteQuery(SKUDBMgr.SKUDBOPTIONS.SELECT, "Smartphones", new List<string> { "F3","F9","F11"}, SKUDBMgr.SKUDBOPTIONS.FROM, values,SKUDBMgr.SKUDBOPTIONS.WHERE,SKUDBMgr.SKUDBOPTIONS.OR); * * * var usbDevices = GetUSBDevices(); * * foreach (var usbDevice in usbDevices) * { * Console.WriteLine("Device ID: {0}, PNP Device ID: {1}, Description: {2}", * usbDevice.DeviceID, usbDevice.PnpDeviceID, usbDevice.Description); * } * * Console.Read(); */ AndroidMgr.InitiateADBService(); List <string> dev = AndroidMgr.GetConnectedDevices(); foreach (string devs in dev) { Console.WriteLine(devs); } foreach (aDevice ad in AndroidMgr.LoadDevices(dev)) { Console.WriteLine($"DEVICE: {ad.deviceName} MODEL: {ad.model} SERIAL: {ad.serialNo} IMEI: {ad.imeiNo} MANUFACTURER: {ad.manufacturer}"); } }