Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi every one
I am developing and application for android mobile forensic analysis.I am using c# windows forms application for interface of my project.But i am finding difficult to get response of commands from ADB shell to c#. I am done with some work but I am not able to display information in listBox or listView in a proper sequence. I am getting files information from adb shell but unable to display them in lisBox or ListView in a proper sequence i-e File name, Creation date, Modification date.
For example ls -l returns the information of a file as following
----rwxr-x system   sdcard_rw  8414449 2013-07-12 18:04 Kalimba.mp3<br />
<br />
----rwxr-x system   sdcard_rw   280065 2013-07-12 18:03 abc.mp3<br />

I would like to display this information in listView as for all files:

File permissions File Location DateCreated File Name

----rwxr-x sdcard_rw 2013-07-12 18:03 kalimba.mp3

and same for all other commands like stat e-t-c

Any help or Links would be appreciated
Posted
Updated 16-Sep-19 2:23am
Comments
CHill60 13-Jul-13 13:04pm    
Try posting the code that you are using to display the information in a listBox or listView and explain what the proper sequence should be
Ghulam Ali 13-Jul-13 13:36pm    
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = "cmd.exe";
pp.StartInfo.Arguments = "/c adb shell ls -l /sdcard/music/";
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;

p.Start();

StreamReader outputWriter = p.StandardOutput;
String errorReader = p.StandardError.ReadToEnd();
String line = outputWriter.ReadLine();


while (line != null)
{
using (TextReader tr = new StringReader(str))
{
string Line;
while ((Line = tr.ReadLine()) != null)
{


String[] temp = Line.Split(' ');
listview1.Items.Add(new ListViewItem(temp));
}
}
line = outputWriter.ReadLine();

}
I want something like that into my listview in case of ls -l
FilePermission FileLocation CreationDate
rwx-- sdcard 07-03-2013

and so on for all files and all commands, I just want general method to do it all

I am able to display sometimes when I do not have to do much splitting but when I have to split the string for the purpose of adding them to listView it does not works


AlphaDeltaTheta 14-Jul-13 3:34am    
Wrong format. Have a look at the ls command output first. Let me explain a bit. ls is a standard UNIX command. It outputs in the following format: [file-permission] [length] [last-modified] [name]. where file permission is a (cryptic) string representation of UNIX file permissions. Google for man pages of the ls or other command you like to see.
Ghulam Ali 14-Jul-13 5:37am    
Yes I also have the same output for ls -l but i want to display [file-permission][last-modified][name] in a listView for every file.
No matter what command is used and what is output,My question is actually that how i can display some parts of output string in list view for all files using split or some other method..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900