[DEV] AndroidCtrl.dll [7.1.46.0] (ADB/Fastboot/(apk/zip) Signer - Framework)

Search This thread

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
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"
 

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
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"

Heyho :)

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
 
Last edited:
  • Like
Reactions: squabbi

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
Heyho :)

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
Thanks bro! I look forward to it
 

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
Thanks bro! I look forward to it

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
 
Last edited:
  • Like
Reactions: retryer and squabbi

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
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

Thanks! I'll check it out soon! :D
 
  • Like
Reactions: k1ll3r8e

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
Hello! :D

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!
 
Last edited:

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
Hello! :D

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!

Heyho :)

I'm just downloading MSVS 2015 Enterprise... This will take a while... 21 GB^^

After this, i'll have a look at the "Logger".

But so far i can say, i implement an option to exclude some logging points.

- EDIT -

About the "wait-for-device", currently u have the following method which will do this for u.
ADB.Instance().WaitForDevice()
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.

- EDIT1 -

@squabbi the logger changes are a bit more complex as i thought... So i need a bit more time to do all the changes.

Regards,
Sebastian
 
Last edited:
  • Like
Reactions: squabbi

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
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! :)
 

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
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! :)

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
 

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
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'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.
 

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
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.

Heyho ;)
-
that good to hear ;)
-
About the output, maybe u passed an empty (string)deviceID?

Code:
IDDeviceState state = General.CheckDeviceState(ADB.Instance().DeviceID);

/* Are u sure that u selected a device before u use? */
ADB.Instance().DeviceID

About the selector, u can use the following variables to get the required data:
Code:
/* FileSystemViewModel myModel = new FileSystemViewModel(); */

(DataModelDevicesItem) myModel.DeviceSelector.SelectedItem
(ListCollectionView) myModel.DeviceSelector.ComboElements

Hope this helps u ;)

Regards,
Sebastian
 
Last edited:
  • Like
Reactions: squabbi

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
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
 
Last edited:
  • Like
Reactions: k1ll3r8e

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
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

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. :p)

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 :p

---
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
 
  • Like
Reactions: squabbi

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
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. :p)

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 :p

---
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

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
 

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
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

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:

Code:
Overall progress: Erasing/Formatting/Flashing/Rebooting
+--------------------------------------------------------+
|    1    |      2     |     3     |    4    |    5      |  (Progressbar)
+--------------------------------------------------------+

+--------------------------------------------------------+
|         Erasing/Formatting/Flashing/Rebooting          |  (Progressbar)
+--------------------------------------------------------+
about the MSVS editor error, i checked a view files but i can't reproduce this error... Which MSVS version did u use?

Hope this helps ;)

Regards,
Sebastian
 
Last edited:

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
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:

Code:
Overall progress: Erasing/Formatting/Flashing/Rebooting
+--------------------------------------------------------+
|    1    |      2     |     3     |    4    |    5      |  (Progressbar)
+--------------------------------------------------------+

+--------------------------------------------------------+
|         Erasing/Formatting/Flashing/Rebooting          |  (Progressbar)
+--------------------------------------------------------+
about the MSVS editor error, i checked a view files but i can't reproduce this error... Which MSVS version did u use?

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,
 

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
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,

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 this
Code:
^(?<SERIAL>.*?)\s{1,}(?<STATE>.*?)(\s{1,}product:\s{0,}(?<PRODUCT>.*?))?(\s{1,}model:\s{0,}(?<MODEL>.*?))?(\s{1,}device:\s{0,}(?<DEVICE>.*?))?$
to the "Regular Expression" box
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
 

squabbi

Senior Member
Jul 20, 2012
1,744
1,603
Sydney
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 this
Code:
^(?<SERIAL>.*?)\s{1,}(?<STATE>.*?)(\s{1,}product:\s{0,}(?<PRODUCT>.*?))?(\s{1,}model:\s{0,}(?<MODEL>.*?))?(\s{1,}device:\s{0,}(?<DEVICE>.*?))?$
to the "Regular Expression" box
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

Looks like it's validated so there should be no problems. I'll send you (PM) the whole thing so you can take a look at the connection monitor too.

