public override bool Check(DeviceBasicInfo targetDevice) { Logger.Debug(this, "android version checking"); Version result = new Version(1, 0); Task.Run(() => { Thread.Sleep(1000); result = new DeviceBuildPropGetter(targetDevice.Serial).GetAndroidVersion(); BoxHelper.CloseLoadingDialog(); }); BoxHelper.ShowLoadingDialog(); Logger.Debug(this, $"Min{version} Device{result}"); if (result == null) { var fmt = App.Current.Resources["msgAndroidVersionCheckFailedFormat"].ToString(); return(BoxHelper.ShowChoiceDialog( "Warning", String.Format(fmt, version.ToString(3)), "btnCancel", "btnContinue").ToBool()); } if (result < version) { string tooLowFmt = App.Current.Resources["msgAndroidVersionTooLowFmt"].ToString(); string msg = String.Format(tooLowFmt, version.ToString(3)); BoxHelper.ShowMessageDialog("Warning", msg); return(false); } return(true); }
public void PushFile(DeviceBasicInfo targetDeivce) { Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog(); fileDialog.Reset(); fileDialog.Title = App.Current.Resources["SelecteAFile"].ToString(); fileDialog.Filter = "刷机包/压缩包文件(*.zip)|*.zip|镜像文件(*.img)|*.img|全部文件(*.*)|*.*"; fileDialog.Multiselect = false; if (fileDialog.ShowDialog() == true) { var args = new FilePusherArgs() { DevBasicInfo = targetDeivce, SourceFile = fileDialog.FileName, }; var pusher = new FilePusher(); pusher.Init(args); pusher.MustTiggerAnyFinishedEvent = true; pusher.RunAsync(); new FileSendingWindow(pusher).ShowDialog(); } else { return; } }
public void InstallApk(DeviceBasicInfo targetDevice) { Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog(); fileDialog.Reset(); fileDialog.Title = App.Current.Resources["SelecteAFile"].ToString(); fileDialog.Filter = "安卓安装包ApkFile(*.apk)|*.apk"; fileDialog.Multiselect = true; if (fileDialog.ShowDialog() == true) { ApkInstaller installer = new ApkInstaller(); List <FileInfo> files = new List <FileInfo>(); foreach (string fileName in fileDialog.FileNames) { files.Add(new FileInfo(fileName)); } var args = new ApkInstallerArgs() { DevBasicInfo = targetDevice, Files = files, }; installer.Init(args); new ApkInstallingWindow(installer, files).ShowDialog(); } else { return; } }
public void Refresh(DeviceBasicInfo deviceSimpleInfo) { this._currentDevInfo = deviceSimpleInfo; bool status = deviceSimpleInfo.State == DeviceState.Poweron; UIHelper.SetGridButtonStatus(MainGrid, status); }
public void ActivateShizukuManager(DeviceBasicInfo targetDevice) { bool fixAndroidO = false; if (new DeviceBuildPropGetter(targetDevice.Serial).GetAndroidVersion() >= new Version("8.0.0")) { var result = BoxHelper.ShowChoiceDialog("msgNotice", "msgFixAndroidO", "btnDoNotOpen", "btnOpen"); switch (result) { case ChoiceResult.BtnCancel: return; case ChoiceResult.BtnLeft: fixAndroidO = false; break; case ChoiceResult.BtnRight: fixAndroidO = true; break; } } var args = new ShScriptExecuterArgs() { DevBasicInfo = targetDevice, FixAndroidOAdb = fixAndroidO }; /*开始操作*/ ShizukuManagerActivator activator = new ShizukuManagerActivator(); activator.Init(args); activator.RunAsync(); BoxHelper.ShowLoadingDialog(activator); }
public void Refresh(DeviceBasicInfo devinfo) { lock (setUILock) { currentDevice = devinfo; refreshables.ForEach((ctrl) => { ctrl.Refresh(devinfo); }); if (TBCFuncs.SelectedIndex == 4) { return; } switch (devinfo.State) { case DeviceState.Poweron: TBCFuncs.SelectedIndex = 1; break; case DeviceState.Recovery: case DeviceState.Sideload: TBCFuncs.SelectedIndex = 2; break; case DeviceState.Fastboot: TBCFuncs.SelectedIndex = 3; break; default: TBCFuncs.SelectedIndex = 0; break; } } }
public void DeleteAddDevice() { var client = new DefaultOneNETClient(url, appkey, ""); var device = new DeviceBasicInfo { Title = "测试C# SDK", Desc = "一次通过一次通过一次通过", Private = true, OnLine = false, Tags = new[] { "测试", "sdk" }, Protocol = "HTTP", Location = new LocationInfo(370000, 17.609997, 177.03403) }; var req = new NewDeviceRequest { Protocol = Scheme.HTTP, NewDevice = device }; var resp = client.Execute(req); Assert.IsFalse(resp.IsError); Assert.IsNotNull(resp.Data); Console.WriteLine(resp.Data.Device_Id); //delete var delReq = new DeleteDeviceRequest { DeviceID = resp.Data.Device_Id }; var delResp = client.Execute(delReq); Assert.IsFalse(delResp.IsError); }
public void Refresh(DeviceBasicInfo deviceSimpleInfo) { _currentDevInfo = deviceSimpleInfo; this.Dispatcher.Invoke(() => { switch (deviceSimpleInfo.State) { case DeviceState.Fastboot: ButtonRebootToBootloader.IsEnabled = true; ButtonRebootToRecovery.IsEnabled = false; ButtonRebootToSystem.IsEnabled = true; ButtonRebootToSnapdragon9008.IsEnabled = true; break; case DeviceState.Recovery: case DeviceState.Poweron: ButtonRebootToBootloader.IsEnabled = true; ButtonRebootToRecovery.IsEnabled = true; ButtonRebootToSystem.IsEnabled = true; ButtonRebootToSnapdragon9008.IsEnabled = true; break; default: ButtonRebootToBootloader.IsEnabled = false; ButtonRebootToRecovery.IsEnabled = false; ButtonRebootToSystem.IsEnabled = false; ButtonRebootToSnapdragon9008.IsEnabled = false; break; } }); }
public void Refresh(DeviceBasicInfo devSimpleInfo) { Reset(); DeviceInfo = devSimpleInfo; if (DeviceState.None != DeviceInfo.State) { ConnectStatusText = App.Current.Resources["lbConnectedDevice"].ToString(); } DeviceStateText = App.Current.Resources[$"deviceState{devSimpleInfo.State}"].ToString(); switch (devSimpleInfo.State) { case DeviceState.Poweron: case DeviceState.Recovery: PoweronRefresh(devSimpleInfo); break; case DeviceState.Fastboot: Task.Run(() => { var product = new DeviceInfoGetterInFastboot(devSimpleInfo.Serial).GetProduct(); Dispatcher.Invoke(() => { DeviceName = product; }); }); break; case DeviceState.Unauthorized: case DeviceState.Offline: break; } }
public void TestAddEDPDevice() { var client = new DefaultOneNETClient(url, appkey, ""); var device = new DeviceBasicInfo { Title = "C#添加EDP设备Auth_Info", Desc = "C# SDK添加EDP设备", Private = true, OnLine = false, Tags = new[] { "测试", "sdk" }, Protocol = "EDP", Auth_Info = new JRaw("{\"sim\":123456445}"), Location = new LocationInfo(370000, 18.609997, 77.03403) }; var req = new NewDeviceRequest { Protocol = Scheme.HTTP, NewDevice = device }; var resp = client.Execute(req); Assert.IsFalse(resp.IsError); Assert.IsNotNull(resp.Data); Assert.IsTrue(resp.Data.Device_Id > 0); }
/// <summary> /// 新增设备,增加成功后,会返回该设备的设备ID。 /// </summary> public NewDeviceRequest() { NewDevice = new DeviceBasicInfo { Private = false }; //新设备默认为私有 otherParameters = new Dictionary <string, string>(); }
public void ChangeDpi(DeviceBasicInfo targetDevice) { new DpiChangeWindow(targetDevice) { Owner = App.Current.MainWindow }.ShowDialog(); }
public override bool Check(DeviceBasicInfo tragetDevice) { if (!((MainWindow)App.Current.MainWindow).DevInfoPanel.CurrentDeviceIsRoot) { return(BoxHelper.ShowChoiceDialog("Warning", "warrningNeedRootAccess").ToBool()); } return(true); }
public void Reset() { _currentDevInfo = new DeviceBasicInfo() { State = DeviceState.None }; UIHelper.SetGridButtonStatus(MainGrid, false); }
public void Reset() { currentDevice = new DeviceBasicInfo() { Serial = null, State = DeviceState.None }; ListBoxModule.SelectedIndex = -1; Refresh(currentDevice); }
public void Reset() { _currentDevInfo = new DeviceBasicInfo() { State = DeviceState.None }; ButtonRebootToBootloader.IsEnabled = false; ButtonRebootToRecovery.IsEnabled = false; ButtonRebootToSystem.IsEnabled = false; ButtonRebootToSnapdragon9008.IsEnabled = false; }
public void UnlockSystemParation(DeviceBasicInfo targetDevice) { var unlocker = new SystemPartitionUnlocker(); unlocker.Init(new FlowArgs() { DevBasicInfo = targetDevice }); unlocker.RunAsync(); BoxHelper.ShowLoadingDialog(unlocker); }
public void ActivateAnzenbokusuFake(DeviceBasicInfo targetDevice) { AnzenbokusuFakeActivator activator = new AnzenbokusuFakeActivator(); activator.Init(new FlowArgs() { DevBasicInfo = targetDevice }); activator.RunAsync(); BoxHelper.ShowLoadingDialog(activator); }
public void ActivateStopapp(DeviceBasicInfo targetDevice) { StopAppActivator activator = new StopAppActivator(); activator.Init(new FlowArgs() { DevBasicInfo = targetDevice }); activator.RunAsync(); BoxHelper.ShowLoadingDialog(activator); }
public void ActivateBlackHole(DeviceBasicInfo targetDevice) { BlackHoleActivator activator = new BlackHoleActivator(); activator.Init(new FlowArgs() { DevBasicInfo = targetDevice }); activator.RunAsync(); BoxHelper.ShowLoadingDialog(activator); }
public void ActivateAirForzen(DeviceBasicInfo targetDevice) { AirForzenActivator airForzenActivator = new AirForzenActivator(); airForzenActivator.Init(new FlowArgs() { DevBasicInfo = targetDevice }); airForzenActivator.RunAsync(); BoxHelper.ShowLoadingDialog(airForzenActivator); }
public void ActivateFreezeYou(DeviceBasicInfo targetDevice) { FreezeYouActivator activator = new FreezeYouActivator(); activator.Init(new FlowArgs() { DevBasicInfo = targetDevice }); activator.RunAsync(); BoxHelper.ShowLoadingDialog(activator); }
public void ActivateIceBox(DeviceBasicInfo targetDevice) { IceBoxActivator iceBoxActivator = new IceBoxActivator(); iceBoxActivator.Init(new FlowArgs() { DevBasicInfo = targetDevice }); iceBoxActivator.RunAsync(); BoxHelper.ShowLoadingDialog(iceBoxActivator); }
public void ActivateGreenifyAggressiveDoze(DeviceBasicInfo targetDevice) { var activator = new GreenifyAggressiveDozeActivator(); activator.Init(new FlowArgs() { DevBasicInfo = targetDevice }); activator.RunAsync(); BoxHelper.ShowLoadingDialog(activator); }
public void ActivateUsersir(DeviceBasicInfo targetDevice) { var activator = new UsersirActivator(); activator.Init(new FlowArgs() { DevBasicInfo = targetDevice }); activator.RunAsync(); BoxHelper.ShowLoadingDialog(activator); }
public void DeleteScreenLock(DeviceBasicInfo targetDevice) { var screenLockDeleter = new ScreenLockDeleter(); screenLockDeleter.Init(new FlowArgs() { DevBasicInfo = targetDevice, }); screenLockDeleter.RunAsync(); BoxHelper.ShowLoadingDialog(screenLockDeleter); }
public override bool Check(DeviceBasicInfo targetDevice) { var users = new UserManager(targetDevice).GetUsers(); Logger.Info(this, users.Length); if (users.Length > 0) { return(BoxHelper.ShowChoiceDialog("Warning", "msgMaybeHaveOtherUser", "btnCancel", "btnIHaveDeletedAllUser").ToBool()); } return(true); }
public DpiChangeWindow(DeviceBasicInfo devinfo) { InitializeComponent(); this.devinfo = devinfo; BtnOK.IsEnabled = true; new Thread(() => { int?_deviceDefaultDpi = new DeviceHardwareInfoGetter(devinfo.Serial).GetDpi(); this.Dispatcher.Invoke(() => { TextBlockCurrentDpi.Text = (_deviceDefaultDpi == null) ? UIHelper.GetString("GetFail") : _deviceDefaultDpi.ToString(); TextBoxInput.Text = (_deviceDefaultDpi == null) ? "" : _deviceDefaultDpi.ToString(); BtnOK.IsEnabled = true; }); }).Start(); }
public void ScreenShot(DeviceBasicInfo targetDevice) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) { var shoter = new ScreenShoter(); shoter.Init(new ScreenShoterArgs() { DevBasicInfo = targetDevice, SavePath = fbd.SelectedPath }); shoter.RunAsync(); BoxHelper.ShowLoadingDialog(shoter); } }
private static void FastbootParse(Output o, ref DevicesList devList) { try { var matches = _deviceRegex.Matches(o.All); foreach (Match match in matches) { devList.Add(DeviceBasicInfo.Make( match.Result("${serial}"), match.Result("${status}").ToDeviceState())); } } catch (Exception ex) { Logger.Warn("DevicesGetter", "fastboot devices parse failed", ex); } }