Hey dude! Long time! Umm I think you already said something about this. But if I wanted to get the adb and fastboot files to extract to another folder? Eg. "./Data/adb"
(string) PATH_AAPT = (PATH_DIRECTORY_AAPT\aapt.exe) Hold the final aapt path (can't be changed)
(string) PATH_DIRECTORY_AAPT = (DLL_PATH\adb\) Here u can change the directory (but only the directory)
(string) PATH_ADB
(string) PATH_DIRECTORY_ADB
(string) PATH_FASTBOOT
(string) PATH_DIRECTORY_FASTBOOT
(string) PATH_SIGNER
(string) PATH_DIRECTORY_SIGNER
Thanks bro! I look forward to itHeyho
no problem, i'll write later today also an little "How-To" article about that stuff. Currently u can't change the extraction directory. But u can deploy the files to the default directory and then move them to ur location. Then u can change the paths inside the dll like the following examples.
Code:(string) PATH_AAPT = (PATH_DIRECTORY_AAPT\aapt.exe) Hold the final aapt path (can't be changed) (string) PATH_DIRECTORY_AAPT = (DLL_PATH\adb\) Here u can change the directory (but only the directory) (string) PATH_ADB (string) PATH_DIRECTORY_ADB (string) PATH_FASTBOOT (string) PATH_DIRECTORY_FASTBOOT (string) PATH_SIGNER (string) PATH_DIRECTORY_SIGNER
Hope this helps for the moment.
PS: I'll add an extraction method which will extract the files where u want.
Regards,
Sebastian
Hey bro
-
Just an update, i decided to write an "Config" class which will hold all "init", "default", "fallback" values. This class can be configured before u start working with the dll it's self. So u have the ability to implement the dll a bit deeper in ur program.
Also, all values will have the current defaults.
I hope that i get it today done.
--- EDIT ---
@squabbi, update is online! - Have a look at this article.
Regards,
Sebastian
Hello!
Is it possible to exclude the connection monitor's logger output? and also can I wait for device to go into recovery or a certain state?
Thanks!
This will wait for an ADB device, so u can use it to wait for "DEVICE" or "RECOVERY". Remember, this call will block the current thread until a device is connected.
IDDeviceState state = General.CheckDeviceState(ADB.Instance().DeviceID);
if (state == IDDeviceState.DEVICE)
{
ADB.Instance().Reboot(IDBoot.BOOTLOADER);
processBusyInd.BusyContent = "Flashing TWRP...";
loop_state_check:
if (state == IDDeviceState.FASTBOOT)
{
Fastboot.Instance().Flash(IDDevicePartition.RECOVERY, dialog.FileName);
processBusyInd.BusyContent = "Rebooting...";
FastbootRebootSelectionsDialog();
processBusyInd.IsBusy = false;
}
else
{
goto loop_state_check;
}
}
else if (state == IDDeviceState.FASTBOOT)
{
processBusyInd.BusyContent = "Flashing TWRP...";
Fastboot.Instance().Flash(IDDevicePartition.RECOVERY, dialog.FileName);
processBusyInd.BusyContent = "Rebooting...";
FastbootRebootSelectionsDialog();
processBusyInd.IsBusy = false;
}
Heyoo!
I hope you are well. I have a question with the device state checker. It doesn't seem to work well or properly with my Nexus 6P. When I press the button it shows me the messagebox 'not detected' even though the deviceselector detects the 6P in fastboot.
Code:IDDeviceState state = General.CheckDeviceState(ADB.Instance().DeviceID); if (state == IDDeviceState.DEVICE) { ADB.Instance().Reboot(IDBoot.BOOTLOADER); processBusyInd.BusyContent = "Flashing TWRP..."; loop_state_check: if (state == IDDeviceState.FASTBOOT) { Fastboot.Instance().Flash(IDDevicePartition.RECOVERY, dialog.FileName); processBusyInd.BusyContent = "Rebooting..."; FastbootRebootSelectionsDialog(); processBusyInd.IsBusy = false; } else { goto loop_state_check; } } else if (state == IDDeviceState.FASTBOOT) { processBusyInd.BusyContent = "Flashing TWRP..."; Fastboot.Instance().Flash(IDDevicePartition.RECOVERY, dialog.FileName); processBusyInd.BusyContent = "Rebooting..."; FastbootRebootSelectionsDialog(); processBusyInd.IsBusy = false; }
Thanks!
*adb devices -l*
List of devices attached
xxxxxxxx device product:kltexx model:SM_G900F device:klte
Heyho
-
here so far everything is fine - hope on ur end also?
-
About the problem, can u have a look at ur adb output if it looks similar to this?
Code:*adb devices -l* List of devices attached xxxxxxxx device product:kltexx model:SM_G900F device:klte
If it don't, pls send me ur output, that i can realign the regex function.
Regards,
Sebastian
I:\Android\Android Tools>adb devices -l
List of devices attached
XXXXXXXXXXXXXXXX device product:angler model:Nexus_6P device:angler
I'm good thank you.
This is my output. It looks the same to yours.
Code:I:\Android\Android Tools>adb devices -l List of devices attached XXXXXXXXXXXXXXXX device product:angler model:Nexus_6P device:angler
Is there any way of checking the device state with the "status" from the device selector (combobox)?
Thanks.
IDDeviceState state = General.CheckDeviceState(ADB.Instance().DeviceID);
/* Are u sure that u selected a device before u use? */
ADB.Instance().DeviceID
/* FileSystemViewModel myModel = new FileSystemViewModel(); */
(DataModelDevicesItem) myModel.DeviceSelector.SelectedItem
(ListCollectionView) myModel.DeviceSelector.ComboElements
<RichTextBox x:Name="console" IsReadOnly="True" HorizontalAlignment="Left" Height="110" Margin="10,362,0,0" VerticalAlignment="Top" Width="497">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
</RichTextBox.Resources>
<FlowDocument/>
</RichTextBox>
public void Add(List<string> msg)
{
foreach (string tmp in msg)
{
console.Document.Blocks.Add(new Paragraph());
}
console.ScrollToEnd();
}
Add(Fastboot.Instance().Execute("flash vendor " + comma.Content + appPath + "Data/Downloads/Vendor/" + vendorListBox.SelectedItem.ToString() + comma.Content, -1));
Hello! It's me again!
Could you add these partitions?
- vendor
- userdata
- bootloader
Thank you!
EDIT:
Is there any way in getting a live output (async) while the command is running using the method you gave almost a year ago (it still works! )
Output is displayed via a richtextbox:
Code:<RichTextBox x:Name="console" IsReadOnly="True" HorizontalAlignment="Left" Height="110" Margin="10,362,0,0" VerticalAlignment="Top" Width="497"> <RichTextBox.Resources> <Style TargetType="{x:Type Paragraph}"> <Setter Property="Margin" Value="0,0,0,0"/> </Style> </RichTextBox.Resources> <FlowDocument/> </RichTextBox>
This is the method:
Code:public void Add(List<string> msg) { foreach (string tmp in msg) { console.Document.Blocks.Add(new Paragraph()); } console.ScrollToEnd(); }
This is how I call it:
Code:Add(Fastboot.Instance().Execute("flash vendor " + comma.Content + appPath + "Data/Downloads/Vendor/" + vendorListBox.SelectedItem.ToString() + comma.Content, -1));
For some fastboot commands, especially when I'm flashing a large zip I want to be able to see the sending, flashing and done messages as they come up. I've tried experimenting by making it async and await but with no luck.
EDIT 2! ahha I keep on finding new things!
Can you update the fastboot binary and commands to reflect new commands such as: fastboot flashing unlock etc. It should have been updated with the 23.0.1 rev of the SDK tools. Thanks,
EDIT 3! I'm on a roll! haha
Is there any way to fix this error? When I compile and run the program the tree view is fine.
https://gyazo.com/992225e548ddd2a8877b856960e50a74
Regards,
Squabbi
using using AndroidCtrl.ProcessModels;
...
RealTimeBG procRT = new RealTimeBG(Fastboot.PATH_EXE, "flash vendor " + comma.Content + appPath + "Data/Downloads/Vendor/" + vendorListBox.SelectedItem.ToString() + comma.Content);
procRT.Callback += Response;
procRT.Start();
/*procRT.Dispose();*/
private void Response(object sender, ProcessResponseArgs e)
{
if (string.IsNullOrEmpty(e.Response) == false)
{
}
}
Heyho XD,
about the partitions, i just added them to the (enum)IDDevicePartition
about the "real time" output, u can use the "ProcessModels.RealTimeBG{}" class like:
Code:using using AndroidCtrl.ProcessModels; ... RealTimeBG procRT = new RealTimeBG(Fastboot.PATH_EXE, "flash vendor " + comma.Content + appPath + "Data/Downloads/Vendor/" + vendorListBox.SelectedItem.ToString() + comma.Content); procRT.Callback += Response; procRT.Start(); /*procRT.Dispose();*/ private void Response(object sender, ProcessResponseArgs e) { if (string.IsNullOrEmpty(e.Response) == false) { } }
about the fastboot commands, i just download the latest SDK and update adb.exe and fastboot.exe. I'll also have a look at the new commands
(THX for that hint btw. )
about the error, i have no idea where it comes from... but i'll have a look at this part and do also a code analysis
---
The new build goes later online - i'll update this post and send u a pm
---
NOTE:
To all who use this dll, i have changed a view variables and deleted the "Logger" namespace. The "Logger" will be replaced in the next time. Also, i added an "Tools.Update" class, this is the new way to get the latest version of the dll (U can use it but u don't must).
---
Regards,
Sebastian
flashVendor.IsEnabled = false;
vendorProgressBar.IsIndeterminate = true;
RealTimeBG procRT = new RealTimeBG(Fastboot.PATH_FASTBOOT, "flash vendor " + comma.Content + appPath + "Data/Downloads/Vendor/" + vendorListBox.SelectedItem.ToString() + comma.Content);
procRT.Callback += Response;
procRT.Start();
vendorProgressBar.IsIndeterminate = false;
flashVendor.IsEnabled = true;
private void Response(object sender, ProcessResponseArgs e)
{
if (string.IsNullOrEmpty(e.Response) == false)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
console.Document.Blocks.Add(new Paragraph(new Run(e.Response.ToString())));
});
}
}
Thanks for adding in those partitions! and np about the new sdk update. btw the tools.update looks promising too.
I had a look at the RealTimeBG and I tried to incorporate it into something like this:
Code:flashVendor.IsEnabled = false; vendorProgressBar.IsIndeterminate = true; RealTimeBG procRT = new RealTimeBG(Fastboot.PATH_FASTBOOT, "flash vendor " + comma.Content + appPath + "Data/Downloads/Vendor/" + vendorListBox.SelectedItem.ToString() + comma.Content); procRT.Callback += Response; procRT.Start(); vendorProgressBar.IsIndeterminate = false; flashVendor.IsEnabled = true;
Where I click a button and it will disable it and start a progress bar. But I'm guessing it runs on a different background thread. It didn't turn out what I wanted to see. When I flashed the vendor image it took 7 seconds to flash, the output (which I've done like this
Code:private void Response(object sender, ProcessResponseArgs e) { if (string.IsNullOrEmpty(e.Response) == false) { App.Current.Dispatcher.Invoke((Action)delegate { console.Document.Blocks.Add(new Paragraph(new Run(e.Response.ToString()))); }); } }
It will only display the output when the image has been completely flashed. I would prefer it to be able to be used with a progress indicator of some sort.
I hope you get what I mean.
Regards,
Squabbi
State: Erasing/Formatting/Flashing/Rebooting
+--------------------------------------------------------+
| <-> | (Progressbar)
+--------------------------------------------------------+
Overall progress: Erasing/Formatting/Flashing/Rebooting
+--------------------------------------------------------+
| 1 | 2 | 3 | 4 | 5 | (Progressbar)
+--------------------------------------------------------+
+--------------------------------------------------------+
| Erasing/Formatting/Flashing/Rebooting | (Progressbar)
+--------------------------------------------------------+
Heyho,
- new build is out -
np for adding the partitions :cyclops:
about the output, i added "ProcessModels.RealTimeBG.IsAlive" so u can now check if the process is still running. Also, i added to some methods the "CallbackProcessResponse responseCallback" parameter, so u can now get nearly all outputs in "real time".
- If the callback will be triggered only at the end of the process, the process didn't return something while its flashing the image. -
Maybe u can add a "dummy" ProgessBar which animates "from left to right and right to left" than set an text field on top of it which indicates the state like:
Code:State: Erasing/Formatting/Flashing/Rebooting +--------------------------------------------------------+ | <-> | (Progressbar) +--------------------------------------------------------+
or like this:
about the MSVS editor error, i checked a view files but i can't reproduce this error... Which MSVS version did u use?Code:Overall progress: Erasing/Formatting/Flashing/Rebooting +--------------------------------------------------------+ | 1 | 2 | 3 | 4 | 5 | (Progressbar) +--------------------------------------------------------+ +--------------------------------------------------------+ | Erasing/Formatting/Flashing/Rebooting | (Progressbar) +--------------------------------------------------------+
Hope this helps
Regards,
Sebastian
Thanks for updating so quickly! I've chosen to use the traditional 'Add' method for showing output. Btw, I'm using VS 2015 community. I can PM you the xaml code. :good: Also one more thing, the device connection monitor with the combobox won't show my device anymore. It used to before but I don't know what happened.
It's so close to being finished.
Thanks,
^(?<SERIAL>.*?)\s{1,}(?<STATE>.*?)(\s{1,}product:\s{0,}(?<PRODUCT>.*?))?(\s{1,}model:\s{0,}(?<MODEL>.*?))?(\s{1,}device:\s{0,}(?<DEVICE>.*?))?$
Heyho
np for the update - i use the same MSVS version so, send me ur xaml code then ill have a look at it
about the connection monitor,
1. download/install/run this tool
2. get the output from "adb devices -l"
3. paste it into the "sample text" box
4. add thisto the "Regular Expression" boxCode:^(?<SERIAL>.*?)\s{1,}(?<STATE>.*?)(\s{1,}product:\s{0,}(?<PRODUCT>.*?))?(\s{1,}model:\s{0,}(?<MODEL>.*?))?(\s{1,}device:\s{0,}(?<DEVICE>.*?))?$
5. press "Run Match" or "Validate"
if the "Search Results" box stay empty my regular expression have a bug^^
(Pls report if the expression can detect the output line.)
Hope this helps
Regards,
Sebastian
Hello Sir, Really A Great Job done by you, but since i am new to this, can you please help me.. Actually i want to use some prop values from ADB so basically i need to launch adb shell getprop ***** but how to do it using your dll can you please help
(string) ADB.Instance().Device.BuildProperties.Get(string property, bool dictionary = true)
(Dictionary<string, string>) ADB.Instance().Device.BuildProperties.GetProperties
(bool) ADB.Instance().Device.BuildProperties.Set(string key, string val)
public void Monitor(Added|Changed|Removed)EventHandler(object sender, Monitor(Added|Changed|Removed)EventArgs e)
{
App.Current.Dispatcher.Invoke((Action)delegate
{
// IDeviceInfo[] e.Devices
// Here u can interact with an UI-Element or an variable in ur program code
});
}
// (Source ADB.Device.Su {})
///<summary>
/// Enables an (W)ork(A)round for older SU binaries, which needs the command as an single argument.
///<para/>For example, the latest SU binaries support a syntax like [su -c id -u] where older binaries need [su -c "id -u"]
///<para/>If u deactivate this workaround by enabled <see cref="IADB.UseSu"/>, <see cref="IADB.UseSu"/> gets also disabled!
///<para/>This workaround is by default disabled
///<para/>Affected Methods:
///<para/><see cref="ShellCmd(string, int)"/>, <see cref="ShellCmd(string, CancellationToken, int)"/>, <see cref="ShellCmd(string, ShellDataEventHandler, int)"/>, <see cref="ShellCmd(string, ShellDataEventHandler, CancellationToken, int)"/>
///<para/><see cref="ShellCmdHRes(string, int)"/>, <see cref="ShellCmdHRes(string, CancellationToken, int)"/>, <see cref="ShellCmdHRes(string, ShellDataEventHandler, int)"/>, <see cref="ShellCmdHRes(string, ShellDataEventHandler, CancellationToken, int)"/>
///</summary>
public bool WA_SingleArgument