Thanks,
Squabbi
 
  • Like
Reactions: k1ll3r8e

KP@2016

Senior Member
Apr 21, 2016
288
244
Mumbai
kpstvhub.com
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
 

k1ll3r8e

Senior Member
Mar 4, 2011
727
679
Delmenhorst
HTC Sensation
HTC One (M9)
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

Heyho ;)
thx for the warm words!
-
To get the buildprops u can use:
Code:
(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)

Btw. during heavy refactoring of the both dll's i added the new "pre-builds" as attachment that u can build ur app on top of the new dll's. Because i changed a lot of returns and types, for example: Nearly all List<string> have been replaced by IEnumerable<string> so u have a better control about the collections and during System.Linq the data is much faster available. Also a lot of List<string> have been replaced by bool and the functions act now on the process exit code.

I also work currently on the Win IoT and Win UWP versions of the dlls.

Regards,
Sebastian
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    This (C# .NET 4.6|4.7|4.8) dll is a kind of ADB/Fastboot/(apk/zip) Signer - Framework, it provides a lot of predefined .NET functions to communicate with an Android device. It's designed to work in 1st case with any non-root device but you can also use it with any rooted device (A few functions requires root access).

    License
    This project is licensed under the Apache License Version 2.0.

    The latest build 7.1.46.0 is currently only via FTP, GoogleDrive or Dropbox available, the DevDB has currently some upload issues!

    The following (N)amespaces, (C)lasses & (I)nterfaces are currently available:

    • (N) ADB
      • (N) Binary (This is the binary/exe implementation of ADB)
        • (C) ADB (static Management Class for the ADBClient's)
        • (C) ADBClient (Implementation of IADBClient)
        • (C) Channel (Implementation of IChannel)
      • (N) Device
        • (N) BusyBox
          • (C) BusyBox
          • (C) Find
          • (C) Tar
        • (N) Dumpsys
          • (C) Battery
          • (C) Dumpsys
          • (I) IBattery
        • (N) Input
          • (I) IKeyEvent
          • (C) Input
          • (C) InputExtensions
          • (C) KeyEvent (Implementation of IKeyEvent)
        • (N) IO
          • (NS) Compression
            • (NS) BrotliSharp (Only available in .NET 4.6|4.7|4.8 - In .NET Standard >= 2.1 you have to use the native .NET implementation)
          • (C) ADirectoryInfo (Similar to .NET Directory/-Info)
          • (C) AFileInfo (Similar to .NET File/-Info)
          • (C) AFileStream (Similar to .NET FileStream)
          • (C) AFileSystemInfo (Similar to .NET FileSystemInfo, it's the abstract base for ADirectoryInfo & AFileInfo)
          • (C) AMountPointInfo (Similar to ADirectoryInfo & AFileInfo but only for mounts)
          • (C) FileSystemCache (A cache object for ADirectoryInfo & AFileInfo)
          • (I) IFileSystemCache (Interface for FileSystemCache)
          • (C) IO
          • (I) ITransferMessage
          • (C) MediaScanner (Manage the Android MediaScanner, useful after some file-transfers via ADB)
          • (C) Mount (Requires Root and manage the mounts)
          • (C) Stat (stat class for the ADB-Protocol)
          • (C) SyncStream (Base implementation of the ADB sync service. Utilized by AFileStream)
          • (C) TransferMessage
          • (C) UPath (Similar to .Net Path but for unix paths)
        • (N) Logcat
          • (I) ILogEntry
          • (C) Logcat
          • (C) LogEntry
        • (N) Manager
          • (C) ActivityManager
          • (I) IInstrumentation
          • (C) Instrumentation
          • (I) IPackage
          • (I) IPermission
          • (C) Manager
          • (C) Package
          • (C) PackageManager
          • (C) Permission
        • (N) Provider
          • (C) Contacts (Contacts provider)
          • (C) ContactsDataField
          • (C) ContactsEmail
          • (C) ContactsEvent
          • (C) ContactsGroup
          • (C) ContactsIdentity
          • (C) ContactsIM
          • (C) ContactsName
          • (C) ContactsNickname
          • (C) ContactsNote
          • (C) ContactsOrganization
          • (C) ContactsPhone
          • (C) ContactsPhoto
          • (C) ContactsPostalAddress
          • (C) ContactsRelation
          • (C) ContactsSipAddress
          • (C) ContactsWebsite
          • (I) IContactsDataField
          • (C) Provider
          • (C) Telephony (Telephony provider)
        • (N) Screen
          • (C) Framebuffer (Implementation of IFramebuffer)
          • (C) FramebufferInfo
          • (I) IFramebuffer (Interface of an RAW framebuffer)
          • (I) IFramebufferInfo
          • (I) IScreenDimension
          • (I) IScreenFocus
          • (C) Screen
          • (C) ScreenDimension
          • (C) ScreenFocus
        • (N) Shell
          • (I) IShell (Interface of an shell with in-/output abilities)
          • (C) Shell (Implementation of IShell)
        • (N) SQLite
          • (C) Options
          • (C) QueryTools
          • (C) SQLite3 (SQLite3 database connector)
        • (C) BuildProperties
        • (C) Daemon (Manage the daemon on the device)
        • (C) Device
        • (C) Forensics (ALFA-State)
        • (I) IUptime
        • (C) OpenRecoveryScript (Manage the OpenRecoveryScript)
        • (C) Phone (Start a call, dial a number, add a contact or send a sms)
        • (C) Su
        • (C) Uptime
        • (C) Wipe
      • (N) Shares
        • (C) Monitor (Implementation of IMonitor)
      • (N) Socket (This is the IP based implementation of ADB - Here is NO binary/exe required)
        • (C) ADB (static Management Class for the ADBClient's)
        • (C) ADBClient (Implementation of IADBClient)
        • (C) ADBSocket (IP based connector - Mimics the ADB-Server)
        • (C) Channel (Implementation of IChannel)
      • (C) ADBridge (Unified access to Binary.ADB and Socket.ADB)
      • (I) IADBClient (Interface for nearly all ADB commands)
      • (I) IChannel (Interface of an RAW data channel)
    • (N) Fastboot
      • (C) Backdoor (Some backdoor commands)
      • (C) Fastboot (static Management Class for the FastbootClient's)
      • (C) FastbootClient (Includes nearly all fastboot.exe commands)
      • (I) IFastbootClient (Interface for FastbootClient)
      • (C) Monitor (Implementation of IMonitor)
      • (C) OEM (Some OEM commands)
      • (C) Wipe
    • (N) ProcessModels
      • (C) General (Includes some predefined process models)
      • (I) IRealTimeBG (Interface of an background process with in-/output abilities)
      • (C) RealTimeBGExeV2 (Implementation of IRealTimeBG)
    • (N) Signer
      • (C) Signer (signapk.jar Interface)
    • (N) Tools
      • (C) CRC
      • (C) Deploy (Deploy the AAPT/ADB/Fastboot/Signer files needed by this dll)
      • (C) Hash
      • (C) Hex
      • (C) IMEI (Some helper to verify and rebuild a valid IMEI)
      • (C) ToolBox
    • (C) Cleanup (Delete the files/folders which were created by this dll)
    • (C) Config
    • (C) DeviceInfo (Basic device info, the return from "(Binary/Socket).ADB.Devices()" and "Fastboot.Devices()")
    • (I) IDeviceInfo (Interface for DeviceInfo)
    • (I) IMonitor (Interface for the ADB.Binary, ADB.Socket and Fastboot.Fastboot monitor)

    Special
    • Ready-To-Go MVVM's for WPF, XAML via my AndroidCtrlUI.dll
    • Multi-Device compatible, you can manage unlimited devices at the same time with this dll. Each device gets it's own instance. (Thread-Safe, the dll use lock() for critical sections)
    • UTF8-File/Folder Transfer you can transfer files/folders with containing special chars (ü, ö, ä, €, @, à, è, etc.)
    • On-the-fly Device to Device copy (Binary <-> Binary | Binary <-> Socket | Socket <-> Socket)
    • Device-Monitor, if activated, it will check every 10 sec. ADB & Fastboot for new connected devices and call an defined callback, if something changed. So your program get's an info if an device is connected or removed.
    • All Android key-events as (int)enum and the ability to send them as single or stack.

    Hint
    • You can use all ADB methods/commands via USB or W-Lan/Lan, if your Rom supports ADB via W-Lan/Lan (Settings/Developer Settings)
    • If you want to use all sub-classes of IADBClient with BusyBox instead of the Shell, you have to set IADBClient.UseBusyBox to true. This will tell the instance to use the BusyBox commands inside each method, if the device has BusyBox installed.

    Referenced .NET assembly's
    System
    System.Numerics
    System.XML

    Used Code-analysis rules:
    Basic & Advanced Microsoft-Rules for Accuracy
    Microsoft-managed minimum & recommended rules
    Microsoft Security Rules

    About the usage, the namespaces (ADB, Fastboot, Signer) have one basic instance. For example, ADB.Instance(), Fastboot.Instance(), Signer.Instance. As you can see ADB.Instance() and Fastboot.Instance() can have a parameter. This parameter is in both cases an (string) DeviceID, an IDeviceInfo or null, if you use for example null, both classes will return it's Selected client. If you use the DeviceID or the IDeviceInfo the return is a fresh instance of the client or the already created instance. So, in any case, before you call ADB/Fastboot.Instance(). Check with ADB/Fastboot.Devices() if you have a connected device. If so, use the IDeviceInfo object to start your device instance or simply pass the serial to the Instance(). All instances which you have created on this way, will be hold inside an Dictionary<string, ADBClient>, so you can configure each device instance to it's needs and call it when ever you need it. This is also the point where i say it's multi-device and multi-thread safe. Because, if you always use ADB/Fastboot.Instance() you can't reach the wrong device. Also, all classes using lock() for critical sections, because [MethodImpl(MethodImplOptions.Synchronized)] is not longer available under .NET Standard.

    If you have any wishes like new features, how-to's or something else, let me know! :cyclops:

    Tested OS
    Win Vista | 7 | 8 | 8.1 | 10 (32Bit/64Bit in VM-Ware)
    Win 7 | 8 | 8.1 | 10 (64Bit Native)
    Win XP is not longer supported by ADB! (But, if you have a old ADB binary, the dll will do it's job)

    Tested Devices
    Android Emulator some Versions (min. 2.x) in AVD
    Android x86
    HTC Sensation -/ XE (non-/rooted)
    HTC One M9 (non-/rooted)
    Huawei P9 Lite (VNS-L21,22,23,31,etc.) (non-/rooted)
    Huawei P10 Lite (WAS-LX1A,etc.) (non-/rooted)
    Samsung Galaxy 2-5 (non-/rooted)
    Samsung Galaxy S Plus (non-rooted)
    A few Samsung Tabs (non-/rooted)
    Google Pixel 4 (Android 11) (non-/rooted)

    Requirements
    Android: min. 2.x
    Platform: x86/x64 (Windows)
    Frameworks: min. .NET 4.6 and JRE (only for the Signer)
    (Installed ADB/Fastboot device driver)

    Download
    Mirror: XDA-DevDB (since 29.01.2019 no uploads possible)
    Mirror #1: My FTP (Build archiv)
    Mirror #2: GoogleDrive
    Mirror #3: Dropbox
    Each zip-archiv contains the AndroidCtrl.dll, its markup file AndroidCtrl.xml and the program debug database AndroidCtrl.pdb for .NET 4.6|4.7|4.8 and .NET Standard 2.1 (beta)

    Examples (Updated to dll version 7.1.46.0) (Updated in the next 24 h)
    Mirror: My FTP
    Mirror #1: GoogleDrive
    Mirror #2: Dropbox
    (Contains a simple exe and its source written in C# WPF)

    Source
    N/A (If you want to have a look at it, send me a PM or simply decompile it.)

    DO NOT MIRROR MY FILES! DO NOT COPY MY THREADS!

    XDA:DevDB Information
    AndroidCtrl.dll, Tool/Utility for the Android General

    Contributors
    k1ll3r8e, squabbi, Krystanos

    Version Information
    Status: Stable
    Current Stable Version: 7.1.46.0
    Stable Release Date: 2020-09-19

    Created 2016-07-24
    Last Updated 2020-09-19
    6
    Problems & Solutions

    1. Windows 8.x | 10.x

    NOTE
    If u use any callback functions, u have to invoke any UI-/ variable-interaction from an dispatcher like the following example:
    Code:
    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
         });
    }
    if u do it without dispatcher, u'll get an "Thread Exception".


    More examples coming soon...
    (If u need a specific example, just let me know, i'll try my best to provide one.)
    3
    Changelog

    DD.MM.YYYY | (A) = Added | (C) = Changed | (D) = Deleted | (F) = Fixed | (R) = Recoded | (U) Updated
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    26.07.2020 [7.0.46.0]
    (A) Some new Async overloads to the AFileInfo, AFileSystemInfo, ADirectoryInfo and AMountpointInfo.
    (F) A few little bugs

    01.02.2020 [6.7.46.0]
    (A) ADB.IADBClient{} (The old IADB interface)

    (A) ADB.Binary.ADB{} (The old ADB class - only the statics)
    (A) ADB.Binary.ADBClient{} (The old ADB class - without any statics)

    (A) ADB.Socket.ADB{} (The old ADB class - only the statics)
    (A) ADB.Socket.ADBClient{} (The old ADB class - without any statics)

    (A) ADB.Device.ADirectoryInfo{}
    (A) ADB.Device.AFileInfo{}
    (A) ADB.Device.AFileStream{}
    (A) ADB.Device.AMountPointInfo{}
    (A) ADB.Device.FileSystemCache{}
    (A) ADB.Device.IFileSystemCache{}

    (D) ADB.Device.Directories{}
    (D) ADB.Device.Files{}
    (D) ADB.Device.FileSystem{}
    (D) ADB.Device.FileSystemItem{}
    (D) ADB.Device.IFileSystemItem{}
    And everything related to those classes... Directories has been replaced with ADirectoryInfo, Files has been replaced with AFileInfo and FileSystem has been replaced with AMountPointInfo.

    31.05.2019 [6.0.46.0]
    (C) The Framework Version from 4.0 to 4.6
    (C) The versioning:
    6 = Major
    0 = Minor
    46 = Framework Version (4.6)
    0 = Hotfix

    (A) (int) ADB.Instance().Device.Screen.GetAutoBrightness()
    (A) (int) ADB.Instance().Device.Screen.GetBrightness()
    (A) (ScreenBrightnessMode) ADB.Instance().Device.Screen.GetBrightnessMode()
    (A) (ScreenRotation) ADB.Instance().Device.Screen.GetRotation()
    (A) (ScreenRotationMode) ADB.Instance().Device.Screen.GetRotationMode()
    (A) (bool) ADB.Instance().Device.Screen.SetBrightness(int brightness)
    (A) (bool) ADB.Instance().Device.Screen.SetBrightnessMode(ScreenBrightnessMode mode)
    (A) (bool) ADB.Instance().Device.Screen.SetRotation(ScreenRotation rotation)
    (A) (bool) ADB.Instance().Device.Screen.SetRotationMode(ScreenRotationMode mode)

    (D) ASDK (enum)
    (C From) (ASDK) ADB.Instance().Device.GetSDK()
    (C To) (int) ADB.Instance().Device. GetSDK()


    10.04.2019 [0.0.5.2]
    (A) A workaround for older SU binaries
    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

    (A) A fix for unresponsive interactive shells. This happened to me on Lineage on my HTC Sensation, where the device sends an "resize" request... Sending a command in this state caused the command getting cut at the 1st byte, for example, u send "id -u" the delivered command was "d -u".

    (A) Added "feature" detection for Binary.ADB, now u can get the "features" of the device like: cmd, stat, stat_v2, shell, shell_v2, etc. in the "IChannel.Features".

    (R) Removed the last bit of code duplication and optimized some internal logic's. For example, the "Socket.IChannel" got a speed boost from ~1.920.000 bytes during an transfer of 14.400.000 bytes.


    06.03.2019 [0.0.5.1]
    (C) ADB.Device structure (see 1st post)
    (R) ADB.Device.Provider (Decreased the loading time of the contacts and their data)
    (D) AAPT completely

    Older Changes:

    16.02.2019 [0.0.4.2]
    (A) DNS lookup for ADB.Socket
    (R) Reduced code duplication

    07.02.2019 [0.0.4.1]
    (F) An issue inside the ADB.Binary, the problem was that "ADB.Devices()" returned nothing, if more than one device was connected. Reason for the issue was the "(int)IChannel.ReadHexLength()" function, there i read an Int16 but it was an UInt16 which caused an overflow.


    29.01.2019 [0.0.4.0]
    (U) AAPT, ADB, Fastboot binaries and the required dlls to the latest version (1.0.40)

    (A) ADB.ADBridge - Unified access to ADB.Binary and ADB.Socket
    (A) ADB.IADB - Interface for ADB-/Socket with nearly all ADB commands
    (A) ADB.IChannel - Interface of an ADB-/Socket RAW-data channel
    (A) ADB.IFramebuffer - Interface for the ADB-/Socket framebuffer
    (A) ADB.IShell - Interface for the ADB-/Socket Shell v1 & v2
    (A) IMonitor - Interface for the ADB-/Socket and Fastboot device-monitor

    (A) On-the-fly device to device copy (ADB.Binary <-> ADB.Binary | ADB.Binary <-> ADB.Socket | ADB.Socket <-> ADB.Socket)

    Reordered the ADB namespace... The old layout was:
    ADB - Binary based ADB
    ADB.Device - Device helper
    ADBSocket - Socket based ADB

    The new layout is:
    ADB - Main ADB
    ADB.Binary - Binary based ADB
    ADB.Device - Device helper
    ADB.Shared - Shared helper, extensions for ADB.Binary and ADB.Socket
    ADB.Socket - Socket based ADB

    Implemented the framebuffer for ADB.Binary and ADB.Socket (A ready-to-go Remote-Desktop is available via my AndroidCtrlUI.dll)

    09.04.2018 [0.0.3.1]
    This is a complete new version!
    -
    I added a lot of new stuff like the "CancellationToken" overload, the "MediaScanner" class and also some fine tunes to the "Screen" class, there u can now also get the Screen dimensions. Also a lot models like the old MemDumpxxx_4xx have been removed (we are now 4 versions higher and the outputs are not longer available or have changed to much).

    15.02.2018 [0.0.2.5]
    (F) A problem where a NULL exception was raised during directory parsing
    (F) A few UI freezes and applied a few tweaks to some logic's.

    (D) Tools.Icons {}
    (D) Tools.TrayNotify {}
    Reason for this is the upcoming compatibility to .NET Core. BUT, the functions are not lost, i added those not .NET Core compatible calls to the AndroidCtrlUI.dll... Because the UI dll will be never migrated to .NET Core.

    03.11.2017 [0.0.2.4]
    Nearly full new build
    -
    Sadly my notes are lost, based on a data loss on my Dev Environment...
    3
    Contacts & MMS/SMS

    Hey all together,

    this is only an status update!

    The next build includes:

    1. SQLite3 database connector | ADB.Instance().Device.SQLite3{}
    2. Contacts viewer (The writer will take a bit more time and a few testers, coz the table structure is different between each ROM...)
    3. MMS/SMS viewer (For the writer goes here the same as for the contacts, the tables are different between each ROM...)
    4. A few fixes, mainly on ProcessModels.General{}, coz there is a bug inside the ExecuteBGStack() method.

    ------------------------------------------------------------------------------------------------------------------------------------------
    New build is out!

    About the sms/mms & contact reader, all classes require root access on the device!
    -
    About the writer, i have currently a very alfa-state writer which i test currently on some AVD's... Hopefully the next version will include it!

    And as always, if u find some bugs pls report them! ;)

    Regards,
    Sebastian