Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using RegawMOD.Android;
- using PortableDeviceApiLib;
- using System.Management;
- using System.Text.RegularExpressions;
- using System.Diagnostics;
- namespace MusicLibUtility
- {
- public class Devices
- {
- AndroidController android;
- Device device;
- public event EventHandler TableDataChanged;
- private List<Device> tableData;
- public List<Device> TableData
- {
- get { return tableData; }
- set
- {
- tableData = value;
- if (TableDataChanged != null)
- {
- TableDataChanged(this, EventArgs.Empty);
- }
- }
- }
- public Devices()
- {
- }
- }
- public class GetDevices
- {
- public static AndroidController GetDeviceData()
- {
- Dictionary<string, string> deviceinfo = new Dictionary<string, string>();
- deviceinfo["props_prod"] = "shell getprop";
- AndroidController android;
- RegawMOD.Android.Device device;
- android = AndroidController.Instance;
- if (android.HasConnectedDevices)
- {
- int num = android.ConnectedDevices.Count;
- for(int i = 0; i < android.ConnectedDevices.Count; i++)
- {
- string exp = @"\s+";
- string serial = android.ConnectedDevices[i];
- device = android.GetConnectedDevice(serial);
- string devserial = device.SerialNumber;
- DeviceState state = device.State;
- Devices table = new Devices();
- table.TableData = new List<Device>();
- Device item = new Device();
- model(device, item);
- brand(device, item);
- language(device, item);
- version(device, item);
- country(device, item);
- Card1(device, exp, item);
- Card2(device, exp);
- item.SerialNumber = serial;
- }
- }
- return android;
- }
- private static void Card2(RegawMOD.Android.Device device, string exp)
- {
- AdbCommand adbCmdcard = Adb.FormAdbCommand(device, "shell df /storage/*card*");
- string card = Adb.ExecuteAdbCommand(adbCmdcard);
- string[] Card2 = Regex.Split(card, exp);
- }
- private static void Card1(RegawMOD.Android.Device device, string exp, Device item)
- {
- AdbCommand adbCmdCard = Adb.FormAdbCommand(device, "shell df /storage/*Card*");
- string Card = Adb.ExecuteAdbCommand(adbCmdCard);
- string[] Card1 = Regex.Split(Card, exp);
- item.free = Card1[8];
- }
- private static void country(RegawMOD.Android.Device device, Device item)
- {
- string getcountry = "shell getprop ro.product.locale.region";
- AdbCommand adbCmdgetcountry = Adb.FormAdbCommand(device, getcountry);
- string mycountry = Adb.ExecuteAdbCommand(adbCmdgetcountry);
- item.country = mycountry;
- }
- private static void version(RegawMOD.Android.Device device, Device item)
- {
- string getver = "shell getprop ro.product.version";
- AdbCommand adbCmdgetver = Adb.FormAdbCommand(device, getver);
- string myver = Adb.ExecuteAdbCommand(adbCmdgetver);
- item.version = myver;
- }
- private static void language(RegawMOD.Android.Device device, Device item)
- {
- string getlang = "shell getprop ro.product.locale.language";
- AdbCommand adbCmdgetlang = Adb.FormAdbCommand(device, getlang);
- string mylanguage = Adb.ExecuteAdbCommand(adbCmdgetlang);
- item.language = mylanguage;
- }
- private static void brand(RegawMOD.Android.Device device, Device item)
- {
- string getbrand = "shell getprop ro.product.brand";
- AdbCommand adbCmdgetBrand = Adb.FormAdbCommand(device, getbrand);
- string mybrand = Adb.ExecuteAdbCommand(adbCmdgetBrand);
- item.Brand = mybrand;
- }
- private static void model(RegawMOD.Android.Device device, Device item)
- {
- string getmodel = "shell getprop ro.product.model";
- AdbCommand adbCmdgetModel = Adb.FormAdbCommand(device, getmodel);
- string mymodel = Adb.ExecuteAdbCommand(adbCmdgetModel);
- item.model = mymodel;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement