yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Beatsleigher:
Public Class FormX

Private m_android As AndroidController = Nothing

Public Sub New()
' Init vars
MyBase.m_android = AndroidController.Instance
End Sub

Private FunctionPullFile(ByVal m_device As Device, ByVal m_pathOnDevice As String, ByVal m_pathOnHost) As Boolean ' You should re-think this method.
If (m_android.HasConnectedDevices) Then
Adb.ExecuteAdbCommand(Adb.FormAdbShellCommand(m_device, "su", "mount", "-o", "rw", "remount", "/data"))
Adb.ExecuteAdbCommand(Adb.FormAdbCommand(m_device, "pull", m_pathOnDevice, m_pathOnHost))
' MsgBox("Pulling succesful!")
' Never use MsgBox("")! We're not using VBScript... or VB6....
If (File.Exists(m_pathOnHost) Then
Return True
Else : Return False
Else
Return False
End If
End Sub

End Class

I fixed up your code a bit, try that. It should work. I'll try and grab some examples of pulling files and post them here.
[Android Software Development] virusvirus500:
Adding Resource files to .Net Project

Hi,

I would be grateful if you could provide step by step guide on how you have added the abe files to the .net project. and little bit of explanation of your recourse extractor class.

Thank you
[Android Software Development] Beatsleigher:
I'm not quite sure what you mean by Abe files... maybe you mean ADB files?

They're saved as resources, as byte arrays.

The resource extractor class uses the lib assembly and manually locates the byte arrays within the project's resources.

It then uses a stream to write the bytes of data to the hard drive in a specific location.

Not the easiest way to do it, but effective :good:
[Android Software Development] virusvirus500:
Adding Resource files to .Net Project

Hi Beatsleigher,

Sorry for my typo! I mean ADB files!

I tried adding a new file ADB.jar to the resource by right-clicking the Properties node under your project in Solution Explorer, clicking Open, and then clicking the Add Resource button on the Resources page in Project Designer. But when it is time to extract the file is not loaded. I tried to figure out why but could not find it. Can you please help me with this. and also in the code below:

private static readonly Dictionary<string, string> RESOURCES = new Dictionary<string, string>

{

{"adb.exe", "862c2b75b223e3e8aafeb20fe882a602"},

{"AdbWinApi.dll", "47a6ee3f186b2c2f5057028906bac0c6"},

{"AdbWinUsbApi.dll", "5f23f2f936bdfac90bb0a4970ad365cf"},

{"fastboot.exe", "35792abb2cafdf2e6844b61e993056e2"},

};

What is the alpha numeric value ? If it is a hash which algorithm are you using?

Thank you for you're reply
[Android Software Development] Beatsleigher:
Why were you trying to add a jarfile to a .NET project?

The alphanumeric values should just be standard MD5s.
[Android Software Development] virusvirus500:
Adding Resource files to .Net Project

I was trying to extract an encrypted .ab file. I tried to decrypt using bouncy castle library but it fails. the JAR file does the decryption for you. Please let me know if you have any alternatives for the same.
[Android Software Development] Beatsleigher:
After a quick Googling session, I know what you mean.

Lemme take a look. I'll get back to you in a few.

EDIT: I don't even have my Java IDEs on my laptop. Could take a few minutes more.
[Android Software Development] virusvirus500:
Adding Resource files to .Net Project

Thank you very much for the help attached to the message is the c# cod that I am using to decrypt the file. It fails at the encryption part. but if it is plain it works fine. it is based on AndroidBackupService.Java
[Android Software Development] Beatsleigher:
I'm just going through the code you sent me. There are a lot of weird things in the code.

For example, why are you using the concatenation operator instead of the string.Format() method, or "".Concat()?

And what's with the weird comments?

View attachment 3229500
[Android Software Development] virusvirus500:
This is just a first draft. I wanted to get it to work first. But the code will work just fine. It only fails if the ab file is encrypted with a pin. once i get it to work. I will clean up the code!
[Android Software Development] Beatsleigher:
Lol. I guess I did half the work then :p

I notoriously clean things up. Lol.

Anyways, the code file you posted seems just fine. Do you have a stacktrace or something similar?
[Android Software Development] virusvirus500:
the Problem is with trying to decryption AES/CBC/PKCS5Padding. The code starts failing at line 152, in line 162 for the code to work I have to get the length as 16 with for now I hard coded the original code looks like " int len = mkBlob[offset++]; "
[Android Software Development] Beatsleigher:
This might seem like a stupid idea, but AES (let's just use this one for a sec) has multiple cycles to try: 10, 12, and 14. Maybe loop through them and see which one works? It's just a thought.

EDIT: Scrap that
[Android Software Development] virusvirus500:
the number of rounds are loaded from ab file itself. if you open the encrypted ab file in notepad++ you can see the data in it.
[Android Software Development] Beatsleigher:
OK, I'm going to be the first to admit it: I have almost no clue what I'm looking at :|

View attachment 3229542

But I'll have to get back to you later. It's 03:48 in the morning. Again. I'll take another closer look when I get up again.

In the meantime, good luck. Keep me posted!

EDIT: Before I go, in case you saw something that might help in a way:

using System;

namespace TestApplication {

using System.IO;
using System.Text;

class Program {

static void Main(string[] args) {
Console.WriteLine(ReadHeaderLine(File.OpenRead(@"C:\Users\Beatsleigher\Documents\Visual Studio 2013\Projects\AndroidLib\AndroidLib\Resources\AndroidController\backup.ab")));
Console.Read();
}

private static string ReadHeaderLine(Stream input) {
int c = 0;
StringBuilder buffer = new StringBuilder();
while ((c = input.ReadByte()) >= 0) {
//if (c == '\n')
// break; // consume and discard the newlines
buffer.Append((char)c);
}
return buffer.ToString();
}
}
}
[Android Software Development] .:RaDeK:.:
How to get CID and MID from bootloader htc?

I'm using example code form 1'st topic. Please let me known, how to get CID and MID from HTC devices. The example shows getting Serial no but I would like to get more info. If U want help me, that please add code and locate CID in textbox2 and MID in textbox3.

Thank in advance.
[Android Software Development] Beatsleigher:
Imports RegawMOD.Android
Public Class Form1

Dim android As AndroidController
Dim device As Device
Dim info As Device

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
android = AndroidController.Instance
End Sub

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim serial As String
Dim cid As String
android.UpdateDeviceList()
If (android.HasConnectedDevices) Then
serial = android.ConnectedDevices(0)
device = android.GetConnectedDevice(serial)
TextBox1.Text = device.SerialNumber
Else
TextBox1.Text = "Error - No Devices Connected"
End If
End Sub

Private Sub Form1_FormClosed(sender As System.Object, e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
android.Dispose()
End Sub

Use the CODE-tags. That's what they're there for. Helping is not doing all the work for you.

Here's a link: http://bit.ly/1CxLQG2
[Android Software Development] .:RaDeK:.:
I known adb commands. I used these many times. Please let me known how to get MID and CID via AndroidController class.

Plase provide Getting Started.txt file and adroidlib.dll compiled library. I have no compiler for it:( I'm newbe and I started challenge with programming on VB NET.
[Android Software Development] .:RaDeK:.:
Hi once again. Let me known how to terminate process called by androidlib.dll?

For example:

TextBox3.Text = (Fastboot.ExecuteFastbootCommand(Fastboot.FormFastbootCommand("getvar cid")))

How to end command fastboot when device will not plug to device during 5 sec?
[Android Software Development] Trak-X:
Has anyone tried to compile recently from the master branch on github? I get an error about comments in the xml section, and i was able to track it to the FileSystem.cs - https://github.com/regaw-leinad/AndroidLib/commit/b1c6b33af1c8f68cb3cf1366ccb815f95d4bb054 , this commit, and this line: /// Gets a <see cref="Dictionary<string, ListingType>"/>

Maybe it can be checked by someone. I managed to step over it by going to the Project Settings and removing XML Reference.
[Android Software Development] Beatsleigher:
Compiles just fine for me. Haven't had any issues with it, neither during commit, nor after committing it.

It works fine on my fork, too.

You probably have a setting somewhere, that parses XML-warnings as an error and prohibits the build.
[Android Software Development] Trak-X:
It seems so, cause after i removed the option, it compiled and i can use it properly.

Thank you.

PS: Is there a way to get the free space on a partition? It seems the documentation site is down.
[Android Software Development] Beatsleigher:
Due to the fact that I have my own branch of AndroidLib, I uploaded the documentation for it to my webserver.

Some of the stuff in the documentation isn't for this branch/version, but most of it should be the same: http://beatsleigher.team-m4gkbeatz.eu/libraries/androidlib/ (inb4 STEALER: I gave credit where credit was due.)
[Android Software Development] TheCardinal:
trying to find the compiled .dll for this, can anyone please post the link for download :D thanks

currently using vs2008
[Android Software Development] akashk07:
Hi, which library is good? AndroidLib or MADB? I want to develop a full featured PC suite for Android.
[Android Software Development] gnmmarechal:
Question, I've been using AndroidLib for a long time, just wanted to check out the documentation again, but it seems it is down now? Do you have it somewhere else as well?
[Android Software Development] hoseyni-:
i created program by android lib and work geat !! but i need help for flash mdf or tar file to Samsung device in my program ... :-? can any one help me ?
[Android Software Development] Rain_Saeid:
how to display shell su Command in text box ?

hi

tnx regaw_leinad

how to display shell su Command in text box ?

for example :

adb shell

su

rm file.bin >> display command in textbox
[Android Software Development] darkanzali:
Does anybody have copy of documentation? Link from first post opens blank page. I couldn't find copies in the internet, but I want to use it and need this documentation.
[Android Software Development] VoxNephilia:
I scoured the web archives and managed to find a copy of it. It's missing all the images, but all the text is there. You will have to private message me and I will send the link, since I cannot post it until I get to 10 posts. (Just created this account to share this).

Would be pretty cool if someone could compile it all into a help document for others.
[Android Software Development] oakieville:
Hi if possble can someone help me. Im unclear how to get a response from device.install.apk(name.apk); and from device.pushfile(source, destination);
[Android Software Development] wwmorad:
Does anybody have copy of documentation? plz help
[Android Software Development] Beatsleigher:
For everyone asking (I hope I'm not too late) for the documentation:

https://docs.ca-softworks.com/AndroidLib
[Android Software Development] Trak-X:
if someone knows, where running the lib, and running on sh script in adb, how do can i set the timeout, or at least, how to run the script without hanging? now it remains stuck and i cannot close it in any way.

Adb.ExecuteAdbCommand(Adb.FormAdbShellCommand(device, true, "/data/local/tmp/myscript.sh"));

i can see in the task manager that this remains running for ever, until i kill it.

Thank you.

LE: got it :D ----> It should have been: Adb.ExecuteAdbCommandNoReturn(Adb.FormAdbShellCommand(device, true, "sh /data/local/tmp/myscript.sh"));

LE LE : nop. not good. still not working :(
[Android Software Development] altaf1148:
how to enable sms send permission

i cant figure out how to enable permission SEND_SMS using C# . if this can happen we can easily modify this library to send sms as well . any help ?
[Android Software Development] xlSKYFiRElx:
is it not yet possible to get the IMEI of an Android Device using this AndroidLib in C# ?
[Android Software Development] robcrann:
Can I use AndroidLib with Getac

I am coding on a PC and want to load/save files on a Getac connected serially. I can do this with by keying in the PC's 'Computer' icon. Can I do this with a C# program running Android.lib?
[Android Software Development] Rain_Saeid:
busybox command

hi

how to use busybox command in vb.net

i'm testing But run-time error

for example :

richtextbox = device.busybox.commands("ls -x")
[Android Software Development] FireAndi:
First thank you for this great lib!

Are you thinking about adding the new 1.0.36 version of the adb.exe ( http://xdaforums.com/htc-one/general/tool-updated-adb-version-1-0-32-fastboot-t2932160)?
[Android Software Development] 0xFireball:
What's the license for this project? Can I use it (with source) in my GPLv3 project (also on XDA)? Credit will be given where it is due.
[Android Software Development] QuangTruong:
Error when run demo app

i'm receive an error when run demo app:

i.imgur.com/WD6UjR8.png

Can't anyone help me fix this?

Thanks
[Android Software Development] raimondomartire:
Hi anyone can upload new compiled androidlib. Thanks
[Android Software Development] Don Pelayo:
Possible bug report

I am posting here since I don't see any bug dedicated thread. I have succesfully downloaded and compiled the source code of the library and the examples. However when I connect my phone (Oneplus two running 6.0.1, USB debugging enabled and MTP selected) it is not detected. Debugging in Visual Studio shows that android.connectedDevices has a count of zero.

In case I was doing something wrong I downloaded an application that uses AndroidLib, "Quick ADB Pusher", which comes with its own compiled dll of AndroidLib. This application is also unable to detect that the phone is connected. I have to note that the phone is indeed detected by the system (windows 10) and windows explorer allows you to browse it normally.

Am I missing something or is it a bug? Oneplus Two has the particularity of having the relatively new and uncommon USB-C .Since I assume the library does work for most people, could it have something to do with that? I have been unable to test this with a different phone yet.

I would really appreciate some help here, I am stuck and I would love to use this library.
[Android Software Development] dt_matthews:
If you open Device Manager what do you see displayed for your device? The key part is that you need it to have the adb driver associated to the device (regardless of whether you have it available as portable storage) so typically when its correctly registered you should see an entry something like "Android Composite ADB Interface" (the exact text varies but it will say 'ADB' in the entry).

If you dont have that then you need to re-install ADB - Windows is often a PITA with regards to ADB installation. Of course Linux needs no driver but hey, thats the world of windows dll hell for you :)
[Android Software Development] Don Pelayo:
Hehe... A PITA we must endure, I'm afraid. Device manager lists, under Universal Serial Bus Devices (USB), one entry: "ADB Interface". I am not sure if that's what I should have or not, it does have "ADB" in the text. Is there any way of checking if I have ADB installed? When you connect the device to the computer an asks if you want to install drivers, does that install ADB for that device as well? Excuse my noob questions.

And thank you very much for your prompt reply.

edit: I,ve just checked and I did install adb 1.3 for my phone, in order to root it. Interestingly enough version 1.4.3, current, didn't work, so I had to downgrade.
[Android Software Development] dt_matthews:
I would try uninstalling all phone & adb drivers, rebooting, then reinstalling the stock adb for the phone. I would guess that you have an incompatible adb driver registered so whilst it is recognised OK it just doesn't work.
[Android Software Development] Don Pelayo:
That is higly unlikely. It is a brand new laptop, fresh install of everything. The reason why the previous version didn't work was the installer didn't install anything. It said "0 files copied". Until I tried the previous one I was unable to root because there was no adb. I think I contributed to the confusion by using the term "downgraded". I didn't in reality.

This is the link to the adb installer that didn't work:

drive.google.com/file/d/0B0MKgCbUM0itNVB1elljU2NPR0k/view
[Android Software Development] dt_matthews:
Where did you get the adb installer from?

I would try getting a vanilla adb taken from the SDK and manually register the DLL for your device manager entry.
[Android Software Development] Don Pelayo:
I got it from the link I pasted above. I just had to take the "http" away because until you reach 10 messages (and these are my first posts) the forum does not allow to post a link, "to prevent spam".

edit: to be clear: check last line of my last post.

edit 2:

I just decided to take a more direct approach and there is something definitely wrong with my ADB installation. I opened a command prompt in C:\ADB and got this:

C:\ADB>adb devices

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

List of devices attached

C:\ADB>adb devices

List of devices attached

C:\ADB>

So ADB itself can't detect the phone (which was connected, MTP mode, and viewable from windows explorer).
[Android Software Development] dt_matthews:
Yes, I saw your link, but I'm not downloading installers I dont know the origin of - which is why I think getting the driver from the sdk is the way to go. This is backed up by the fact that your adb commands show that it cant detect your device.
[Android Software Development] Don Pelayo:
Uninstalled everything, reinstalled from Google SDK (with admin privileges) and, just in case, added an environment variable so that ADB is accesible from a command prompt anywhere. Now ADB does indeed detect the device (and several emulators), but the solution is still unable to detect anything, and the connectedDevices still has a count of 0. Any ideas? I am really stuck right now.
[Android Software Development] dt_matthews:
So looking at the solution, it has the binaries at \Resources\AndroidController - so check that the solution uses the binaries that you have confirmed correctly detect your device (from the sdk) - copying them over the solution adb+fastboot and the other two dlls should suffice.
[Android Software Development] dt_matthews:
I dont suppose the exe and or dll's still have the flag set for 'file came from unknown source'? (first tab on the properties window)

Obviously if they do tick and apply the 'unblock' checkbox.

Other than that, try modifying their permissions to allow 'Everyone' full read-write to rule out permissions.

What folder are they in? I assume not one that windows tries to 'secure' by limiting access to?
[Android Software Development] Don Pelayo:
No "unknown source" flag. The files are in "C:\Users\(my user name)\Documents\Visual Studio 2015\Projects\AndroidLib\AndroidLib\Resources\AndroidController", the same place where the previous ones, the ones bundled in AndroidLib, used to be. That shouldn't be an issue.

With respect to permissions, the three groups that appear ("system", (my user name) and "administrators") have all of them except from "special permissions". Total control, modify, read and execute, read and write.
[Android Software Development] dt_matthews:
Has visual studio lost the files build type?

If you look at their properties in solution explorer they should be marked as embedded resources.
[Android Software Development] Don Pelayo:
That, sir, did the trick! They were marked as content. Now the examples seem to work, no exceptions are thrown and the device is detected. Thank you very much for your help.

So to sum up for anyone that might find it useful: if the device is not detected uninstall your adb if it doesn't work and reinstall via the android sdk manager (as administrator). Then, eliminate in Visual Studio adb.exe, fastboot.exe and the two dlls and add them from wherever you have installed them, making sure they are embedded resources and not "content" or any other build action type.
[Android Software Development] dt_matthews:
Glad you sorted it. :)
[Android Software Development] rb0135:
Hi.

Sorry if this has been asked before (I did search, but couldn't find anything relevant), so here goes.

is there any command on the open device to find the External Storage path of a device?

If I run ADB from a cmd prompt, I can type this: adb shell echo $EXTERNAL_STORAGE and it does return the path of the External Storage.

So, is there a command I can use programmatically?

I have searched through the objects of the DLL but couldn't find anything (probably looking in the wrong place).

Thanks for any help.
[Android Software Development] Giovyx:
Hi, I'm having issues with detecting my device.. is it fine if it's connection method is MTP? Or it has to be another kind of connection type?

What I did is:

- Created a new c# console project

- Added the library project and add its reference to the main console project

- Included the library by adding its using

- Tried to run the provided sample (as per online documentation found here: docs.ca-softworks .com/AndroidLib/)

AndroidController android = AndroidController.Instance;
Device device;
string serialNumber;

Console.WriteLine("Waiting For Device...");

// This will wait until a device is connected to the computer
// Should ONLY be used in Console applications though, as it freezes WinForm apps
android.WaitForDevice();

// Gets first serial number of Device in collection
serialNumber = android.ConnectedDevices[0];

// New way to set 'device' to the first Device in the collection
device = android.GetConnectedDevice(serialNumber);

Console.WriteLine("Connected Device - {0}", device.SerialNumber);

android.Dispose();

Unfortunately, my android device isn't even detected by the lib.. it just keep waiting for a new device to be connected :(

What am I missing?

Thanks
[Android Software Development] Beatsleigher:
Is the device shown in the Device Manager?

Can you communicate with the device via the command prompt?

Have you unlocked and allowed access from the PC on your device?

Are developer options enabled?

You need to make sure developer options are enabled on your device, and then when you connect a PC and attempt to communicate via ADB, you need to authorise the PC - a prompt will show on the device.
[Android Software Development] StevenMattera:
Thanks for the great library! I'm currently using it on my System UI Tuner project if you want to add it to your list. (Thread)
[Android Software Development] andi205:
Hello,

i don't find the Online Documentation. Can you give me an Code-Examble, how i can use the FileSystem.GetFilesAndDirectories(String)- Methode? I would like to copy jpg-Files from android-device to my Windows-Computer.

What is the location-Parameter for this Methode?

Please excuse my bad english.

Thanks
[Android Software Development] Beatsleigher:
http://docs.ca-softworks.com/AndroidLib
[Android Software Development] andi205:
Thank you, but there are error-messages.

I tried:

Dim dic As New Dictionary(Of String, RegawMOD.Android.ListingType)

dic = RegawMOD.Android.FileSystem.GetFilesAndDirectories("")

I get the error-Message: "The reference to a non-shared member requires an object reference."

What is my mistake?